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.66k stars 609 forks source link

Poor image quality (rolling 2024-02-12) #2901

Closed Slider0007 closed 1 week ago

Slider0007 commented 6 months ago

The Problem

User are reporting poor image quality (too dark, blurry) since rolling of 2024-02-12.

https://github.com/jomjol/AI-on-the-edge-device/issues/2857#issuecomment-1939677708 https://github.com/jomjol/AI-on-the-edge-device/issues/2857#issuecomment-1940647486

I assume it's related to https://github.com/jomjol/AI-on-the-edge-device/pull/2885

Version

Rolling Commit: 141aea7fa7eb995181e9a6166209eaf00d43a527

Logfile

n.a.

Expected Behavior

No response

Screenshots

No response

Additional Context

No response

caco3 commented 6 months ago

This is really odd! I just did a screenshot of v15.6.0 and the 141aea7. As you can see below, on my setup, there is a slight difference in the color, but its not more blury:

Left side: v15.6.0, right side: 141aea7

grafik

grafik

jasaw commented 6 months ago

The default sharpness value that we use may cause the blurry image because sharpness is not documented on the ov2640 datasheet. Other than that, the other parameters should have their defaults set correctly.

caco3 commented 6 months ago

@FrankCGN01 and @warnmat The mentioned PR added some new configuration for the camera. Maybe the default parameters are not identical to what we had before. Could you play with the parameters and see if you can get to what you had before? I especially would look on the "sharpness" (expert parameter).

jasaw commented 6 months ago

Try playing with the "auto exposure control 2" as well. The old code does not set a known value, so it is left to the ov2640 default.

caco3 commented 6 months ago

The default sharpness value that we use may cause the blurry image because sharpness is not documented on the ov2640 datasheet. Other than that, the other parameters should have their defaults set correctly.

Thanks for the clarification. I seem to get comparable results (to 15.6.0) with sharpness=0 (left side) and sharpness=1 (right side): grafik

Could it be that it depends on the camera? You mentioned that you only checked the datasheet for the ov2640.

@Slider0007 I think it would be useful if we could report the camera info (type), but I couldn't find yet a way to get this information. According to the defines, we disable support for most cameras and only support 3 types (whereas BF20A6 looks odd):

#
# Camera configuration
#
# CONFIG_OV7670_SUPPORT is not set
# CONFIG_OV7725_SUPPORT is not set
# CONFIG_NT99141_SUPPORT is not set
CONFIG_OV2640_SUPPORT=y
# CONFIG_OV3660_SUPPORT is not set
# CONFIG_OV5640_SUPPORT is not set
# CONFIG_GC2145_SUPPORT is not set
# CONFIG_GC032A_SUPPORT is not set
# CONFIG_GC0308_SUPPORT is not set
# CONFIG_BF3005_SUPPORT is not set
CONFIG_BF20A6_SUPPORT=y
# CONFIG_SC101IOT_SUPPORT is not set
CONFIG_SC030IOT_SUPPORT=y
# CONFIG_SC031GS_SUPPORT is not set
caco3 commented 6 months ago

https://jomjol.github.io/AI-on-the-edge-device-docs/Hardware-Compatibility also just mentions the OV2640, so there is a high chance that we all just use that one.

jasaw commented 6 months ago

Oh, this reminds me, in the old code, there was a a workaround that writes to undocumented registers in the ov2640. It doesn't care which camera is attached. I changed the behaviour to only do the undocumented workaround if ov2640 is attached. This workaround is for brightness control.

warnmat commented 6 months ago

@FrankCGN01 and @warnmat The mentioned PR added some new configuration for the camera. Maybe the default parameters are not identical to what we had before. Could you play with the parameters and see if you can get to what you had before? I especially would look on the "sharpness" (expert parameter).

I do still have the one installed called: Development-Branch: HEAD (Commit: 246d128+)

