Open
Description
Am creating a dap package and installing it to OAK-D Pro W PoE using device manager.
Am getting the video feed on link, but the IR led does not switch on.
Tested it on dark room environment.
Checked IR led on phone cam nut no glow.
Following is the code.
#!/usr/bin/env python3
import depthai as dai
import time
pipeline = dai.Pipeline()
monoRight = pipeline.create(dai.node.MonoCamera)
monoRight.setCamera("right")
monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_720_P)
monoRight.setFps(120)
jpeg = pipeline.create(dai.node.VideoEncoder)
jpeg.setDefaultProfilePreset(monoRight.getFps(), dai.VideoEncoderProperties.Profile.MJPEG)
jpeg.setQuality(100)
monoRight.out.link(jpeg.input)
script = pipeline.create(dai.node.Script)
script.setProcessor(dai.ProcessorType.LEON_CSS)
script.setScript("""
import time
import socket
import fcntl
import struct
from socketserver import ThreadingMixIn
from http.server import BaseHTTPRequestHandler, HTTPServer
Device.setIrFloodLightIntensity(1)
PORT = 80
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(
s.fileno(),
-1071617759, # SIOCGIFADDR
struct.pack('256s', ifname[:15].encode())
)[20:24])
class ThreadingSimpleServer(ThreadingMixIn, HTTPServer):
pass
class HTTPHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
self.send_response(200)
self.end_headers()
self.wfile.write(b'<h1 style="text-align: center;">OAK TEST</h1><p style="text-align: center;">TEST</p><p style="text-align: center;">Click <a href="img">here</a> for Stream</p>')
elif self.path == '/img':
try:
self.send_response(200)
self.send_header('Content-type', 'multipart/x-mixed-replace; boundary=--jpgboundary')
self.end_headers()
fpsCounter = 0
timeCounter = time.time()
while True:
jpegImage = node.io['jpeg'].get()
self.wfile.write("--jpgboundary".encode())
self.wfile.write(bytes([13, 10]))
self.send_header('Content-type', 'image/jpeg')
self.send_header('Content-length', str(len(jpegImage.getData())))
self.end_headers()
self.wfile.write(jpegImage.getData())
self.end_headers()
fpsCounter = fpsCounter + 1
if time.time() - timeCounter > 1:
node.warn(f'FPS: {fpsCounter}')
fpsCounter = 0
timeCounter = time.time()
except Exception as ex:
node.warn(str(ex))
with ThreadingSimpleServer(("", PORT), HTTPHandler) as httpd:
node.warn(f"Serving at {get_ip_address('re0')}:{PORT}")
httpd.serve_forever()
""")
jpeg.bitstream.link(script.inputs['jpeg'])
(f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
bootloader = dai.DeviceBootloader(bl)
bootloader.saveDepthaiApplicationPackage(pipeline=pipeline, path="D:/mono_ir_led.dap")
Metadata
Metadata
Assignees
Labels
No labels