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 / rosbag_to_csv.py
Created November 13, 2022 09:57
rosbag_to_csv.py
import rosbag, sys, csv
import time
import string
import os #for file management make directory
import shutil #for file management, copy file
# verify correct input arguments: 1 or 2
if (len(sys.argv) > 2):
print("invalid number of arguments: " + str(len(sys.argv)))
print("should be 2: 'bag2csv.py' and 'bagName'")
@Merwanski
Merwanski / aruco_generate.py
Last active November 13, 2022 09:53
aruco marker generator
import cv2
import cv2.aruco as aruco
# Select type of aruco marker (size)
aruco_dict = aruco.Dictionary_get(aruco.DICT_5X5_1000)
# Create an image from the marker
# second param is the ID number
# last param is the image size
img = aruco.drawMarker(aruco_dict, 2, 700)
@Merwanski
Merwanski / avi2png.py
Last active November 13, 2022 09:48
avi2png.py extract images from video
"""
Created on Mon Nov 13 16:12:42 2017
@author: merwan
"""
import numpy as np
import cv2
import time
import os
import argparse
@Merwanski
Merwanski / streamlit_ros_python.py
Created September 17, 2022 05:47
streamlit ros python
from streamlit.web import cli as stcli
import streamlit as st
import rospy
from std_msgs.msg import String, Int32
import sys
import time
mynum=0
mydelta=0
@Merwanski
Merwanski / main.py
Created August 21, 2022 17:20
read and display image in python
# import necessary packages
import numpy as np
import cv2
# path to image
path_to_image = "data/cv_image_000.jpg"
# read the image with cv2
image = cv2.imread(path_to_image)
print('Original Dimensions : ', image.shape)
@Merwanski
Merwanski / keras_h5_modelInference.py
Created June 18, 2022 02:42
How to use keras h5 model
from keras.models import load_model
from PIL import Image, ImageOps
import numpy as np
# Load the model
model = load_model('keras_model.h5')
# Create the array of the right shape to feed into the keras model
# The 'length' or number of images you can put into the array is
# determined by the first position in the shape tuple, in this case 1.
@Merwanski
Merwanski / importMnistTensorFlow.py
Created June 18, 2022 02:17
import minst dataset from tensorflow
# import necessary packages
import tensorflow as tf
import tensorflow_datasets as tfds
# Construct a tf.data.Dataset
# Data loaded into ~/tensorflow_datasets/mnist
ds = tfds.load('mnist', split='train', shuffle_files=True)
# Build your input pipeline
ds=ds.shuffle(1024).batch(32).prefetch(tf.data.experimental.AUTOTUNE)
@Merwanski
Merwanski / kinect_v2_ubuntu18.txt
Created June 10, 2022 02:47
kinect_v2_ubuntu18
kinect_v2_ubuntu18
Kinect2 Setup Guide
https://scazlab.github.io/kinect2_setup_guide.html
Welcome to the Setup Guide for Kinect2.
System
@Merwanski
Merwanski / photo_2_video.py
Last active April 8, 2024 09:46
photo_2_video
import cv2
import os
import numpy as np
import glob
video_file_name = 'FILE_NAME.mp4'
path_to_images = 'PATH'
extension = "png" # png, jpg, ...
@Merwanski
Merwanski / read_image_resize_show.py
Created May 31, 2022 22:45
read_image_resize_show
# import necessary packages
import numpy as np
import cv2
# path to image
path_to_image = "data/cv_image_000.jpg"
# read the image with cv2
image = cv2.imread(path_to_image)
print('Original Dimensions : ', image.shape)