Skip to content

Instantly share code, notes, and snippets.

View bresilla's full-sized avatar
💣
:(){ :|:& };:

Trim Bresilla bresilla

💣
:(){ :|:& };:
View GitHub Profile
#include <iostream>
#include <cstring>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/can.h>
#include <linux/can/raw.h>
namespace scan{
# Compile OPENCV with CUDDN
sudo apt install cuda-toolkit-12-1 tensorrt*
install:
sudo apt-get install build-essential cmake unzip pkg-config
sudo apt-get install libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install libv4l-dev libxvidcore-dev libx264-dev
sudo apt-get install libgtk-3-dev
sudo apt-get install libblas-dev liblapack-dev gfortran
@bresilla
bresilla / opencv-cuda.md
Created March 26, 2024 11:29 — forked from Birch-san/opencv-cuda.md
Building OpenCV with CUDA acceleration

For CUDA 12, see Installing CUDA 12.1.1 + PyTorch nightly + Python 3.10 on Ubuntu 22.10 for how to install Nvidia driver 530, gcc 12 and CUDA 12.1.1 libraries.
If you want CUDA 11.8, then you can use latest Nvidia driver from Production branch, 525, with gcc 11.

Activate your conda environment, if you haven't done so already.

CUDA 11:
Make sure gcc 11 is the default gcc for your OS, or select gcc 11 explicitly.
CUDA 12:
Make sure gcc 12 is the default gcc for your OS, or select gcc 12 explicitly.
Check CUDA_DIR below points to the CUDA installation you wish to use.

@bresilla
bresilla / darwin_to_yolo.py
Created March 19, 2024 13:47
darwin_to_yolo
import os
import json
import argparse
import shutil
from PIL import Image
import cv2
import numpy as np
classes = {"rkn": 0, "fln": 1}
@bresilla
bresilla / complex_tracker.py
Created March 18, 2024 15:38
complex_tracker
from typing import List
import numpy as np
import torch
import torchvision.ops.boxes as bops
import norfair
from norfair import Detection, Tracker, Paths
import rclpy
from rclpy.node import Node
@bresilla
bresilla / simple_tracker.py
Created March 18, 2024 15:16
simple_tracker
#!/usr/bin/env python3
import numpy as np
import rclpy
from rclpy.node import Node
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from detection_msgs import BoundingBoxes
import cv2
from message_filters import Subscriber, ApproximateTimeSynchronizer
@bresilla
bresilla / bbox_opencv_onnx.py
Created March 6, 2024 13:58
bbox_opencv_onnx
import argparse
import cv2
import numpy as np
CLASSES = {0: "big", 1: "small"}
colors = np.random.uniform(0, 255, size=(len(CLASSES), 3))
def draw_bounding_box(img, class_id, confidence, x, y, x_plus_w, y_plus_h):
label = f'{CLASSES[class_id]} ({confidence:.2f})'
@bresilla
bresilla / bbox_tensorrt_engine.py
Created March 6, 2024 13:57
bbox_tensorrt_engine
import os
from collections import namedtuple
from pathlib import Path
from typing import List, Optional, Tuple, Union
import argparse
from pathlib import Path
from numpy import ndarray
from torch import Tensor
import numpy as np
import random
@bresilla
bresilla / create_cloud_xyzrgb.py
Created December 11, 2023 19:27 — forked from lucasw/create_cloud_xyzrgb.py
Create PointCloud2 with python with rgb
#!/usr/bin/env python
# PointCloud2 color cube
# https://answers.ros.org/question/289576/understanding-the-bytes-in-a-pcl2-message/
import rospy
import struct
from sensor_msgs import point_cloud2
from sensor_msgs.msg import PointCloud2, PointField
from std_msgs.msg import Header
@bresilla
bresilla / geo.py
Created November 19, 2023 18:21 — forked from sbarratt/geo.py
This script provides coordinate transformations between geodetic, ecef and enu in python. Based on https://gist.github.com/govert/1b373696c9a27ff4c72a.
"""
This script provides coordinate transformations from Geodetic -> ECEF, ECEF -> ENU
and Geodetic -> ENU (the composition of the two previous functions). Running the script
by itself runs tests.
based on https://gist.github.com/govert/1b373696c9a27ff4c72a.
"""
import math
a = 6378137
b = 6356752.3142