First of all also a happy new year and all the best for 2022.
Thanks for your reply.
The reduced search value did help and now appears to pick up my FLIR . - Thanks
But unfortunately still have the screen size problem. I had already previously attempted to use my camera specific values, but no luck.
I've noticed Zhao made some remarks about that ( "I have the same issue. A simple reshape worked for me. See my previous post with code."-- Reply #35 on: September 21, 2020, 12:36:07)
and appears he'd managed to fix his problem but unfortunately don't have enough knowledge to work out how I can apply his fix / code to solve my problem.
His code:
import numpy as np
import cv2
cap = cv2.VideoCapture(1)
cap.set(cv2.CAP_PROP_CONVERT_RGB, 0)
# Use raw mode
cap.set(cv2.CAP_PROP_ZOOM, 0x8004)
# Calibrate
#cap.set(cv2.CAP_PROP_ZOOM, 0x8000)
while(True):
ret, frame = cap.read()
frame = frame.reshape(292,384,2) # 0: LSB. 1: MSB
# Remove the four extra rows
frame = frame[:288,...]
# Convert to uint16
dt = np.dtype(('<u2', [('x', np.uint8, 2)]))
frame = frame.view(dtype=dt).astype(np.float32)
# Sketchy auto-exposure
frame -= frame.min()
frame /= frame.max()
gray = np.clip(frame, 0, 1) ** (1/2.2)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
The odd thing I've noticed is the doubled value in regards to frame size I get in the messages when executing opencv.py. The first reference ( 100352) is exactly double than the second reference in the last line ( 50176)
Let's start ...
isHt301 is True
device is valid
FPS = 25.0
fourcc = 1448695129
width: 256 height: 196
initial status of CAP_PROP_CONVERT_RGB = 1.0
set device property CAP_PROP_CONVERT_RGB ...
after the setting of CAP_PROP_CONVERT_RGB we have : 0.0
set device property CAP_PROP_ZOOM to 0x8004
(process:9563): Gtk-WARNING **: 01:17:04.698: Locale not supported by C library.
Using the fallback 'C' locale.
frame.size = 100352
Traceback (most recent call last):
File "/home/karl/Public/FLIR-Test Software/Version4/opencv.py", line 15, in <module>
ret, frame = cap.read()
File "/home/karl/Public/FLIR-Test Software/Version4/ht301_hacklib.py", line 353, in read
ret, frame_raw, frame, meta = self.read_()
File "/home/karl/Public/FLIR-Test Software/Version4/ht301_hacklib.py", line 335, in read_
frame = frame.reshape(self.FRAME_HEIGHT, self.FRAME_WIDTH)
ValueError: cannot reshape array of size 50176 into shape (192,256)
--> Update:
Just solved it,.....only to an extend
The catch with the resolution is those extra 4 lines containing the data. So in order to have correct resolution set it is necessary to add 4 lines.
In my case 256x192 didn't work as script expected to see 50176 pixels. But 256x196 does result in that value.
But as it happens this is of little joy to me as it now repeatedly carries out the script yet now actual video footage.