Sorry to say but I have very less experience with Github at all. How can I get the version you call 141aea7? I do click on the link and get the code displayed but how do I get something downloadable to install it on my device. Sorry for this maybe stupid question but this github stuff is a bit overwelming for me atm. Currently I do not have any of the expert parameters you named above :-(.

friedpa commented 6 months ago

Go to Actions in the main ribbonband - Click on the Titel of, in your case: Revert "Implemented late analog / digital transition (#2778)" #347 You will find the three different versions of the SW. If you use OTA then use: AI-on-the-edge-deviceupdaterolling_(141aea7)

warnmat commented 6 months ago

Thanks for helping me out. I have installed the version and the picture quality is back to where it was before. I do now have the additional adjustment possibilities but they are all greyed out and not accessible what might be because of my camera used. I will check and rpovide an update after some iterations.

caco3 commented 6 months ago

they are all greyed out and not accessible

You first have to click on "Create new reference"!

the picture quality is back to where it was before

What does this mean? Is it back to as good as with v15.6.0?

warnmat commented 6 months ago

After the change to the new version the picture quality was back to 15.6 image quality before the change to the first DEV version to fix the inadequate count was done. Now I have generated a new reference image and I´m able to use the new features and with those I was able to get a good image when the system is running. Not that clear as some of the other posted pictures but for me this one is good enough now. The only adjustment I need to find is were to adjust the date. It tells me it is 1970/01/02... :-) Many thanks for the quick support!

friedpa commented 6 months ago

If your ISP cannot reach the NTP Server look in your Firewall if you block the access, or if your router provides a NTP functionality then insert your Gateway IP. You hae to enable Expert View to see that field right at the bottom.

FrankCGN01 commented 6 months ago

@FrankCGN01 and @warnmat The mentioned PR added some new configuration for the camera. Maybe the default parameters are not identical to what we had before. Could you play with the parameters and see if you can get to what you had before? I especially would look on the "sharpness" (expert parameter).

@caco3 After I selected "Auto-exposure Control 2" in the expert parameters, I got an image with the same quality as in version 15.6. Together with the sharpness even a little better than before.

SybexX commented 6 months ago

I had the camera parameters output to me before they were changed through config.ini:

I (4137) ov2640: Set PLL: clk_2x: 0, clk_div: 0, pclk_auto: 0, pclk_div: 8
I (4137) cam_hal: cam config ok
I (4217) MAIN: Camera scale: 0
I (4227) MAIN: Camera binning: 0
I (4227) MAIN: Camera quality: 12
I (4237) MAIN: Camera brightness: 0
I (4247) MAIN: Camera contrast: 0
I (4257) MAIN: Camera saturation: 0
I (4257) MAIN: Camera sharpness: 0
I (4267) MAIN: Camera denoise: 0
I (4277) MAIN: Camera special_effect: 0
I (4277) MAIN: Camera wb_mode: 0
I (4287) MAIN: Camera awb: 1
I (4297) MAIN: Camera awb_gain: 1
I (4477) MAIN: Camera aec: 1
I (4537) MAIN: Camera aec2: 0
I (4547) MAIN: Camera ae_level: 0
I (4557) MAIN: Camera aec_value: 168
I (4567) MAIN: Camera agc: 1
I (4567) MAIN: Camera agc_gain: 0
I (4577) MAIN: Camera gainceiling: 0
I (4587) MAIN: Camera bpc: 0
I (4597) MAIN: Camera wpc: 1
I (4597) MAIN: Camera raw_gma: 1
I (4607) MAIN: Camera lenc: 1
I (4617) MAIN: Camera hmirror: 0
I (4627) MAIN: Camera vflip: 0
I (4627) MAIN: Camera dcw: 1
I (4637) MAIN: Camera colorbar: 0
I (6647) MAIN: Camera info: PID: 0x26, VER: 0x42, MIDL: 0x7f, MIDH: 0xa2

this corresponds to these settings:

CamEinstellungen

Duese123 commented 6 months ago

Had the same error on 15.7. Never bekamen rallye sharp and with good saturation. Went back to 15.4 and problem solved. On New 15.7 Image is dark and very unsharp

caco3 commented 6 months ago

Had the same error on 15.7. Never bekamen rallye sharp and with good saturation. Went back to 15.4 and problem solved. On New 15.7 Image is dark and very unsharp

Did you also play with the expert parameters? You could try to enable the auto exposure algorithm and also adjust the exposure parameters.

caco3 commented 1 week ago

There was not much happening regarding this issue. Also, if it would be a real regression, more people would have complained. IMO we can close it, what do you think @SybexX

SybexX commented 1 week ago

@caco3 At the beginning the camera's default settings weren't set quite right, but now they should be fine in the current rolling and you can close it.

caco3 commented 1 week ago

I agree I just had to restore my devices due to a failed test (the ESP IDF update :) ). The restore used the latest release and I was surprised that the alignment image just was grey. Even when I took it out and checked the live stream, it was almost gray. But then I updated to rolling all was good again. So I agree, on 15.7.0 some thing was bad but you fixed them right afterwards IIRC.