diff --git a/ini/200fps-2456x4pix-cw.ini b/ini/200fps-2456x4pix-cw.ini new file mode 100644 index 0000000..ff7ffea --- /dev/null +++ b/ini/200fps-2456x4pix-cw.ini @@ -0,0 +1,222 @@ +[Versions] +ueye_api_64.dll=4.93.1730 +ueye_usb_64.sys=4.93.1314 +ueye_boot_64.sys=4.93.1314 + + +[Sensor] +Sensor=UI308xCP-C +Sensor bit depth=0 +Sensor source gain=24 +FPN correction mode=0 +Black reference mode=0 +Sensor digital gain=0 + + +[Image size] +Start X=0 +Start Y=0 +Start X absolute=0 +Start Y absolute=0 +Width=2456 +Height=4 +Binning=0 +Subsampling=0 + + +[Scaler] +Mode=0 +Factor=0.000000 + + +[Multi AOI] +Enabled=0 +Mode=0 +x1=0 +x2=0 +x3=0 +x4=0 +y1=0 +y2=0 +y3=0 +y4=0 + + +[Shutter] +Mode=0 +Linescan number=0 + + +[Log Mode] +Mode=3 +Manual value=0 +Manual gain=0 + + +[Timing] +Pixelclock=237 +Extended pixelclock range=0 +Framerate=200.151466 +Exposure=4.903189 +Long exposure=0 +Dual exposure ratio=0 + + +[Selected Converter] +IS_SET_CM_RGB32=2 +IS_SET_CM_RGB24=2 +IS_SET_CM_RGB16=2 +IS_SET_CM_RGB15=2 +IS_SET_CM_Y8=2 +IS_SET_CM_RGB8=2 +IS_SET_CM_BAYER=8 +IS_SET_CM_UYVY=2 +IS_SET_CM_UYVY_MONO=2 +IS_SET_CM_UYVY_BAYER=2 +IS_CM_CBYCRY_PACKED=0 +IS_SET_CM_RGBY=8 +IS_SET_CM_RGB30=2 +IS_SET_CM_Y12=2 +IS_SET_CM_BAYER12=8 +IS_SET_CM_Y16=2 +IS_SET_CM_BAYER16=8 +IS_CM_BGR12_UNPACKED=2 +IS_CM_BGRA12_UNPACKED=2 +IS_CM_JPEG=0 +IS_CM_SENSOR_RAW10=8 +IS_CM_MONO10=2 +IS_CM_BGR10_UNPACKED=2 +IS_CM_RGBA8_PACKED=2 +IS_CM_RGB8_PACKED=2 +IS_CM_RGBY8_PACKED=8 +IS_CM_RGB10V2_PACKED=8 +IS_CM_RGB12_UNPACKED=2 +IS_CM_RGBA12_UNPACKED=2 +IS_CM_RGB10_UNPACKED=2 +IS_CM_RGB8_PLANAR=2 + + +[Parameters] +Colormode=1 +Gamma=1.000000 +Hardware Gamma=0 +Blacklevel Mode=0 +Blacklevel Offset=4 +Hotpixel Mode=2 +Hotpixel Threshold=0 +Sensor Hotpixel=0 +Adaptive hotpixel correction enable=0 +Adaptive hotpixel correction mode=0 +Adaptive hotpixel correction sensitivity=3 +GlobalShutter=0 +AllowRawWithLut=0 + + +[Gain] +Master=0 +Red=19 +Green=0 +Blue=33 +GainBoost=1 + + +[Processing] +EdgeEnhancementFactor=0 +RopEffect=0 +Whitebalance=0 +Whitebalance Red=1.000000 +Whitebalance Green=1.000000 +Whitebalance Blue=1.000000 +Color correction=4 +Color_correction_factor=1.000000 +Color_correction_satU=100 +Color_correction_satV=100 +Bayer Conversion=1 +JpegCompression=0 +NoiseMode=0 +ImageEffect=0 +LscModel=0 +WideDynamicRange=0 + + +[Auto features] +Auto Framerate control=0 +Brightness exposure control=0 +Brightness gain control=0 +Auto Framerate Sensor control=0 +Brightness exposure Sensor control=0 +Brightness gain Sensor control=0 +Brightness exposure Sensor control photometry=0 +Brightness gain Sensor control photometry=0 +Brightness control once=0 +Brightness reference=128 +Brightness speed=50 +Brightness max gain=100 +Brightness max exposure=4.903189 +Brightness Aoi Left=0 +Brightness Aoi Top=0 +Brightness Aoi Width=2456 +Brightness Aoi Height=4 +Brightness Hysteresis=2 +AutoImageControlMode=2 +AutoImageControlPeakWhiteChannel=0 +AutoImageControlExposureMinimum=0.000000 +AutoImageControlPeakWhiteChannelMode=0 +AutoImageControlPeakWhiteGranularity=0 +Auto WB control=0 +Auto WB type=2 +Auto WB RGB color model=1 +Auto WB RGB color temperature=5000 +Auto WB offsetR=0 +Auto WB offsetB=0 +Auto WB gainMin=0 +Auto WB gainMax=100 +Auto WB speed=50 +Auto WB Aoi Left=0 +Auto WB Aoi Top=0 +Auto WB Aoi Width=2456 +Auto WB Aoi Height=4 +Auto WB Once=0 +Auto WB Hysteresis=2 +Brightness Skip Frames Trigger Mode=4 +Brightness Skip Frames Freerun Mode=4 +Auto WB Skip Frames Trigger Mode=4 +Auto WB Skip Frames Freerun Mode=4 + + +[Trigger and Flash] +Trigger mode=0 +Trigger timeout=200 +Trigger delay=0 +Trigger debounce mode=0 +Trigger debounce delay time=1 +Trigger burst size=1 +Trigger prescaler frame=1 +Trigger prescaler line=1 +Trigger input=1 +Flash strobe=0 +Flash delay=0 +Flash duration=0 +Flash auto freerun=0 +PWM mode=0 +PWM frequency=20000000 +PWM dutycycle=20000000 +GPIO state=3 +GPIO direction=0 +GPIO1 Config=1 +GPIO2 Config=1 + + +[Vertical AOI Merge Mode] +Mode=0 +Position=0 +Additional Position=0 +Height=2 + + +[Level Controlled Trigger Mode] +Mode=0 + + +[Memory] +Camera memory mode=1 diff --git a/scripts/recv_raw_rolling.py b/scripts/recv_raw_rolling.py new file mode 100644 index 0000000..4efe972 --- /dev/null +++ b/scripts/recv_raw_rolling.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +# /// script +# requires-python = "<=3.10" +# dependencies = [ +# "opencv-python", +# "numpy", +# ] +# /// + +import socket +import numpy as np +import cv2 + +# Debug flag - set to True to see frame reception details +DEBUG = False + +# Rotation mode - set to rotate incoming data before display +# Options: None, cv2.ROTATE_90_CLOCKWISE, cv2.ROTATE_90_COUNTERCLOCKWISE, cv2.ROTATE_180 +ROTATION = cv2.ROTATE_90_COUNTERCLOCKWISE # Rotate rows to columns + +# Stream parameters (match your GStreamer sender) +COLUMN_WIDTH = 4 # Width from 200fps-2456x4pix-cw.ini +COLUMN_HEIGHT = 2456 # Height from 200fps-2456x4pix-cw.ini +CHANNELS = 3 +FRAME_SIZE = COLUMN_WIDTH * COLUMN_HEIGHT * CHANNELS # bytes (29472) + +# Display parameters +DISPLAY_WIDTH = 800 # Width of rolling display in pixels +DISPLAY_HEIGHT = COLUMN_HEIGHT + +UDP_IP = "0.0.0.0" +UDP_PORT = 5000 + +sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) +sock.bind((UDP_IP, UDP_PORT)) + +print(f"Receiving raw {COLUMN_WIDTH}x{COLUMN_HEIGHT} RGB columns on UDP port {UDP_PORT}") +print(f"Display width: {DISPLAY_WIDTH} pixels (rolling)") +if DEBUG: + print(f"Expected frame size: {FRAME_SIZE} bytes") + +cv2.namedWindow("Rolling Column Stream", cv2.WINDOW_NORMAL) + +# Initialize the rolling buffer +rolling_buffer = np.zeros((DISPLAY_HEIGHT, DISPLAY_WIDTH, CHANNELS), dtype=np.uint8) +current_column = 0 +frame_count = 0 + +while True: + data, addr = sock.recvfrom(65536) + + if len(data) != FRAME_SIZE: + if DEBUG: + print(f"Received {len(data)} bytes (expected {FRAME_SIZE}), skipping...") + continue + + if DEBUG: + frame_count += 1 + if frame_count % 30 == 0: + print(f"Received {frame_count} frames, current column: {current_column}") + + # Parse the incoming data + frame = np.frombuffer(data, dtype=np.uint8).reshape((COLUMN_WIDTH, COLUMN_HEIGHT, CHANNELS)) + + # Apply rotation if configured + if ROTATION is not None: + column = cv2.rotate(frame, ROTATION) + else: + column = frame + + # Insert the column into the rolling buffer at the current position + rolling_buffer[:, current_column:current_column+COLUMN_WIDTH, :] = column + + # Move to the next column position, wrapping around when reaching the end + current_column = (current_column + COLUMN_WIDTH) % DISPLAY_WIDTH + + # Display the rolling buffer + cv2.imshow("Rolling Column Stream", rolling_buffer) + + if cv2.waitKey(1) == 27: # ESC to quit + break + +cv2.destroyAllWindows() \ No newline at end of file