Powerline frequency problem

Black horizontal lines appear on orbbec gemini e camera.
I also tried changing the power_line_frequency value, but it didn’t work. What values should I modify?

Below are the camera properties obtained using v4l2-ctl.

                       brightness 0x00980900 (int)    : min=-64 max=64 step=1 default=0 value=64
                       contrast 0x00980901 (int)    : min=0 max=64 step=1 default=32 value=5
                     saturation 0x00980902 (int)    : min=0 max=128 step=1 default=64 value=90
                            hue 0x00980903 (int)    : min=-40 max=40 step=1 default=0 value=0
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=72 max=500 step=1 default=100 value=100
                           gain 0x00980913 (int)    : min=0 max=100 step=1 default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=2
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=4600 value=4694 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=6 step=1 default=3 value=3
         backlight_compensation 0x0098091c (int)    : min=0 max=2 step=1 default=1 value=1
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute 0x009a0902 (int)    : min=1 max=5000 step=1 default=157 value=157 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=0
                 focus_absolute 0x009a090a (int)    : min=1 max=100 step=1 default=1 value=8
                     focus_auto 0x009a090c (bool)   : default=1 value=0
                zoom_continuous 0x009a090f (int)    : min=0 max=0 step=0 default=0 value=0 flags=write-only
                        privacy 0x009a0910 (bool)   : default=0 value=0
                  iris_absolute 0x009a0911 (int)    : min=0 max=0 step=0 default=0 value=0
                  iris_relative 0x009a0912 (int)    : min=0 max=0 step=0 default=0 value=0 flags=write-only
                      pan_speed 0x009a0920 (int)    : min=0 max=0 step=0 default=0 value=0
                     tilt_speed 0x009a0921 (int)    : min=0 max=0 step=0 default=0 value=0

that’s the cause, that’s the solution. talk to orbbec customer support.

not an opencv problem insofar as opencv just uses available media APIs. maybe it’s not giving you access to all possible properties but that is yet to be determined.

debug this using your camera and any other camera program, without opencv.

figure out what your lighting does. this looks like mains frequency but it might not be. modern lighting can flicker at other frequencies.

This didn’t happen when I used other cameras. Compared to other good cameras, this camera uses a rolling shutter. Are there any values that need to be set separately when using a rolling shutter camera?


assuming your light flickers at powerline frequency (or double that)…

either your frame rate has to match powerline frequency (whole or integer fraction), or exposure time has to be a whole multiple of that period.

or get different light.

What should the exposure value be in 60hz lighting? There are a lot of things I don’t know about cameras.

You might find this link useful:

specifically this note:

 `V4L2_CID_EXPOSURE`: sets the exposure time in lines. The application needs to use `V4L2_CID_PIXEL_RATE`, `V4L2_CID_HBLANK`, and the frame width to compute the line time.

You might also look into whether your camera supports this control:


This lets you set the exposure in absolute time units. The documentation says that the value should be interpreted as 100us, but I would suggest you verify that. (I use a camera that interprets the units as 1 ms, I think.)

However you approach it, you want your exposure time to match the lighting. So if your lights are exhibiting a 60Hz flicker (which is common but not guaranteed), you want an exposure time of 1/60th of a second or some integer multiple (1/30th, 1/20th, 1/15th)

Note, as Crackwitz alluded to, the flicker frequency can actually be double the line frequency. (so you might be able to use a 1/120th of a second exposure time as well as integer multiples)

I tried adjusting the exposure_absoulte value with v4l2-ctl, but the higher the value, the brighter it becomes, and the lower the value, the more flickering occurs.

That’s what I would expect - higher values are longer exposure times, so all else being equal, the image should get brighter. Smaller values ( < 1/60th of a second, say) flicker because some of the lines are being exposed when the lighting is “pulsing”, and other lines are exposed while the light is off (loosely speaking).

What values did you try for EXPOSURE_ABSOLUTE?

I’d try values of 167, 333, 500, 667. (assuming the units of 100us are correct for your camera)

You will probably need to adjust your gain to compensate for the longer exposure times. Also, your frame rate might be limited by these longer exposure times. If that’s an issue, consider getting different lighting (or a camera with a global shutter.)

When I tried setting it to 167, the flicker phenomenon disappeared, but the brightness became so bright that it was difficult to recognize the object. And I have to use this camera

then also look for gain adjustments

maybe this thing also has a variable aperture? probably not but who knows.

you can also slap “ND” filters on the lens.

Thank you.

I solve the problem with 83 value.
I use it around white walls but it still looks too bright.