Repository navigation
Added exposure controls for UVC video cameras - #392
Conversation
"auto" checkbox for auto exposure. camera itself remembers settings so didn't use QSettings
| // Special formatting for FOURCC to make it readable | ||
| if (prop.id == cv::CAP_PROP_FOURCC && value > 0) { | ||
| int fourcc = static_cast<int>(value); | ||
| char fcc[] = { |
There was a problem hiding this comment.
clang-tidy diagnostic
videostreamworker.cpp:327:30: warning: [clang-analyzer-deadcode.DeadStores]
Value stored to 'fcc' during its initialization is never read
327 | char fcc[] = {
| ^~~ ~
328 | static_cast<char>(fourcc & 0XFF),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329 | static_cast<char>((fourcc >> 8) & 0XFF),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330 | static_cast<char>((fourcc >> 16) & 0XFF),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331 | static_cast<char>((fourcc >> 24) & 0XFF),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332 | 0
| ~
333 | };
| ~
videostreamworker.cpp:327:30: note: Value stored to 'fcc' during its initialization is never read
327 | char fcc[] = {
| ^~~ ~
328 | static_cast<char>(fourcc & 0XFF),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329 | static_cast<char>((fourcc >> 8) & 0XFF),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330 | static_cast<char>((fourcc >> 16) & 0XFF),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
331 | static_cast<char>((fourcc >> 24) & 0XFF),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
332 | 0
| ~
333 | };
| ~|
🚀 New build available for commit |
There was a problem hiding this comment.
Line 1089 emit updateFilterSize(Rad) is old code and overwrote the new code. So this file is not correct.
|
I see now. I removed a line of code that wasn't being used because clang complained. Original code 9/30/2026: Then on 10/1 you removed the qDebug line. Then yesterday I deleted the line that creates frequencyBin. Which is no longer needed as the qDebug is gone. So I think it's probably okay now? I didn't test it but I probably tested some time after 9/30. I'm going to fix that clang error above now. I just have to delete some code in dumpAll() that isn't needed. |
|
Oh, sorry. I spent a long time on code that computed the freqbin. I forgot I did not use it anymore. Message ID: ***@***.***>
|
|
🚀 New build available for commit |
|
I fixed that one clang complaint above. Please look this PR over, Dale. Thanks. Next I'm going to look into why the camera frames switch to black after about 30 seconds even though communication with the camera still works. |
Before I added the cv::mean() function it was happening every 10-30 seconds. Now about once per minute so that alone made it better, lol. The restart takes about 3 seconds versus having to reclick the "0" in settings which then takes about 7 seconds. So this is a big improvement.
|
@githubdoe I wrote a little patch of code which reconnects the camera when I start getting blank frames (all values zero). This makes life so much better with the camera on my desktop. I hope you don't mind that I added it to this PR. As usual, to see the commit changes individually, click on "commits" tab below the PR tab and next to the "discussion" tab. Or use the "files changed" tab to see all the changes in this PR at once. |
|
🚀 New build available for commit |
|
@githubdoe Okay. I merged. I think we should merge this into master. I didn't look carefully at the code but... I did look at quite a few small sections as was needed. I'll start a PR but we can cancel it if you don't like the idea. |
Tested against 3 different USB cameras. Can control exposure and gain on all 3 just fine. Wasn't able to test autoExposure feature as none of my 3 cameras seem to allow that through UVC/DirectShow. That code is simpler so hopefully no bugs.