Ask Your Question
0

Cannot set properties (frame_width, _height, ...) for Ximea camera (OpenCV 2.4.10 compiled with WITH_XIMEA flag)

asked 2015-01-21 01:57:01 -0500

Aotearoa gravatar image

Without any problems I can access my internal camera webcam and also change the resolution. So displaying the frame with default resolution and with a predefined resolution (e.g., from 640x480 to 320x240, with cap.set(CV_CAP_PROP_FRAME_WIDTH,320), and FRAME_HEIGHT, 240)) – both work fine.

Using the same code with slight adaption so that it works with a Ximea camera (VideoCapture cap(CV_CAP_XIAPI)), does work for the default resolution. It is a MU9PC_MH with a default resolution of 2592x1944. It does not work for another than the default resolution, e.g., 648 x486 (referring to Ximea specifications it is supported by the camera).

As I had already asked that question in Stackoverflow, I tried the proposed solution of resizing the frame after receiving, but comparing with the result I get with the ximea api, the opencv result seems worse. I know that I have to set properties to my requirements, as it is a industrial camera, but I would rather prefer doing it via OpenCV.

Does anyone have any suggestions? Thanks for reading :)

edit retag flag offensive close merge delete

Comments

Hmm looking at the sourcecode of the ximea interface you should be able to set that parameter. Can you run a debug session and see if it reaches that function? Especially check the value of mvret. Did you build OpenCV with Ximea support, which is not in by default?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-21 04:25:41 -0500 )edit

Thank you for your quick reply. It's not that I do not get any frame. The frames are shown, e.g., four times as smallthumbnails in a big window with the default size of the ximea camera. Maybe I'm doing something wrong, but I cannot find the mvret in my debug. Yes, I build opencv with ximea - if I haven't I would not be able to access the ximea camera with CV_CAP_XIAPI

Aotearoa gravatar imageAotearoa ( 2015-01-21 13:25:27 -0500 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2015-01-25 03:10:11 -0500

Aotearoa gravatar image

I've found the solution myself: There's a mistake in the resetCvImage() method of the cap_ximea.cpp. line 207 if( (int)image.width != width || (int)image.height != height || image.frm != (XI_IMG_FORMAT)format)

has to be: if( (int)image.width != frame->width || (int)image.height != frame->height || image.frm != (XI_IMG_FORMAT)format)

edit flag offensive delete link more

Comments

Can you supply this fix through an official PR?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-25 13:49:48 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2015-01-21 01:57:01 -0500

Seen: 432 times

Last updated: Jan 25 '15