Skip to content

Conversation

@philipqueen
Copy link
Contributor

The current default for skellycam is to open the cameras at a relatively dark setting to minimize glare. As I understand it this makes tracking better on the webcams we've tested. The issue is on some cameras this initial setting works, but users are not then able to change the exposure to their desired value. The result is users stuck in a too-dark camera state.

This PR changes the default exposure setting to 0 in order to provide a better default for users who can't change their exposure setting after the fact. This seems like a "friendlier" default setting.

Examples of users with this issue:
https://discord.com/channels/760487252379041812/760489602917466133/1369848196658106388
https://discord.com/channels/760487252379041812/760489602917466133/1337595262113284251
https://discord.com/channels/760487252379041812/760489602917466133/1314302387225235506
https://discord.com/channels/760487252379041812/1274006352464973934/1296134747185086474

@philipqueen philipqueen requested a review from jonmatthis May 19, 2025 17:19
@philipqueen
Copy link
Contributor Author

Another recent comment, with an image of how dark -7 is on some cameras:
https://discord.com/channels/760487252379041812/1042828558139146333/1377305972602703933

@jonmatthis
Copy link
Member

@philipqueen - Do you want to try to fold in the "recommended exposure" method I developed on the /jon/development branch?

I think it shouldn't be too hard to shoe-horn it in to the existing connection logic in main-branch SkellyCam, but there might be some trickiness too it. I guess you'd need a way to make sure that the recommended exposure made it back to update the relevant setting in the QT Camera Settings Parameter tree

@jonmatthis
Copy link
Member

As we discussed offline, part of the problem is that default camera settings tend to put the camera exposure way too high for mocap - the resulting images have too much blur which can lead to really bad performance in the mocap (mostly due to tracker loss)

The 'recommend' method linked above seems like a pretty good balance between getting exposure setting that are bright enough to see, but dark enough to have low blur.

@jonmatthis
Copy link
Member

Also - I'm not 100% sure about this, but I feel like that recommend method returns different preferred exposure for the same camera in the same lighting. It feels like (for cheap cameras at least) there's some variability in the practicaly consequences of a particular exposure settings. That could just be superstition though, who knows?

@jonmatthis
Copy link
Member

jonmatthis commented Jul 3, 2025

All that said, if it winds up being difficult to implement the 'recommend' settings for whatever reason, I'm down to change the initial value to 0 (which, as far as I can tell, will just be rejected by the camera which will retrain EITHER its previous setting or a default value of -6?)

image

You'd still need/want to catch the actual extracted exposure value from the camera and update the QT view....

I suppose if THAT gets difficult, we could also just bump the default exposure to -6 and call it good until skellycam v2 is ready for prime time :)

@philipqueen
Copy link
Contributor Author

Ok, testing this it looks like (on Mac) we're not able to properly turn auto exposure off with opencv. The calls to cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, ExposureModes.MANUAL.value) return false, and the table output of the recommended exposure setting output looks like this (9999) is auto exposure:

  Exposure Setting  |  Brightness | Difference from Target (127.5)
9999                     112.70           >>   14.80
-12                      112.60                14.90
-11                      112.48                15.02
-10                      112.43                15.07
-9                       112.47                15.03
-8                       112.44                15.06
-7                       112.42                15.08
-6                       112.34                15.16
-5                       112.45                15.05
-4                       112.56                14.94
Recommended exposure setting for camera 0: 9998

It looks like different backends require different values for setting auto exposure on and off. I've found the values for windows backends and v4l online, but still looking for the values for AVFoundation (and potentially GStreamer) backend.

@philipqueen
Copy link
Contributor Author

Well, I did some more digging and it looks like OpenCV just doesn't support changing from autoexposure mode, or setting exposure values with the AVFoundation backend: https://github.com/opencv/opencv/blob/4.x/modules/videoio/src/cap_avfoundation_mac.mm#L505

The issue goes back to AVFoundation itself, which doesn't provide manual exposure options for cameras on MacOS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants