Search the web
Sign In
New User? Sign Up
OpenCV · Open Source Computer Vision Library Comm

Group Information

  • Members: 29907
  • Category: Open Source
  • Founded: Jun 20, 2000
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

  Messages Help
Advanced
[highgui] setting capture width and hight   Message List  
Reply Message #28735 of 86349 |
I've been using cvcam for some time but in my case processor load goes
to 100% after a few minutes. This allways happens if the callback
function is too time consuming (lets say above 30% processor load).
Strange. So I switched to highgui and was surprised that there is no
way to adjust the capturing dimensions. Argh!

I just added a way to set the capture width and hight within highgui:

To set format directly, put width and hight in one integer and use
CV_CAP_PROP_FRAME_WIDTH_HEIGHT:

cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH_HEIGHT, 640480 )
or
cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH_HEIGHT, 320280 )
...

Or to use the built in dialogs:
cvSetCaptureProperty(capture, CV_CAP_PROP_DIALOG_COMPRESSION, 0 );
cvSetCaptureProperty(capture, CV_CAP_PROP_DIALOG_SOURCE, 0 );
cvSetCaptureProperty(capture, CV_CAP_PROP_DIALOG_DISPLAY, 0 );
cvSetCaptureProperty(capture, CV_CAP_PROP_DIALOG_FORMAT, 0 );

---------------------------
What you have to do:

Add to highgui.h:

#define CV_CAP_PROP_DIALOG_DISPLAY 8
#define CV_CAP_PROP_DIALOG_FORMAT 9
#define CV_CAP_PROP_DIALOG_SOURCE 10
#define CV_CAP_PROP_DIALOG_COMPRESSION 11
#define CV_CAP_PROP_FRAME_WIDTH_HEIGHT 12

Add the function icvSetPropertyCAM_VFW to cvcap.cpp:

static int icvSetPropertyCAM_VFW( CvCaptureCAM_VFW* capture, int
property_id, double value )
{
int result = -1;
CAPSTATUS capstat;
CAPTUREPARMS capparam;
BITMAPINFO btmp;

switch( property_id ) {
case CV_CAP_PROP_DIALOG_DISPLAY:
result = capDlgVideoDisplay(capture->capWnd);
//SendMessage(capture->capWnd,WM_CAP_DLG_VIDEODISPLAY,0,0);
break;
case CV_CAP_PROP_DIALOG_FORMAT:
result = capDlgVideoFormat(capture->capWnd);
//SendMessage(capture->capWnd,WM_CAP_DLG_VIDEOFORMAT,0,0);
break;
case CV_CAP_PROP_DIALOG_SOURCE:
result = capDlgVideoSource(capture->capWnd);
//SendMessage(capture->capWnd,WM_CAP_DLG_VIDEOSOURCE,0,0);
break;
case CV_CAP_PROP_DIALOG_COMPRESSION:
result = capDlgVideoCompression(capture->capWnd);
break;
case CV_CAP_PROP_FRAME_WIDTH_HEIGHT:
capGetVideoFormat(capture->capWnd, &btmp, sizeof(BITMAPINFO));
btmp.bmiHeader.biWidth = floor(value/1000);
btmp.bmiHeader.biHeight = value-floor(value/1000)*1000;
btmp.bmiHeader.biSizeImage = btmp.bmiHeader.biHeight *
btmp.bmiHeader.biWidth * btmp.bmiHeader.biPlanes *
btmp.bmiHeader.biBitCount / 8;
capSetVideoFormat(capture->capWnd, &btmp, sizeof(BITMAPINFO));
break;
default:
break;
}

return result;
}


and edit captureCAM_VFW_vtable as following:


static CvCaptureVTable captureCAM_VFW_vtable =
{
6,
(CvCaptureCloseFunc)icvCloseCAM_VFW,
(CvCaptureGrabFrameFunc)icvGrabFrameCAM_VFW,
(CvCaptureRetrieveFrameFunc)icvRetrieveFrameCAM_VFW,
(CvCaptureGetPropertyFunc)icvGetPropertyCAM_VFW,
(CvCaptureSetPropertyFunc)icvSetPropertyCAM_VFW, // was NULL
(CvCaptureGetDescriptionFunc)0
};
-----------------------------------

Now rebuilt highgui.dll.





Thu May 19, 2005 9:57 am

lifebelt77
Offline Offline
Send Email Send Email

Message #28735 of 86349 |
Expand Messages Author Sort by Date

I've been using cvcam for some time but in my case processor load goes to 100% after a few minutes. This allways happens if the callback function is too time...
lifebelt77 Offline Send Email May 19, 2005
9:58 am

Thanks .. I was loking for this help .....Can u plz tell me how to set the cvSetCaptureProperty ie cvSetCaptureProperty( capture,CV_CAP_PROP_FPS , 25.0); as it...
muskral Offline Send Email May 19, 2005
5:14 pm

The solution is fantasitc!!! I'v been searching for this for a while. One more request: Can you please write cvSetCaptureProperty for MIL camera since my...
jinzimao Offline Send Email May 19, 2005
7:32 pm

