Skip to content

Instantly share code, notes, and snippets.

View Erol444's full-sized avatar
🌴

Erol444 Erol444

🌴
View GitHub Profile
@Erol444
Erol444 / video_enc_12mp_h26x.py
Created December 17, 2024 11:18
DepthAI OAK video encoding 12Mp with H264/H265
#!/usr/bin/env python3
import depthai as dai
# Create pipeline
pipeline = dai.Pipeline()
# Define sources and output
camRgb = pipeline.create(dai.node.ColorCamera)
videoEnc = pipeline.create(dai.node.VideoEncoder)
@Erol444
Erol444 / oak-d-pro-poe-strobe.py
Last active November 2, 2024 12:44
Strobe demo with OAK-D-Pro-PoE
#!/usr/bin/env python3
from datetime import timedelta
import cv2
import depthai as dai
# Create pipeline
pipeline = dai.Pipeline()
FPS = 30
@Erol444
Erol444 / demo_tools.py
Created August 8, 2024 15:31
NDVI Drone with SAM2 segmentation
import json
import colorsys
import cv2
import numpy as np
def sam_results(file):
with open(file, 'r') as file:
lines = file.readlines()
data = []
for line in lines:
@Erol444
Erol444 / tractor-visualization-rerun.py
Created June 13, 2024 14:52
OAK-D Long Range Tractor pointcloud visualization with native Rerun (non-colorized pointclouds?)
from depthai_sdk import OakCamera
import cv2
import depthai as dai
import rerun as rr
# Run & initialize ReRun viewer
rr.init('Rerun Oak-D-LR', spawn=True)
# Download and run the tractor recording
with OakCamera(replay="tractor-oak-d-lr") as oak:
@Erol444
Erol444 / openai_parse_pdf_output_json.py
Created June 13, 2024 09:09
openai_parse_pdf_output_json.py
from openai import OpenAI
from openai.types.beta.threads.message_create_params import Attachment, AttachmentToolFileSearch
import os
from dotenv import load_dotenv
load_dotenv()
import json
# Add your OpenAI API key
client = OpenAI(api_key=os.getenv("OPENAI_KEY"))
@Erol444
Erol444 / ndvi.py
Created June 7, 2024 12:08
NDVI camera - switchable IR filter with Luxonis' OAK-FFC-4P and Arducam's IMX477
#!/usr/bin/env python3
import depthai as dai
import cv2
pipeline = dai.Pipeline()
camA = pipeline.createColorCamera()
camA.setBoardSocket(dai.CameraBoardSocket.CAM_A)
camA.setResolution(dai.ColorCameraProperties.SensorResolution.THE_12_MP)
@Erol444
Erol444 / 32mp_cam_control.py
Created June 1, 2024 10:32
OAK-1-MAX 32MP still and video stream
#!/usr/bin/env python3
import depthai as dai
import cv2
pipeline = dai.Pipeline()
# Define a source - color camera
cam = pipeline.create(dai.node.ColorCamera)
cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_5312X6000) # 32MP for still images
@Erol444
Erol444 / oak-reconnect.py
Created February 26, 2024 17:55
DepthAI auto-reconnect
#!/usr/bin/env python3
import cv2
import depthai as dai
import numpy as np
import time
import blobconverter
# MobilenetSSD label texts
@Erol444
Erol444 / depthai_pause_continue_streaming.py
Created October 2, 2023 17:45
DepthAI OAK stop/start video streaming from ColorCamera node
#!/usr/bin/env python3
import depthai as dai
import cv2
# Create pipeline
pipeline = dai.Pipeline()
# Define sources and outputs
camRgb = pipeline.create(dai.node.ColorCamera)
@Erol444
Erol444 / lens_position_during_calib.py
Created September 6, 2023 12:14
DepthAI read lens position at calibration for all camera sensors
import depthai as dai
# Connect Device
with dai.Device() as device:
calibData = device.readCalibration()
for cam in device.getConnectedCameraFeatures():
print(f'{cam.name} lens position during calibration: {calibData.getLensPosition(cam.socket)}')