jomjol / AI-on-the-edge-device

Easy to use device for connecting "old" measuring units (water, power, gas, ...) to the digital world
https://jomjol.github.io/AI-on-the-edge-device-docs/
5.73k stars 618 forks source link

16.0.0-RC1: Zoom enabled is discarded after upgrade #3277

Closed nliaudat closed 3 hours ago

nliaudat commented 3 hours ago

The Problem

The old parameters as zoom = true are not preserved upon update

Version

Release: v16-0-0-RC1 (Commit: ca01f5a+)

Logfile

Old :
____________________

[TakeImage]
;RawImagesLocation = /log/source
WaitBeforeTakingPicture = 4
;RawImagesRetention = 15
Demo = false
Brightness = 0
Contrast = 0
Saturation = 0
Sharpness = 0 
LEDIntensity = 3
ImageQuality = 12
ImageSize = VGA
Zoom = true
ZoomMode = 0
ZoomOffsetX = 700
ZoomOffsetY = 285
Grayscale = false
Negative = false
Aec2 = true
AutoExposureLevel = -1
FixedExposure = false

NEW : 
_______________

[TakeImage]
;RawImagesLocation = /log/source

;RawImagesRetention = 15
WaitBeforeTakingPicture = 4
CamGainceiling = x8
CamQuality = 10
CamBrightness = 0
CamContrast = 0
CamSaturation = 0
CamSharpness = 0
CamAutoSharpness = false
CamSpecialEffect = no_effect
CamWbMode = auto
CamAwb = true
CamAwbGain = true
CamAec = true
CamAec2 = true
CamAeLevel = 2
CamAecValue = 600
CamAgc = true
CamAgcGain = 8
CamBpc = true
CamWpc = true
CamRawGma = true
CamLenc = true
CamHmirror = false
CamVflip = false
CamDcw = true
CamDenoise = 0
CamZoom = true
CamZoomOffsetX = 0
CamZoomOffsetY = 0
CamZoomSize = 0
LEDIntensity = 3
Demo = false

Expected Behavior

No response

Screenshots

-

Additional Context

-

nliaudat commented 3 hours ago

For zoom, the fix is to set the "zoom size" (29 or more) if CamZoom = true

caco3 commented 3 hours ago

Yes, it is known that the reference image/camera settings might need an update. I just added a note to the release for this: image

nliaudat commented 3 hours ago

Ok, but update the notice to

"The reference image NEEDS to be updated".

Mine was not to dark at all. It was not zoomed anymore

caco3 commented 3 hours ago

I changed it now to

If the image is too dark after the update or otherwise different than before, you might need to update the camera settings and create a new reference image. We extended the camera settings and some devices need reconfiguration due to this.

nliaudat commented 3 hours ago

But the old parameters can be upgraded to new. That is the problem

nliaudat commented 2 hours ago

the reference image and camera settings do no match the config

caco3 commented 2 hours ago

But the old parameters can be upgraded to new. That is the problem

What do you suggest?

the reference image and camera settings do no match the config

And here?

SybexX commented 2 hours ago

@caco3 To solve the problem you would have to adjust the "void migrateConfiguration(void){}" in the main.cpp

maybe like that:

        if (section == "[MakeImage]" || section == "[TakeImage]") {
            migrated = migrated | replaceString(configLines[i], "LogImageLocation", "RawImagesLocation");
            migrated = migrated | replaceString(configLines[i], "LogfileRetentionInDays", "RawImagesRetention");

            migrated = migrated | replaceString(configLines[i], ";Demo = true", ";Demo = false"); // Set it to its default value
            migrated = migrated | replaceString(configLines[i], ";Demo", "Demo"); // Enable it

            migrated = migrated | replaceString(configLines[i], "Brightness", "CamBrightness");
            migrated = migrated | replaceString(configLines[i], "Contrast", "CamContrast");
            migrated = migrated | replaceString(configLines[i], "Saturation", "CamSaturation");
            migrated = migrated | replaceString(configLines[i], "Sharpness", "CamSharpness");

            migrated = migrated | replaceString(configLines[i], "ImageQuality", "CamQuality");          

            migrated = migrated | replaceString(configLines[i], "Aec2", "CamAec2");
            migrated = migrated | replaceString(configLines[i], "AutoExposureLevel", "CamAeLevel");
            migrated = migrated | replaceString(configLines[i], "FixedExposure", "CamAec");

            migrated = migrated | replaceString(configLines[i], "Zoom", "CamZoom");
            migrated = migrated | replaceString(configLines[i], "ZoomMode", "CamZoomSize");
            migrated = migrated | replaceString(configLines[i], "ZoomOffsetX", "CamZoomOffsetX");
            migrated = migrated | replaceString(configLines[i], "ZoomOffsetY", "CamZoomOffsetY");

            migrated = migrated | replaceString(configLines[i], "ImageSize", ";UNUSED_PARAMETER"); // This parameter is no longer used
            migrated = migrated | replaceString(configLines[i], "Grayscale", ";UNUSED_PARAMETER"); // This parameter is no longer used
            migrated = migrated | replaceString(configLines[i], "Negative", ";UNUSED_PARAMETER"); // This parameter is no longer used
        }

        if (section == "[Alignment]") {
            migrated = migrated | replaceString(configLines[i], "InitialMirror", ";UNUSED_PARAMETER"); // This parameter is no longer used
            migrated = migrated | replaceString(configLines[i], ";InitialMirror", ";UNUSED_PARAMETER"); // This parameter is no longer used
            migrated = migrated | replaceString(configLines[i], "FlipImageSize", ";UNUSED_PARAMETER"); // This parameter is no longer used
            migrated = migrated | replaceString(configLines[i], ";FlipImageSize", ";UNUSED_PARAMETER"); // This parameter is no longer used
        }
nliaudat commented 2 hours ago

In fact, I do not understand why @caco3 is closing bugs on alpha release without investigating.

Actually, the zoom factor on my first cam was very blury and I broke it while turing it left side. The result is I cannot help you further to debug the problem, but there is one.

Regards and please keep cool with helpers who spend time to find new bugs.

SybexX commented 2 hours ago

@nliaudat The zoom function has been completely revised and now works similarly to a cell phone. It is zoomed to the center and the offset is now +- , CamZoomSize = 0 >> no zoom and CamZoomSize = 29 >> fully zoomed in

caco3 commented 54 minutes ago

@SybexX I was not aware that we renamed the parameters. Then a parameter migration of course makes sense. Is your proposed code complete or do we have to go through a list and check?

@nliaudat We get a lot of issues and most of them actually should be discussions. Every week I convert a few of them :( I closed this issue because we know that an update of the parameters is required and we already documented it on the release page. Of course a message directly on the UI would be much nice. But it also would be quite some work for us. We are a small team and also have other hobbies. I already spend far more time for this project than I actually should priority wise.

SybexX commented 43 minutes ago

@caco3 That should be all of the camera parameters, but I can't say what the others look like. However, there will still be problems with zoom because there are more zoom levels and the offset is now +- ZoomMode = 0/1 vs. CamZoomSize = 0 to 29 ZoomOffsetX = 0 to 800 vs. CamZoomOffsetX = +/- 480 ZoomOffsetY = 0 to 600 vs. CamZoomOffsetY = +/- 360

caco3 commented 33 minutes ago

According to the diff those are the changes: image