I'm a French ASI178MM user, I managed to stream live @ 30FPS low latency the ZWO camera I like on a live robotics teleoperation website (https://www.vigibot.com click on the robot icon named "Wow").
I use a Raspberry PI 4 4Go HEADLESS and C++ / OpenCV you can see the result on the video where I show a Dark calibration process and live float stack, every time working smooth @ 30FPS. you can look the small demo here : https://www.youtube.com/watch?v=X7wojpTc0n4 where I push the IMX178 @ maximum gain and stacking to show hot pixel visible and the stack/dark calibration algorithm.
The objective is to make a small (and public) remote sky observatory @ countryside (because I live in Paris... For the first test I use a 50mm F1.1 photo fast lens)
I found a strange bug inside the API;
I use HARDWARE binning to get faster FPS on the PI 4, it's important for the comfort of live moving inside the sky;
Also hardware vs software binning don't give a visible performance difference in term of quality, especialy for the live sky viewer I want to create;
Software binning give too bad performance on PI 4 (low FPS video, or good for HD pictures). So, I love the Bin4 for live low latency preview usage;
Some time on a process launch, I get incorrect brightness/offset. The problem is :
ASISetControlValue(id, ASI_HARDWARE_BIN, true, ASI_FALSE);
I try to launch this API function every 10 secondes inside the video capture loop only to reproduce the bug, and about 2 time on 8, the function setup the camera with an incorrectly high brightness.
My complete source code is here, it's small but I can remove the Vigibot.com Frame to reduce the problem if you need it.
I use OpenCV convertTo to move brighness (beta +/- 200000) and contrast (alpha +/- 200), it's the only way to show the problem because it's a problem about few % brighness error.
Can you help me ? I make more code and demo if required.
We will try to test on your demo
Sorry I waited your answer to make you a more standalone dedicated code showing the bug. I think you still managed to get a similar code to work.
This is a random bug where you need to exit and launch the process.
You need a small video process like the one I made, with : hardware binning enabled (bin4) + 16 bits enabled.
I think there is a offset calculation random problem inside the API ?
I added an automatic rescale inside the last code that hide the problem...
I must check if the bug is on other camera I buy soon.