LordLadybug / LaserTracker

Laser tracking program that moves camera to keep laser pointer in focus; crude visual encoder for making measurements along a ruler.
GNU General Public License v3.0
0 stars 0 forks source link

Multiple failures on trying to stream empty video frames #2

Closed LordLadybug closed 3 years ago

LordLadybug commented 3 years ago

Assertion fails on converting video frames to HSV scale when given empty video frames; camera does not shut down properly when program ends due to this failure. For the same reason, the ring buffer used to stream video to OpenCV also will not die when this assertion fails.

LordLadybug commented 3 years ago

DotFinder now no longer attempts to convert an empty frame but will still throw an error in doing the conversion, complaining about the number of channels in the BGR image (which should be three, which would then be converted into an HSV image also with three channels?) and failing to convert the BGR image into an HSV image using the cv.COLOR_BGR2HSV color mapping.

Full error is here:`

File "/home/pi/Programs/LaserTracker/DotFinder.py", line 18, in IsolateRedDot hsv = cv.cvtColor(frame, cv.COLOR_BGR2HSV) cv2.error: OpenCV(4.1.0) /home/pi/opencv-python/opencv/modules/imgproc/src/color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function 'cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<3, 4>; VDcn = cv::impl::{anonymous}::Set<3>; VDepth = cv::impl::{anonymous}::Set<0, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = (cv::impl::::SizePolicy)2u; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]'

Invalid number of channels in input image: 'VScn::contains(scn)' where 'scn' is 1 `

LordLadybug commented 3 years ago

Closed due to issue being fixed. Issue was with two lines in GrabFrame() in CameraCVInterface where the function was not returning the properly-reshaped image and instead was returning a 1-dimensional form of the image :(