Skip to content

Instantly share code, notes, and snippets.

View Erol444's full-sized avatar
🌴

Erol444 Erol444

🌴
View GitHub Profile
@Erol444
Erol444 / rgb-depth-align-alpha1.py
Created July 4, 2023 14:09
oak-d-w-97 alpha=1 align rgb with depth frame
#!/usr/bin/env python3
import cv2
import numpy as np
import depthai as dai
# Weights to use when blending depth/rgb image (should equal 1.0)
rgbWeight = 0.4
depthWeight = 0.6
@Erol444
Erol444 / wide-fov-depth-alignment.py
Created June 23, 2023 12:24
DepthAI Wide FOV depth align to color stream
import cv2
import numpy as np
import depthai as dai
# Weights to use when blending depth/rgb image (should equal 1.0)
rgbWeight = 0.4
depthWeight = 0.6
msgs = dict()
@Erol444
Erol444 / generate_random_colors.py
Created May 14, 2023 18:35
Comparing distinctipy method vs new method. Distinctipy need more than 2 sec to generate 64 colors.
import numpy as np
import colorsys
import cv2
import math
import time
def generate_colors(number_of_colors, pastel=0.5):
colors = []
@Erol444
Erol444 / get_fov.py
Last active October 19, 2024 07:48
DepthAI OAK get rectified and full sensor FOV
#!/usr/bin/env python3
import depthai as dai
import numpy as np
import sys
from pathlib import Path
import math
import cv2
np.set_printoptions(suppress=True)
@Erol444
Erol444 / depthai_blend_3cam_frames.py
Created March 1, 2023 11:27
Blend 3 camera frames together
#!/usr/bin/env python3
import cv2
import numpy as np
import depthai as dai
# Optional. If set (True), the ColorCamera is downscaled from 1080p to 720p.
# Otherwise (False), the aligned depth is automatically upscaled to 1080p
downscaleColor = True
@Erol444
Erol444 / oak_deptahi_external_trigger_fsync.py
Created February 27, 2023 15:00
[DepthAI] Externally trigger FSYNC on OAK cameras
#!/usr/bin/env python3
import depthai as dai
import cv2
import time
pipeline = dai.Pipeline()
camRgb = pipeline.create(dai.node.ColorCamera)
camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)
camRgb.setIspScale(2,3)
@Erol444
Erol444 / rgb-depth-align-12mp-depth.py
Last active May 7, 2023 20:04
DepthAI OAK Luxonis - RGB depth alignment with 12MP color stream
#!/usr/bin/env python3
import cv2
import numpy as np
import depthai as dai
# Weights to use when blending depth/rgb image (should equal 1.0)
rgbWeight = 0.4
depthWeight = 0.6
@Erol444
Erol444 / oak_deptahi_script_trigger_fsync.py
Created November 21, 2022 10:34
Luxonis OAK camera trigger FSYNC pin via Script node for DM9098 board (OAK-D S2/Pro/W/Pro W)
#!/usr/bin/env python3
import depthai as dai
import cv2
import time
 
pipeline = dai.Pipeline()
 
camRgb = pipeline.create(dai.node.ColorCamera)
camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)
camRgb.setIspScale(2,3)
@Erol444
Erol444 / colorcam_still_capture.py
Created November 12, 2022 03:22
DepthAI OAK ColorCamera still capture
#!/usr/bin/env python3
import depthai as dai
import cv2
import time
pipeline = dai.Pipeline()
# Define sources and outputs
camRgb = pipeline.create(dai.node.ColorCamera)
@Erol444
Erol444 / rgb-undistortion-depth-alignment.py
Last active October 23, 2023 21:20
With latest depthai, you should just use Camera node, which does undistortion by itself. Demo here: https://github.com/luxonis/depthai-python/blob/main/examples/StereoDepth/rgb_depth_aligned.py
"""
With latest depthai, you should just use Camera node, which does undistortion by itself.
Demo here: https://github.com/luxonis/depthai-python/blob/main/examples/StereoDepth/rgb_depth_aligned.py
"""
#!/usr/bin/env python3
import cv2
import numpy as np
import depthai as dai