From: Aydin T. Z. <tar...@gm...> - 2014-09-03 13:31:16
|
Thanks Adam, OpenCV uses an integer for choosing the camera to be used instead of the device nodes. 0 is the first camera detected in the system and it increases according to the cameras connected to your system. First the pipes are set as it's shown in the wiki: #Set the pipes media-ctl -r -l '"mt9v032 3-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":2->"OMAP3 ISP preview":0[1], "OMAP3 ISP preview":1->"OMAP3 ISP resizer":0[1], "OMAP3 ISP resizer":1->"OMAP3 ISP resizer output":0[1]' #Set the formats media-ctl -V '"mt9v032 3-005c":0[SGRBG10 752x480], "OMAP3 ISP CCDC":2[SGRBG10 752x480], "OMAP3 ISP preview":1[UYVY 752x480], "OMAP3 ISP resizer":1[UYVY 752x480]' Then I used the following code to check if it accesses the Caspa camera: #include "opencv2/opencv.hpp" /** * Get the number of camera available */ int main(int, char**) { cv::VideoCapture temp_camera; int maxTested = 10; for (int i = 0; i < maxTested; i++){ cv::VideoCapture temp_camera(i); bool res = (!temp_camera.isOpened()); temp_camera.release(); if (res) { return i; } } return maxTested; } The output is like this: ./test HIGHGUI ERROR: V4L2: device /dev/video0 is unable to capture video memory. Unable to stop the stream.: Bad file descriptor HIGHGUI ERROR: V4L/V4L2: VIDIOC_CROPCAP HIGHGUI ERROR: V4L/V4L2: VIDIOC_CROPCAP HIGHGUI ERROR: V4L2: device /dev/video3 is unable to capture video memory. Unable to stop the stream.: Bad file descriptor HIGHGUI ERROR: V4L/V4L2: VIDIOC_CROPCAP HIGHGUI ERROR: V4L2: device /dev/video5 is unable to capture video memory. Unable to stop the stream.: Bad file descriptor HIGHGUI ERROR: V4L/V4L2: VIDIOC_CROPCAP HIGHGUI ERROR: V4L: index 7 is not correct! I couldn't make OpenCV work with Caspa Camera using the standard OpenCV methods. The code below which is quite simple returns the following error. #include "opencv2/opencv.hpp" using namespace cv; int main(int, char**) { VideoCapture cap(0); // open the default camera if(!cap.isOpened()) // check if we succeeded return -1; for(;;) { Mat frame; cap >> frame; // get a new frame from camera // do any processing imwrite("image.jpg", frame); if(waitKey(30) >= 0) break; // you can increase delay to 2 seconds here } // the camera will be deinitialized automatically in VideoCapture destructor return 0; } When the camera is set 0 as above the output is like this: ./test HIGHGUI ERROR: V4L2: device /dev/video0 is unable to capture video memory. VIDIOC_STREAMON: Bad file descriptor VIDIOC_STREAMON: Inappropriate ioctl for device VIDIOC_STREAMON: Inappropriate ioctl for device VIDIOC_STREAMON: Inappropriate ioctl for device VIDIOC_STREAMON: Inappropriate ioctl for device VIDIOC_STREAMON: Inappropriate ioctl for device . . . . When it's set to a non-zero value output is like this: ./test HIGHGUI ERROR: V4L/V4L2: VIDIOC_CROPCAP VIDIOC_STREAMON: Invalid argument VIDIOC_QBUF: Invalid argument VIDIOC_QBUF: Invalid argument VIDIOC_QBUF: Invalid argument VIDIOC_QBUF: Invalid argument VIDIOC_QBUF: Invalid argument VIDIOC_QBUF: Invalid argument VIDIOC_QBUF: Invalid argument . . . . Do you have any idea how to make it work with OpenCV? I'll really appreciate it. Thanks, Tarik ___________________________________ Aydın Tarık Zengin, Ph.D. On Thu, Aug 28, 2014 at 2:54 AM, adam <ad...@gu...> wrote: > I never tried OpenCV with Caspa, but are you sure you got the right video > device? Perhaps /dev/video6 works better [1]? > > [1] > https://github.com/gumstix/Gumstix-YoctoProject-Repo/wiki/Gstreamer-and-Caspa > > > On Fri, Aug 22, 2014 at 3:58 PM, Aydin Tarik Zengin [via Gumstix] <[hidden > email] <http://user/SendEmail.jtp?type=node&node=4969440&i=0>> wrote: > >> Hi, >> >> Gumstix Caspa camera (mt9v032) works well with the stock Gumstix yocto >> image using the mediactl commands. >> >> However, when I want to get an image with OpenCV, it seems the /dev/video >> device won't be accepted. >> Yocto uses 3.5.7 kernel by default right now. >> Do I need to do some fine tuning to make the Caspa camera work with >> OpenCV? >> >> Tarik >> ___________________________________ >> >> Aydın Tarık Zengin, Ph.D. >> >> >> ------------------------------------------------------------------------------ >> >> Slashdot TV. >> Video for Nerds. Stuff that matters. >> http://tv.slashdot.org/ >> _______________________________________________ >> gumstix-users mailing list >> [hidden email] <http://user/SendEmail.jtp?type=node&node=4969437&i=0> >> https://lists.sourceforge.net/lists/listinfo/gumstix-users >> >> >> ------------------------------ >> If you reply to this email, your message will be added to the >> discussion below: >> >> http://gumstix.8.x6.nabble.com/Gumstix-Caspa-with-Yocto-and-OpenCV-tp4969437.html >> To start a new topic under Gumstix, email [hidden email] >> <http://user/SendEmail.jtp?type=node&node=4969440&i=1> >> To unsubscribe from Gumstix, click here. >> NAML >> <http://gumstix.8.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >> > > > ------------------------------ > View this message in context: Re: Gumstix Caspa with Yocto and OpenCV > <http://gumstix.8.x6.nabble.com/Gumstix-Caspa-with-Yocto-and-OpenCV-tp4969437p4969440.html> > Sent from the Gumstix mailing list archive > <http://gumstix.8.x6.nabble.com/> at Nabble.com. > > > ------------------------------------------------------------------------------ > Slashdot TV. > Video for Nerds. Stuff that matters. > http://tv.slashdot.org/ > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users > > |