OPENCV and oCAM USB 3.0 Camera

Moderators: mdrjr, odroid

OPENCV and oCAM USB 3.0 Camera

Unread postby wiweet » Sat Jan 16, 2016 9:52 pm

Dear All,

Anybody know how the get the best of USB 3.0 interface on opencv with the Ocam camera on Odroid XU4 robotic image?

Is there any benchmark/comparison against the popular logitech C-920 that use USb 2.0 interface?

Regards,

wiweet
wiweet
 
Posts: 18
Joined: Mon Dec 23, 2013 5:44 am
languages_spoken: english
ODROIDs: odroid-xu

Re: OPENCV and oCAM USB 3.0 Camera

Unread postby odroid » Mon Jan 18, 2016 9:42 am

When we used a 720p USB 2.0 webcan, we could get only 7~9FPS of 1280x720 YUV.
But we can have 30FPS with the USB 3.0 oCAM camera.

Do you have any FPS data with your C920 cam? I think it should have 7~9FPS too.
User avatar
odroid
Site Admin
 
Posts: 24001
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: OPENCV and oCAM USB 3.0 Camera

Unread postby fnoop » Tue Dec 20, 2016 7:04 pm

So I'm just starting to use ocam with opencv and I can't get more than 30fps. It looks like using standard VideoCapture() opencv grabs frames through jpg so you can't increase the fps beyond 30fps. I've tried using gstreamer to grab the higher framerate YUV and then convert format using gstreamer but it doesn't seem to work (it should, theoretically, I think):
cv::VideoCapture cap("v4l2src device=/dev/video4 ! video/x-raw, framerate=120/1, width=640, height=480, format=YUY2 ! autovideoconvert ! appsink");
If this works it could probably be optimised using the MFC or GPU hopefully to do colourspace conversion in hardware.

I'm intrigued to see if the odroid can cope with higher framerate processing, as it would be great for doing things like optical flow.
fnoop
 
Posts: 67
Joined: Thu Apr 28, 2016 6:04 am
languages_spoken: english
ODROIDs: XU4, oCam

Re: OPENCV and oCAM USB 3.0 Camera

Unread postby fnoop » Tue Dec 20, 2016 7:34 pm

Tried this:
```
cv::VideoCapture cap(4);
cap.set(CV_CAP_PROP_MODE, CV_CAP_MODE_YUYV);
cap.set(CV_CAP_PROP_FPS, 60);
```

But I get:
```
VIDEOIO ERROR: V4L2: setting property #9 is not supported
Video device opened @ 30 fps. width=640. height=480
file /dev/mali0 is not of a compatible version (user 10.6, kernel 10.4)
ERROR: The DDK is not compatible with any of the Mali GPUs on the system.
The DDK was built for 0x620 r0p1 status range [0..15], but none of the GPUs matched:
file /dev/mali0 is not of a compatible version (user 10.6, kernel 10.4)
```
fnoop
 
Posts: 67
Joined: Thu Apr 28, 2016 6:04 am
languages_spoken: english
ODROIDs: XU4, oCam

Re: OPENCV and oCAM USB 3.0 Camera

Unread postby odroid » Tue Dec 20, 2016 7:36 pm

Is it related to this topic?
viewtopic.php?f=119&t=24308#p166371
User avatar
odroid
Site Admin
 
Posts: 24001
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: OPENCV and oCAM USB 3.0 Camera

Unread postby WITHROBOT » Wed Dec 21, 2016 1:54 pm

We understand the “cap.set” function of OpenCV does not work perfectly as it should for all kind of cameras.
We have a plan to release our own function in the near future to control various features of oCam cameras to be used with OpenCV.

In the meantime, you can refer the codes as suggested by the Site Admin, “odroid”.
WITHROBOT
 
Posts: 100
Joined: Mon Mar 14, 2016 1:54 pm
languages_spoken: english
ODROIDs: Odroid-C2

Re: OPENCV and oCAM USB 3.0 Camera

Unread postby fnoop » Thu Dec 29, 2016 9:59 pm

The opencv-basic_1MGN looks cool, but even if I change format form GREY to YUYV:
camera.set_format(640,480, Withrobot::fourcc_to_pixformat('Y','U','Y','V'), 1, 60);
I still get a dithered distorted grey image.
I tried changing the Mat to 3chan:
cv::Mat srcImg(cv::Size(camFormat.width, camFormat.height), CV_8UC3);
but this just produces the distorted grey image 3 times :)
fnoop
 
Posts: 67
Joined: Thu Apr 28, 2016 6:04 am
languages_spoken: english
ODROIDs: XU4, oCam

Re: OPENCV and oCAM USB 3.0 Camera

Unread postby minhntu » Fri Jul 21, 2017 5:26 pm

Do you know how to set frame rate on oCam USB 3.0 Camera?
minhntu
 
Posts: 31
Joined: Tue Feb 07, 2017 5:54 pm
languages_spoken: english
ODROIDs: Odroid XU4

Re: OPENCV and oCAM USB 3.0 Camera

Unread postby WITHROBOT » Mon Aug 07, 2017 4:46 pm

The oCam-5CRO-U supports 30, 60, 90 and 120fps at 640 x 480 resolution.

You can use the following V4L code;

* To set the format as 60 fps @ 640 x 480, as an example:
camera.set_format(640,480, Withrobot::fourcc_to_pixformat('Y','U','Y','V'), 1, 60);

* To get and display the image:
cv::Mat srcImg(cv::Size(camFormat.width, camFormat.height), CV_8UC2);
cv::Mat dstImg(cv::Size(camFormat.width, camFormat.height), CV_8UC3);
cv:cvtColor(srcImg, dstImg, CV_YUV2BGR_YUV_2);
WITHROBOT
 
Posts: 100
Joined: Mon Mar 14, 2016 1:54 pm
languages_spoken: english
ODROIDs: Odroid-C2


Return to oCAM USB 3.0 Camera

Who is online

Users browsing this forum: No registered users and 6 guests