Could be captured via virtualdub under windows and gives that.
Hello,
how did you capture it with Virtualdub? What parameters have you set in Virtualdub program?
I can connect to my XH09 (X2) 50Hz camera from Python program with frame set as 256x384, as in you case, but it shows black screen (same with Win Camera App and VLC player).
Below is Python code that I use. It works correctly for Infiray TS2+ and T3/T3 Search cameras but shows just black screen for XH09 (X2) camera.
Please help,
Thank you
# ----------------------------------------------------------------------------------------
import numpy as np
import cv2 # need to install OPENCV package in console: pip install open_python
import time
# Activate USB capture (Cam# = 0, if just one camera is connected)
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_CONVERT_RGB, 0) # capture raw data, do not convert it to RGB
# Command to camera: use raw mode
cap.set(cv2.CAP_PROP_ZOOM, 0x8004)
# Command to camera: Calibrate (with closed shutter)
#cap.set(cv2.CAP_PROP_ZOOM, 0x8000)
start_time = time.time()
frame_count = 1 # for FPS calc
# Main Loop: acquire, process and display frames from camera
while(True):
ret, frame = cap.read()
#frame = frame.reshape(196, 256, 2) # 0: LSB. 1: MSB T2S+ camera
#frame = frame.reshape(292, 384, 2) # 0: LSB. 1: MSB T3 camera
# Remove the last four extra rows (with camera metadata)
#frame = frame[:-4, ...]
# for X2 camera captured frame is X,Y 256 x 384 with two bytes/pixel in little endian format
frame = frame.reshape(384, 256, 2) # 0: LSB. 1: MSB XH09 (X2) ? 384 Rows, 256 Columns, 2 bytes/pxl (Y, X, bytes)
frame = frame[192:, :, :] # take lower half part of the frame with raw data
# Take data from camera as uint16 and convert it to float32
dt = np.dtype(('<u2', [('x', np.uint8, 2)]))
frame = frame.view(dtype=dt).astype(np.float32)
# Normalize and apply AGC to float array frame (range 0.0 - 1.0)
frame -= frame.min()
frame /= frame.max()
# Convert float array to unsigned integer for display
gray = (frame * 255).astype(np.uint8)
gray = np.clip(gray, 0, 255)
# Display gray image zoomed 2x, no interpolation
#zoomed_image = cv2.resize(gray, None, fx=2, fy=2, interpolation=cv2.INTER_NEAREST)
#cv2.imshow('Gray Frame', zoomed_image)
# Apply Rainbow Color Map
rainbow_colored = cv2.applyColorMap(gray, cv2.COLORMAP_JET)
# Display Color zoomed image x2, no interpolation
zoomed_image = cv2.resize(rainbow_colored, None, fx=2, fy=2, interpolation=cv2.INTER_NEAREST)
cv2.imshow('Rainbow Colored Frame', zoomed_image)
frame_count += 1
# Calculate and display FPS every 30 frames
if frame_count % 30 == 0:
end_time = time.time()
fps = frame_count / (end_time - start_time)
print(f"FPS: {fps:.2f}")
# Reset for the next 30 frames
frame_count = 0
start_time = time.time()
key = cv2.waitKey(1) & 0xFF
if key == ord('q'): # Get out of the loop
break
cap.release()
cv2.destroyAllWindows()
# ----------------------------------------------------------------------------------------