Skip to content

Instantly share code, notes, and snippets.

View Merwanski's full-sized avatar
:electron:
Focusing

Merwanski

:electron:
Focusing
  • Belgium
  • Belgium
View GitHub Profile
@Merwanski
Merwanski / bag_to_ply.py
Last active July 20, 2024 13:04
How to extract point cloud data from ros1 bag file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Extract a folder of ply from a rosbag.
python3 bag_to_ply.py FILE_NAME.bag FOLDER_NAME TOPIC_NAME
e.g.,
python3 bag_to_ply.py FILE_NAME.bag FOLDER_NAME /point_cloud/cloud_registered
"""
import os
@Merwanski
Merwanski / notes_warnings.md
Created June 13, 2024 07:43
An option to highlight a "Note" and "Warning" using blockquote

What to use?

> [!NOTE]  
> Highlights information that users should take into account, even when skimming.

> [!TIP]
> Optional information to help a user be more successful.
@Merwanski
Merwanski / timeInference.py
Created April 2, 2024 16:37
YOLOv8 time inference script
from ultralytics import YOLO
import time
import cv2
import math
image = cv2.imread('bus.jpg')
model = YOLO('yolov8n.pt') # pretrained YOLOv8n model
# object classes
@Merwanski
Merwanski / docker_on_nvidia_jetson.md
Created March 20, 2024 17:16
How to setup docker on a jetson nvidia Xavier, Orin, Nano to save space

1. Clean up the Xavier

You can skip this if you don't have any issues with the demo and enough space df -h

sudo apt update 
# remove "ros" from here /etc/apt/sources.list 
sudo apt upgrade
# After this docker seems to be installed already

## NOK
## sudo apt install nvidia-jetpack --> NOK
@Merwanski
Merwanski / ros2bag_data_extractor.py
Created January 15, 2024 20:58
ros2bag_data_extractor.py
import os
import cv2
import open3d as o3d
import numpy as np
from sensor_msgs.msg import PointCloud2
from sensor_msgs.msg import CompressedImage
import rclpy
from rclpy.node import Node
from rclpy.qos import QoSProfile
import pcl
@Merwanski
Merwanski / .bashrc
Created January 9, 2024 21:00
Ubuntu: Show your branch name on your terminal
### Add these lines in your ~/.bashrc file
# Show git branch name
force_color_prompt=yes
color_prompt=yes
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
@Merwanski
Merwanski / Dockerfile
Created March 31, 2023 22:58
Dockerfile OpenCL
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get -y upgrade \
&& apt-get install -y \
apt-utils \
unzip \
tar \
curl \
xz-utils \
ocl-icd-libopencl1 \
@Merwanski
Merwanski / guess_aruco_type.py
Created February 9, 2023 21:45
guess aruco type
# import the necessary packages
import argparse
import imutils
import cv2
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True, help="path to input image containing ArUCo tag")
args = vars(ap.parse_args())
@Merwanski
Merwanski / cad_viewer_streamlit.py
Created January 25, 2023 12:27
cad viewer in streamlit
import streamlit as st
import io
import pyvista as pv
from pyvista.jupyter.pv_pythreejs import convert_plotter
from ipywidgets import embed
import streamlit.components.v1 as components
def show_CAD_window():
mesh = pv.read('model.obj')
@Merwanski
Merwanski / write_read_pickle.py
Created January 21, 2023 20:47
write_read_pickle.py
################################################################################
## WRITE PICKLE
#!/usr/bin/env python
import pickle
import numpy as np
a = np.matrix('1 2; 3 4')
b = 0