Ask Your Question
0

Set power line frequency for camera

asked 2015-10-23 11:20:09 -0600

madanh gravatar image

I use python and opencv to build a stereo tracker using two cameras.

The question is how to set up power line frequency in openCV version 3.0.0 (or any orher). I know that the camera I use (microsoftHD3000) has this property and it can be set from v4l2 in linux and on windows I can use skype to set it once, but this is ugly.

edit retag flag offensive close merge delete

Comments

"on windows I can use skype to set it once" - you could try the same from opencv by calling

cap = cv2.VideoCapture(0); # your id here..
cap.set(cv2.CAP_PROP_SETTINGS,1);

this should take you to the same (persistant) property page as in skype, vlc, or such.

(still ugly, still interactive...)

berak gravatar imageberak ( 2015-10-24 00:23:48 -0600 )edit

on my windows C++ cap.set(CAP_PROP_SETTINGS,x); has no effects for x: -10...+10 :(

pklab gravatar imagepklab ( 2015-10-24 05:38:15 -0600 )edit

@pklab, again, this calls the driver's property page (if there is one). it all depends on the manufacturer

berak gravatar imageberak ( 2015-10-24 05:52:25 -0600 )edit

@berak, good to know that cap.set(CAP_PROP_SETTINGS,1); do this. Anyway, I can get the "Video Capture Filter" property page from other apps but I can't get it from OCV. May be it depends from VFW/DirectShow or other settings like this.

PS: The master doc does't include CAP_PROP_SETTINGS

pklab gravatar imagepklab ( 2015-10-24 06:14:32 -0600 )edit

@pklab - oohh, VFW makes a difference here, too:

VideoCapture cap(0 + CAP_DSHOW); // shows cam and prop page
VideoCapture cap(0 + CAP_VFW);   // shows cam, but does not show prop page
VideoCapture cap(0 + CAP_MSMF);   // nada
VideoCapture cap(0 + CAP_MSMF+1); // nada

it is in the docs

berak gravatar imageberak ( 2015-10-24 06:23:53 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-10-24 10:44:27 -0600

pklab gravatar image

wow!! I'm lost in the doc.

I found that CV_CAP_DSHOW and CV_CAP_VFW are available in 2.4.11 C Api too. In 3.0.0, CPP Api provides CAP_DSHOW and CAP_VFW (some refs to old CV_CAP_* still here).

  • In 2.4.11 the feature works but I can't find any reference around VideoCapture doc. Why ? may be it's unstable feature ? it's just a missing doc ? I'm lost in the doc ?
  • In 3.0.0 there is some hint

Now I know that:

VideoCapture cap(0 + CV_CAP_VFW);    // opens cam 0 with platform native
VideoCapture cap(0 + CV_CAP_DSHOW);  // opens cam 0 with  DirectShow (via videoInput)
VideoCapture cap(0 );                // opens cam 0 with with default driver maybe one of above

this works with 2.4.10 too

Just to know...On my computer if I use VideoCapture cap(0 + CV_CAP_DSHOW); I can set some props via cap.set(CV_CAP_PROP_* that doesn't have effect when I use VideoCapture cap(0 + CV_CAP_VFW);

One of this is CAP_PROP_SETTINGS that shows the driver's property page but also CV_CAP_PROP_FPS is effective and it has effect on grab loop! this is completely different from what I said in a my recent answer :(

It's never to late to learn something !

edit flag offensive delete link more

Comments

Today I took at look at the docs and I felt lost too. It seems there are a lot of enums I didn't know about, and that do things I still don't know :S Hopefully someone will update docs soon. Talking about the settings, I can't get the CV_CAP_PROP_FPS to work even when using the CAP_DSHOW flag

LorenaGdL gravatar imageLorenaGdL ( 2015-10-24 11:13:09 -0600 )edit

chances are , that CAP_MSMF+1 might work , too. did someone try ?

berak gravatar imageberak ( 2015-10-24 11:14:44 -0600 )edit

On my Win7/64 and 2.4.10: CV_CAP_PROP_FPS works only with CV_CAP_DSHOW and I can't open camera using CV_CAP_MSMF nor CV_CAP_MSMF+1

pklab gravatar imagepklab ( 2015-10-24 11:30:09 -0600 )edit

Also here on Win7/64, neither with 2.4.12 nor with 3.0.0 I can make CAP_PROP_FPS to work (not that I need it right now, but just for info). And CAP_MSFM not working either.

LorenaGdL gravatar imageLorenaGdL ( 2015-10-24 11:57:42 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-10-23 11:20:09 -0600

Seen: 3,003 times

Last updated: Oct 24 '15