Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC2 preparations #3292

Merged
merged 107 commits into from
Oct 4, 2024
Merged
Changes from 1 commit
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
5dff4ca
Create dig-cont_0640_s3_q.tflite
jomjol Feb 17, 2024
3e85cfb
Update edit_reference.html (#2924)
SybexX Feb 17, 2024
fbe4609
Update edit_config_template.html (#2925)
SybexX Feb 17, 2024
dccfb5e
The parameter "negative" is processed on the MCU
caco3 Feb 17, 2024
7e806df
Renamed menu entry Alignment -> References
caco3 Feb 18, 2024
08a3501
renamed model file to make naming consistent
caco3 Mar 13, 2024
043de92
Fix test (#2933)
haverland Mar 20, 2024
5194c46
always reset change absolute (#2956)
kub3let Mar 22, 2024
d6a1838
Create dig-class11_1701_s2.tflite
jomjol Mar 25, 2024
ecaed38
Update tflite
jomjol Mar 30, 2024
8481cc4
Update tflite
jomjol Mar 30, 2024
88b531a
Camera settings (#3029)
SybexX Apr 11, 2024
7e5f6bf
Fix minor typo and harmonize spaces (#3030)
myxor Apr 11, 2024
c3fadf5
Source code formatting, ClassFlowPostProcessing.cpp
SybexX Apr 15, 2024
70b031e
fix edit_config_template.html
SybexX Apr 16, 2024
ae6a945
fix readconfigparam.js
SybexX Apr 16, 2024
32282ec
fix edit_config_template.html
SybexX Apr 16, 2024
dc90972
Update info.html
SybexX Apr 24, 2024
4049d75
Update overview.html
SybexX Apr 26, 2024
79543df
Update reply-bot.yaml
caco3 May 7, 2024
1300242
homeassistant service discovery: derive node_id when using nested top…
henrythasler Jun 2, 2024
1a76ae1
add Prometheus/OpenMetrics exporter (#3081)
henrythasler Jun 2, 2024
beb0959
Typo
caco3 Jun 2, 2024
c54ca18
update platformIO to 6.7.0 (ESP IDF 5.2.1) (#3098)
caco3 Jun 3, 2024
009ab4c
Update reply-bot.yaml (#3107)
caco3 Jun 9, 2024
8012b7f
Fix actions-label-commenter
caco3 Jun 9, 2024
aa2a4ed
Update Helper.cpp
SybexX Jul 17, 2024
d3d9c64
Update Helper.h
SybexX Jul 17, 2024
132834c
Update Helper.cpp
SybexX Jul 17, 2024
ee38bc7
Update readconfigparam.js
SybexX Jul 20, 2024
f534741
proposal for renaming and documentation (#3115)
henrythasler Jul 21, 2024
64bb4f0
Update server_camera.cpp
SybexX Aug 5, 2024
eefccf6
Update ClassFlowPostProcessing.cpp
SybexX Aug 5, 2024
cce9927
Update ClassFlowAlignment.cpp
SybexX Aug 5, 2024
f99dc8f
Fix building with `-D DEBUG_DETAIL_ON` (#3160)
slovdahl Aug 8, 2024
17fe87b
Handle empty prevalue.ini gracefully (#3162)
slovdahl Aug 8, 2024
7b75440
Bugfix for boot loop (#3175)
SybexX Aug 17, 2024
2546ab8
Delete param-docs/parameter-pages/TakeImage/Aec2.md
SybexX Aug 18, 2024
9a4b51d
Delete param-docs/parameter-pages/TakeImage/AutoExposureLevel.md
SybexX Aug 18, 2024
6922970
Delete param-docs/parameter-pages/TakeImage/Brightness.md
SybexX Aug 18, 2024
d567a5d
Delete param-docs/parameter-pages/TakeImage/Contrast.md
SybexX Aug 18, 2024
b6c6805
Delete param-docs/parameter-pages/TakeImage/Grayscale.md
SybexX Aug 18, 2024
eb7d078
Delete param-docs/parameter-pages/TakeImage/Negative.md
SybexX Aug 18, 2024
39e84ba
Delete param-docs/parameter-pages/TakeImage/Saturation.md
SybexX Aug 18, 2024
e3ff049
Delete param-docs/parameter-pages/TakeImage/Sharpness.md
SybexX Aug 18, 2024
ccefe57
Delete param-docs/parameter-pages/TakeImage/ImageQuality.md
SybexX Aug 18, 2024
6543772
Delete param-docs/parameter-pages/TakeImage/Zoom.md
SybexX Aug 18, 2024
ae69942
Delete param-docs/parameter-pages/TakeImage/ZoomMode.md
SybexX Aug 18, 2024
fb6cb44
Delete param-docs/parameter-pages/TakeImage/ZoomOffsetX.md
SybexX Aug 18, 2024
0441753
Delete param-docs/parameter-pages/TakeImage/ZoomOffsetY.md
SybexX Aug 18, 2024
c7e340d
Delete param-docs/parameter-pages/TakeImage/ImageSize.md
SybexX Aug 18, 2024
3a9c9ac
Delete param-docs/parameter-pages/TakeImage/FixedExposure.md
SybexX Aug 18, 2024
773d21a
Delete param-docs/parameter-pages/Alignment/FlipImageSize.md
SybexX Aug 18, 2024
20980b2
Delete param-docs/parameter-pages/Alignment/InitialMirror.md
SybexX Aug 18, 2024
cb3f082
CamParameter documentation update
SybexX Aug 18, 2024
acf6699
typo
caco3 Aug 20, 2024
c9a3df4
add Webhook #3148 (#3163)
RaHehl Aug 23, 2024
f8eb4db
Bugfix for time stamp (#3180)
SybexX Aug 24, 2024
5c57522
Update readconfigcommon.js
SybexX Aug 27, 2024
2c69e90
fix svg favicon
caco3 Aug 27, 2024
21ec58d
Update platformIO to 6.8.1 (Contains ESP IDF 5.3) (#3196)
caco3 Aug 28, 2024
b4f6b1a
Update MainFlowControl.cpp
SybexX Aug 29, 2024
7225792
Add support for OV5640 camera (#3063)
jasaw Aug 29, 2024
822753b
Update MainFlowControl.cpp
SybexX Aug 29, 2024
d8e37dc
Add rate threshold parameter (#3195)
SybexX Aug 30, 2024
e5eca6a
Update main.cpp
SybexX Aug 31, 2024
174743a
Update config.ini
SybexX Aug 31, 2024
3a34564
Update readconfigparam.js
SybexX Aug 31, 2024
cd29690
add optional ImageUpload for Webhook (#3174)
RaHehl Sep 1, 2024
3219202
Add files via upload (#3207)
SybexX Sep 1, 2024
61bca4e
Update ClassFlowPostProcessing.cpp
SybexX Sep 1, 2024
67c3020
Update ClassFlowDefineTypes.h
SybexX Sep 1, 2024
d1c815c
Update text on recognition page
caco3 Sep 3, 2024
098b1bd
Update digital CNN
jomjol Sep 17, 2024
20a04b8
add a Delay between the WiFi reconnections (#3068)
hex7c0 Sep 22, 2024
085c47b
cleanup
SybexX Sep 23, 2024
85375b6
cleanup
SybexX Sep 24, 2024
ebcec97
cleanup
SybexX Sep 24, 2024
2b7da5b
Update edit_alignment.html
SybexX Sep 26, 2024
79476a8
cleanup
SybexX Sep 26, 2024
276efef
cleanup
SybexX Sep 26, 2024
aad1a0e
Update platformIO to 6.9.0 (Contains ESP IDF 5.3.1)
SybexX Sep 26, 2024
f39dacc
Handle crash on corrupted model (#3220)
caco3 Sep 28, 2024
d370ba5
new dig-class100-173-s2-q on 23.800 images (#3257)
haverland Sep 28, 2024
4522ba0
moved number edit box styles into new file edit_style.css (#3262)
kalwados Sep 29, 2024
5496573
added note about only TLS 1.2 is supported (#3213)
caco3 Sep 29, 2024
f6bdd48
Renamed digital to digit (#3219)
caco3 Sep 29, 2024
7d62cf6
Update Changelog.md
caco3 Sep 29, 2024
3b3a3eb
Update Changelog.md
caco3 Sep 29, 2024
bd5be5c
Prepare next release (#3267) (#3270)
caco3 Sep 29, 2024
d027adf
revert TFlite submodule update as certain modules crash with it, see …
Sep 30, 2024
f6a3dc5
Rename NUMBER.AnalogDigitTransitionStart.md to NUMBER.AnalogToDigitTr…
caco3 Sep 30, 2024
a092142
Update NUMBER.AnalogToDigitTransitionStart.md
caco3 Sep 30, 2024
74491e9
Update edit_config_template.html
caco3 Sep 30, 2024
c7fdc46
changed the webhook UploadImg to false
Sep 30, 2024
28d9325
changed the webhook UploadImg to false (#3279)
caco3 Sep 30, 2024
52efedc
Merge branch 'rolling' of https://github.com/jomjol/AI-on-the-edge-de…
Oct 1, 2024
d4406f4
Show boolean option in settings page (#3285)
caco3 Oct 1, 2024
be93567
Merge branch 'rolling' of https://github.com/jomjol/AI-on-the-edge-de…
Oct 1, 2024
4c3dcd8
changed default value from boolean to numeric value in parameter camD…
Oct 1, 2024
c708e23
Update edit_explain_7.html
SybexX Oct 1, 2024
a5927f9
docs: update README.md (#3290)
eltociear Oct 4, 2024
a9aadbd
rename/remove unused parameters (#3291)
caco3 Oct 4, 2024
1d8c6fa
migrate-cam-parameters (#3288)
SybexX Oct 4, 2024
39a8272
Update Changelog.md
caco3 Oct 4, 2024
e1ea09c
Merge branch 'master' into rolling
caco3 Oct 4, 2024
bb69929
cleanup
caco3 Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Camera settings (#3029)
* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload
SybexX authored Apr 11, 2024
commit 88b531ae8b89caaff6606a6ae68b8811d8eaac07
1,263 changes: 678 additions & 585 deletions code/components/jomjol_controlcamera/ClassControllCamera.cpp

Large diffs are not rendered by default.

152 changes: 93 additions & 59 deletions code/components/jomjol_controlcamera/ClassControllCamera.h
Original file line number Diff line number Diff line change
@@ -15,66 +15,100 @@
#include "CImageBasis.h"
#include "../../include/defines.h"

class CCamera {
protected:
int ActualQuality;
framesize_t ActualResolution;
int brightness, contrast, saturation, autoExposureLevel;
bool isFixedExposure;
int waitbeforepicture_org;
int led_intensity = 4095;

void ledc_init(void);
bool CameraInitSuccessful = false;
bool demoMode = false;

bool loadNextDemoImage(camera_fb_t *fb);
long GetFileSize(std::string filename);

void SetCamWindow(sensor_t *s, int resolution, int xOffset, int yOffset, int xLength, int yLength);
void SetImageWidthHeightFromResolution(framesize_t resol);

public:
int image_height, image_width;
bool imageZoomEnabled = false;
int imageZoomMode = 0;
int imageZoomOffsetX = 0;
int imageZoomOffsetY = 0;
bool imageNegative = false;
bool imageAec2 = false;
bool imageAutoSharpness = false;
int imageSharpnessLevel = 0;
#ifdef GRAYSCALE_AS_DEFAULT
bool imageGrayscale = true;
#else
bool imageGrayscale = false;
#endif

CCamera();
esp_err_t InitCam();

void LightOnOff(bool status);
void LEDOnOff(bool status);
esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
esp_err_t CaptureToStream(httpd_req_t *req, bool FlashlightOn);
void SetQualitySize(int qual, framesize_t resol, bool zoomEnabled, int zoomMode, int zoomOffsetX, int zoomOffsetY);
bool SetBrightnessContrastSaturation(int _brightness, int _contrast, int _saturation, int _autoExposureLevel, bool _grayscale, bool _negative, bool _aec2, int _sharpnessLevel);
void SetZoom(bool zoomEnabled, int zoomMode, int zoomOffsetX, int zoomOffsetY);
void GetCameraParameter(httpd_req_t *req, int &qual, framesize_t &resol, bool &zoomEnabled, int &zoomMode, int &zoomOffsetX, int &zoomOffsetY);
void SetLEDIntensity(float _intrel);
bool testCamera(void);
void EnableAutoExposure(int flash_duration);
bool getCameraInitSuccessful();
void useDemoMode(void);


framesize_t TextToFramesize(const char * text);

esp_err_t CaptureToFile(std::string nm, int delay = 0);
esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
};
typedef enum
{
OV2640_MODE_UXGA,
OV2640_MODE_SVGA,
OV2640_MODE_CIF
} ov2640_sensor_mode_t;

typedef struct
{
framesize_t ImageFrameSize = FRAMESIZE_VGA; // 0 - 10
gainceiling_t ImageGainceiling; // Image gain (GAINCEILING_x2, x4, x8, x16, x32, x64 or x128)

extern CCamera Camera;
int ImageQuality; // 0 - 63
int ImageBrightness; // (-2 to 2) - set brightness
int ImageContrast; //-2 - 2
int ImageSaturation; //-2 - 2
int ImageSharpness; //-2 - 2
bool ImageAutoSharpness;
int ImageSpecialEffect; // 0 - 6
int ImageWbMode; // 0 to 4 - if awb_gain enabled (0 - Auto, 1 - Sunny, 2 - Cloudy, 3 - Office, 4 - Home)
int ImageAwb; // white balance enable (0 or 1)
int ImageAwbGain; // Auto White Balance enable (0 or 1)
int ImageAec; // auto exposure off (1 or 0)
int ImageAec2; // automatic exposure sensor (0 or 1)
int ImageAeLevel; // auto exposure levels (-2 to 2)
int ImageAecValue; // set exposure manually (0-1200)
int ImageAgc; // auto gain off (1 or 0)
int ImageAgcGain; // set gain manually (0 - 30)
int ImageBpc; // black pixel correction
int ImageWpc; // white pixel correction
int ImageRawGma; // (1 or 0)
int ImageLenc; // lens correction (1 or 0)
int ImageHmirror; // (0 or 1) flip horizontally
int ImageVflip; // Invert image (0 or 1)
int ImageDcw; // downsize enable (1 or 0)

int ImageWidth;
int ImageHeight;

int ImageLedIntensity;

bool ImageZoomEnabled;
int ImageZoomMode;
int ImageZoomOffsetX;
int ImageZoomOffsetY;
int ImageZoomSize;

int WaitBeforePicture;
bool isImageSize;

bool CameraInitSuccessful;
bool changedCameraSettings;
bool DemoMode;
bool SaveAllFiles;
} camera_controll_config_temp_t;

extern camera_controll_config_temp_t CCstatus;

class CCamera
{
protected:
void ledc_init(void);
bool loadNextDemoImage(camera_fb_t *fb);
long GetFileSize(std::string filename);
void SetCamWindow(sensor_t *s, int resolution, int xOffset, int yOffset, int xTotal, int yTotal, int xOutput, int yOutput);
void SetImageWidthHeightFromResolution(framesize_t resol);

public:
CCamera(void);
esp_err_t InitCam(void);

void LightOnOff(bool status);
void LEDOnOff(bool status);

esp_err_t setSensorDatenFromCCstatus(void);
esp_err_t getSensorDatenToCCstatus(void);

esp_err_t CaptureToHTTP(httpd_req_t *req, int delay = 0);
esp_err_t CaptureToStream(httpd_req_t *req, bool FlashlightOn);

void SetQualityZoomSize(int qual, framesize_t resol, bool zoomEnabled, int zoomOffsetX, int zoomOffsetY, int imageSize);
void SetZoomSize(bool zoomEnabled, int zoomOffsetX, int zoomOffsetY, int imageSize);
void SetCamSharpness(bool _autoSharpnessEnabled, int _sharpnessLevel);

void SetLEDIntensity(float _intrel);
bool testCamera(void);
bool getCameraInitSuccessful(void);
void useDemoMode(void);

framesize_t TextToFramesize(const char *text);

esp_err_t CaptureToFile(std::string nm, int delay = 0);
esp_err_t CaptureToBasisImage(CImageBasis *_Image, int delay = 0);
};

extern CCamera Camera;
#endif
88 changes: 58 additions & 30 deletions code/components/jomjol_controlcamera/ov2640_sharpness.cpp
Original file line number Diff line number Diff line change
@@ -3,71 +3,78 @@
#include "ov2640_sharpness.h"


#define OV2640_MAXLEVEL_SHARPNESS 6

const static uint8_t OV2640_SHARPNESS_AUTO[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0x20, 0x20,
0x00, 0x00, 0x00
};

const static uint8_t OV2640_SHARPNESS_MANUAL[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0x00, 0x20,
0x00, 0x00, 0x00
};

const static uint8_t OV2640_SHARPNESS_LEVEL0[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc0, 0x1f,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC0, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL1[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc1, 0x1f,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC1, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL2[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc2, 0x1f,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC2, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL3[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc4, 0x1f,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC4, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL4[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xc8, 0x1f,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xC8, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL5[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xd0, 0x1f,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xD0, 0x1F,
0x00, 0x00, 0x00
};
const static uint8_t OV2640_SHARPNESS_LEVEL6[]=
{
0xFF, 0x00, 0xff,
0x92, 0x01, 0xff,
0x93, 0xdf, 0x1f,
//reg, val, mask
0xFF, 0x00, 0xFF,
0x92, 0x01, 0xFF,
0x93, 0xDF, 0x1F,
0x00, 0x00, 0x00
};

@@ -82,6 +89,9 @@ const static uint8_t *OV2640_SETTING_SHARPNESS[]=
OV2640_SHARPNESS_LEVEL6 // +3 sharpness
};

#define OV2640_MAXLEVEL_SHARPNESS 6


static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
{
uint8_t address;
@@ -91,34 +101,52 @@ static int table_mask_write(sensor_t *sensor, const uint8_t* ptab)
const uint8_t *pdata = ptab;

if (pdata == NULL)
{
return -1;
}

while (1)
{
address = *pdata++;
value = *pdata++;
mask = *pdata++;

if ((address == 0) && (value == 0) && (mask == 0))
{
break;
}

sensor->set_reg(sensor, address, mask, value);
}

return 0;
}


int ov2640_enable_auto_sharpness(sensor_t *sensor)
{
table_mask_write(sensor, OV2640_SHARPNESS_AUTO);

return 0;
}


int ov2640_set_sharpness(sensor_t *sensor, int sharpness)
{
if ((sharpness < -3) || (sharpness > OV2640_MAXLEVEL_SHARPNESS - 3))
return -1;
int sharpness_temp = 0;

if (sharpness < -3)
{
sharpness_temp = -3;
}

if (sharpness > OV2640_MAXLEVEL_SHARPNESS - 3)
{
sharpness_temp = OV2640_MAXLEVEL_SHARPNESS - 3;
}

table_mask_write(sensor, OV2640_SHARPNESS_MANUAL);
table_mask_write(sensor, OV2640_SETTING_SHARPNESS[sharpness + 3]);
table_mask_write(sensor, OV2640_SETTING_SHARPNESS[sharpness_temp + 3]);

return 0;
}
Loading