As I don't have a MIL it's hard to figure out how it works in this case. But you could test one thing and tell me the results: Find the function...
lifebelt77 Offline Send Email May 21, 2005
4:55 pm

Well, actually I tried your suggestion before. The problem is that the size parameters(w and h) do not affect the video output. For example: if w is set to 640...
jinzimao Offline Send Email May 23, 2005
1:19 am

In the case of VfW I've read that it is highly device dependend how the parameters are interpreted (if they are interpreted ;). Maybe the DirectDraw interface...
lifebelt77 Offline Send Email May 23, 2005
6:38 am

How can one switch from VfW Capture Driver to directX within OpenCV? Meaning how can i set openCv to use directX, because on my System it always uses VfW....
rsbonze Offline Send Email Oct 28, 2007
6:31 pm

Hi: I had rebuild my highgui by adding this new function. But it creats another problem: One of my previous project works on capture with resolution 160x120. ...
jinzimao Offline Send Email Jun 1, 2005
10:10 pm

You said that it is now always at 640x480. As far as I know Windows remembers the last settings. So just try setting it back to 160x120 with highgui or any of...
lifebelt77 Offline Send Email Jun 2, 2005
6:54 am

Thanks for the help. It solves the problem. Another problem is that I cannot compile the release version of highgui after adding function icvSetPropertyCAM_VFW...
jinzimao Offline Send Email Jun 2, 2005
4:43 pm

Strange. I'm using VC7.1 Do you use the project "opencv_directshow.sln" in the make directory of opencv? Try...
lifebelt77 Offline Send Email Jun 2, 2005
8:17 pm

Thanks for your suggestion and finally I worked out this problem! ... directory of ... seem to ... release mode. ... ...
jinzimao Offline Send Email Jun 3, 2005
2:38 am

Yes I know. I've problems to find a working procedure to set the fps. As we are (in the case of highgui) talking about Video for Windows (VfW) maybe some else...
lifebelt77 Offline Send Email May 21, 2005
4:37 pm

Thank you very much, i apreciate your work that helps me too much , I too have been searching a solution to set the capture size. This solution actually works...
Parera
jpg81cat Offline Send Email
May 19, 2005
11:16 pm

Put the method icvSetPropertyCAM_VFW into cvcap_cfw.cpp instead of cvcap.cpp Cheers...
charlie.kool Offline Send Email Apr 3, 2008
9:35 am

... Hey!! Thanks a lot for the instructions. About the change to be made to cvcap - I think you should specify it as cvcap_vfw.cpp because thats where you find...
sidcester_utd Offline Send Email Dec 29, 2007
6:51 pm

I have done the amendment according to your instructions and rebuilt the highgui library successfully. However I still find that calling the...
Ng Chuen Leong
nchuenleong Offline Send Email
Dec 31, 2007
6:58 am

Thanks a lot Lifebelt! That nearly did it for me except it won't work for resolutions of 1280 * 960. My amendended version of the hack is Add to the start of...
dominic82001 Offline Send Email Jan 22, 2008
2:23 pm

Hi, Im sorry i may be to a sleep still today but i cant get the patches to compile! I keep getting a bunch of undeclared identifier. Here what I did: 1. opened...
wlk125 Offline Send Email Feb 20, 2008
6:33 pm

I have followed your instruction and recompiled highgui.dll with no problem and when i use cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH_HEIGHT, 640480...
joe.fasanella Offline Send Email Jun 10, 2008
6:14 am

I have the same problem. :(...
binnypaul2000 Offline Send Email Jul 14, 2008
12:07 am

OK everything seems to work fine but when I actually set the window in 640x480 resolution, I only get a black picture. My webcam has a light that flashes when...
feki_o Online Now Send Email Aug 27, 2008
4:29 pm

Hi! Thx for this great solution :-)) Ronnie...
ronnie.biehl Offline Send Email Aug 29, 2008
12:21 pm

do u know ...how to build highgui100.dll.. plz tell me......
gopal_p_pagrut Offline Send Email Nov 12, 2008
7:48 am

Can anyone tell me if this REALLY does give higher resolution images? I've managed to get 640*480 on the directshow interface but the image is really just an...
mdale9_opencv Offline Send Email Nov 13, 2008
11:56 am

I also have a Logitech quickCam 4000 and I can capture only images at 320x240. Someone can post a solution to grab frames at 640x480? Thanks Andrea ... images?...
andrea.grifoni Offline Send Email Nov 15, 2008
7:02 am

... Hi to everyone!!! I'm an absolute beginner in openCV. I have to make an object recognition algorithm, and I've done that and it is working pretty good but...
grgo.cupic Offline Send Email Nov 16, 2008
8:05 am

Hi again! Can someone please tell on which version of openCV does this solution work, I'm running it on 1,1 (the recent) and I can't get it working. Can...
grgo.cupic Offline Send Email Nov 21, 2008
12:15 pm

Does anyone know if this solution still works? I tried editing highgui.h and cvcap_vfw.h but i can't get the capturing resolution to 640x480... :( I really...
klaasdude Offline Send Email Feb 26, 2009
12:43 pm
First  | < Prev  |  Last 
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help