This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
from matplotlib import pyplot as plt | |
import os | |
""" | |
source: https://medium.com/@nhancv/opencv-python-connect-to-android-camera-via-rstp-9eb78e2903d5 | |
NB: Did not work on windows 10 | |
""" | |
os.environ["OPENCV_FFMPEG_CAPTURE_OPTIONS"] = "rtsp_transport;0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create The Sandbox You Play In | |
conda create --name your_env_name python=3.7 -y | |
conda create --name your_env_name python=3.7 scipy=0.15.0 astroid babel | |
conda env export > my_environment.yml | |
conda info --envs | |
conda activate your_env_name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Importing necessary functions | |
from keras.preprocessing.image import ImageDataGenerator, | |
array_to_img, img_to_array, load_img | |
# Initialising the ImageDataGenerator class. | |
# We will pass in the augmentation parameters in the constructor. | |
datagen = ImageDataGenerator( | |
rotation_range = 40, | |
shear_range = 0.2, | |
zoom_range = 0.2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymeshlab as ml | |
ms = ml.MeshSet() | |
ms.load_new_mesh('input.ply') | |
m = ms.current_mesh() | |
print('input mesh has', m.vertex_number(), 'vertex and', m.face_number(), 'faces') | |
# Target number of vertex | |
TARGET=10000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# initial code from https://github.com/ros-perception/vision_opencv/blob/noetic/cv_bridge/python/cv_bridge/core.py | |
import cv2 | |
import numpy as np | |
import sensor_msgs | |
def cv2_to_imgmsg(cvim, encoding="passthrough", header=None): | |
if not isinstance(cvim, (np.ndarray, np.generic)): | |
raise TypeError('Your input type is not a numpy array') | |
# prepare msg | |
img_msg = sensor_msgs.msg.Image() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Installation instructions from https://docs.docker.com/engine/install/ubuntu/ | |
# Update the apt package index and install packages to allow apt to use a repository over HTTPS: | |
sudo apt update | |
sudo apt install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common | |
# Add Docker’s official GPG key | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | |
# Use the following command to set up the stable repository | |
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
# INSTALL DOCKER ENGINE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Docker-CE on Ubuntu can be installed using Docker's official convenience script: | |
curl https://get.docker.com | sh \ | |
&& sudo systemctl --now enable docker | |
# Setting up NVIDIA Container Toolkit | |
# Setup the stable repository and the GPG key: | |
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ | |
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \ | |
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import cv2 | |
import numpy as np | |
parser = argparse.ArgumentParser(add_help=False) | |
parser.add_argument("--image", default='samples/image.jpg', help="image for prediction") | |
parser.add_argument("--config", default='cfg/yolov3.cfg', help="YOLO config path") | |
parser.add_argument("--weights", default='yolov3.weights', help="YOLO weights path") | |
parser.add_argument("--names", default='data/coco.names', help="class names path") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import necessary packages | |
from numpy import expand_dims | |
from keras.models import load_model | |
from keras.preprocessing.image import load_img | |
from keras.preprocessing.image import img_to_array | |
import time | |
import pdb | |
# load and prepare an image | |
def load_image_pixels(filename, shape): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import glob | |
video_file_name = 'project.wmv' | |
path_to_images = 'path_2_video/*.bmp' | |
cmpt = 0 | |
for filename in glob.glob(path_to_images): |