Ask Your Question
0

OpenCV 4.2 captures empty frame from TC358743 on RPi 3B+

asked 2020-03-20 06:04:05 -0600

DanR gravatar image

Hi All,

I've compiled OpenCV 4.2 on an RPi 3B+ and the samples seem to compile and work too, that is except ones that use video io. I have a TC358743 chipset on the MIPI CSI bus and it works fine with v4l2 and mmal capturing. I need to use OpenCV though and whenever I try the videocapture_basic.cpp and videocapture_camera.cpp samples they only return with "ERROR: Can't grab camera frame." or "ERROR: blank frame grabbed". What is going on here? The TC358743 v4l2 driver is loaded and works, I can see the caps of the device and dmesg returns the correct video resolution. In fact videocapture_camera.cpp returns the correct resolution after opening the device and then fails.

Any help would be hugely appreciated!!

Kind Regards, Dan

edit retag flag offensive close merge delete

Comments

Here is link: TC358743

supra56 gravatar imagesupra56 ( 2020-03-20 06:29:26 -0600 )edit

Here is source code: Code And Driver

supra56 gravatar imagesupra56 ( 2020-03-20 06:30:30 -0600 )edit

You must enabled picamera and use command raspivid -t 0

supra56 gravatar imagesupra56 ( 2020-03-20 06:48:25 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2020-03-23 04:11:06 -0600

DanR gravatar image

updated 2020-03-23 04:11:49 -0600

NOT AN ANSWER, The forum produced a message saying forbidden content hence why it's here as an answer!

Hi Supra,

I've already done that and the driver loads fine, like I say 6by9's v4l2_mmal demo works correctly but the "videocapture_basic.cpp" sample in OpenCV does not. This is what I get from running "raspivid -t 0":

mmal: Cannot read camera info, keeping the defaults for OV5647 mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM) mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1) mmal: Failed to create camera component mmal: main: Failed to create camera component mmal: Camera is not detected. Please check carefully the camera module is installed correctly

This is what I get when I run the videocapture_basic.cpp compile application:

Start grabbing Press any key to terminate ERROR! blank frame grabbed

So it seems that the videocapture_basic application isn't working with the TC358743 chipset despite the v4l2 driver being loaded and configured ie set the EDID and Index of 11 which matches my video source. Anything else someone can help with would be ever so much appreciated!!

Kind Regards,

Dan

edit flag offensive delete link more

Comments

I'm off for 9 months. I do not have it with me. We used to get from forums. I used python and the other used cpp.

supra56 gravatar imagesupra56 ( 2020-03-23 07:47:37 -0600 )edit

Ok, I found an example which I've implemented but it was written for a previous version of the library. So now I get an exception when imdecode is called as follows:

terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.2.0) /home/pi/opencv/modules/imgcodecs/src/loadsave.cpp:732: error: (-215:Assertion failed) buf.checkVector(1, CV_8U) > 0 in function 'imdecode_'

Any idea of how I can overcome this?? The image being passed in is either a raw BGR format or YUV420 from the MIPI bus if that helps??

DanR gravatar imageDanR ( 2020-03-25 04:52:31 -0600 )edit

Hi Supra, Are you saying you used the driver which isn't the dtoverlay, so the one built when you select it in the kernel config and then build the kernel? TIA ;)

DanR gravatar imageDanR ( 2020-04-02 04:07:37 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-20 06:04:05 -0600

Seen: 723 times

Last updated: Mar 23 '20