AllskyTeam / allsky

A Raspberry Pi operated Wireless Allsky Camera
MIT License
1.19k stars 180 forks source link

[BUG] terminate called after throwing an instance of 'cv::Exception' #3378

Closed EricClaeys closed 5 months ago

EricClaeys commented 9 months ago

Discussed in https://github.com/AllskyTeam/allsky/discussions/3373

Originally posted by **ssagerian** January 24, 2024 So, each day, at the night to day transition and again at the day to night transition, I get the same crash. Daytime bin is 1x1 and nighttime is 2x2. capture_RPi is crashing at the day/night transitions when the image sizes change.
ssagerian commented 9 months ago

ok, 1x1 bining is on for both day and night

ssagerian commented 9 months ago

hum..I think you are on to something. Ok last night I disabled overlays. This morning I turned them on, the overlays looked normal sized as expected. Then, when I read your email, I configured bining to 1x1 for both night and day, but THEN the overlays were shrunk and re-positioned in the upper left corner. When I set the bining to 2x2 the images returned to normal size..that might be a clue for Alex wrt to the overlay module work he is doing?

EricClaeys commented 9 months ago

@ssagerian, I assume you didn't get the crash when the binnings were the same?

A future version of Allsky will allow multiple overlay configurations so you can have one for daytime with 1x1 bin and one for nighttime with 2x2 bin and the size and placement of overlay fields will be correct.

If you haven't notices, keograms and startrails won't work unless all the images in them are the same dimensions, so binning different during day and night will break keograms and startrails. Not sure what it'll do to timelapse videos. A more future version of Allsky will allow different sized images with keograms and startrails.

ssagerian commented 9 months ago

all the overlay images need to be the same size? If you only have one image?

Looks like that change worked, no crash or shutdown this morning. Thanks for that!

EricClaeys commented 9 months ago

Steve, This file should fix the problem. I could reproduce it with different bins and the fix works.

Please rename the file to mode_mean.cpp and put it in ~/allsky/src, then run

cd ~/allsky/src
sudo systemctl stop allsky
make
cp capture_RPi ../bin
sudo truncate -s 0 /var/log/allsky.log
#  In the WebUI lower the Debug Level to 3 or whatever you normally use.  Then change night binning to 2 and press "Save changes"

Let me know how it goes. FYI, the fix was to create a new auto-exposure mask every time the image size changes, which is the first image plus at every day/night transition. If the image size and mask size are different it gives that exception. mode_mean.cpp.txt