5

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

The question is how to set up power line frequency filtration 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.

Unfortunately I can not find the corresponding property in CAP_PROP_* constants.

What is the proper way to do it if any?

Hennadii Madan
  • 1,573
  • 1
  • 14
  • 30

1 Answers1

4

You can change the power line frequency setting as well as anything else using this answer, assuming you have installed GStreamer support (flag: -D WITH_GSTREAMER=ON).

If you don't have GStreamer, you can use v4l utils directly from terminal. Since it is a prerequisite for installing OpenCV, so you should already have it.

Run:

for 50Hz:

v4l2-ctl --set-ctrl power_line_frequency=1

for 60Hz:

v4l2-ctl --set-ctrl power_line_frequency=2

to check current setting:

 v4l2-ctl --all

Reference: Webcam flicker due to electricity grid frequency rate - Fedora Forums

Failed Scientist
  • 1,977
  • 3
  • 29
  • 48
sleepyhead
  • 419
  • 1
  • 5
  • 19
  • @TalhaIrfan I will, can you please specify? – sleepyhead Jun 28 '18 at 13:01
  • @sleepyhead Hey, thanks, so having it compiled with GStreamer support is the answer. Regarding edits: I think everything beyond the first paragraph is not essential (i.e. it answers a different question from what was asked), so it's better to have it removed for clarity. Otherwise I accept. – Hennadii Madan Jun 29 '18 at 10:55