New CHDK features - CHDK Releases - CHDK Forum  

New CHDK features

  • 38 Replies
  • 7705 Views
New CHDK features
« on: 30 / November / 2021, 11:19:20 »
Advertisements
Hello everyone.

I extended CHDK version 1.4.1 to my own needs, adding new interesting functionalities that greatly help in taking better and better photos. I extended the project with the following functionalities.

AutoISO2 Extensions:

- automatic exposure compensation to avoid burn-throughs based on the percentage of pixels overexposed in the histogram
- displaying the percentage of overexposed pixels in other parameters

Histogram Extensions:

- Y U V histogram
- Y waveform
- Y waveform / RGB saturation together
- RGB waveform together
- YUV waveform together
- YUV vectorscope
- Y / RGB saturation parade
- RGB parade
- YUV parade

Zebra Extensions:

- false colors with the zone system selected from the file
- signaling of low or high color saturation to zebra or false colors

Adden new ZONES directory with *.zn files

DOF calculator extensions:

- angle of view calculation
- field of view calculation

Other extensions:

- displaying the color temperature in Kelvin in the parameters different for the set white balance

It is necessary to install the already existing CHDK version on the SD card which must be bootable, because only DISKBOOT.BIN and flt modules have changed so you only need to overwrite the existing CHDK version.

I tested on Canon Powershot SX10IS and Canon Powershot SX100IS and if necessary, I can provide recompiled binary files. I present codes on github. This is derivative work. In case of problems with compilation, I will tell you what and how because I already know the project quite well.

https://github.com/dariuszrorat/CHDK

Enjoy better and better photos!  :)
« Last Edit: 30 / November / 2021, 11:24:32 by programmer0 »

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: New CHDK features
« Reply #1 on: 30 / November / 2021, 12:36:36 »
Very nice topic{s}, :D and request
https://chdk.setepontos.com/index.php?topic=5295.msg123838#msg123838
is done here ...
https://chdk.setepontos.com/index.php?topic=14048.msg143541#msg143541
 (Compatibility to 1.4.1 not tested,) so enjoy the wheel...

Edit: ... Project needs include/propset7-13.h from recent trunk, the others have grown, too ...

Edit2: How to avoid ... :-[  (gcc451 & 493, Sx230)
Code: [Select]
../../../../core/gui_osd.c: In function 'gui_osd_draw_dof':
../../../../core/gui_osd.c:232:38: error: 'CAM_SENSOR_WIDTH' undeclared (first use in this function)
             aov_rad_h = 2.0 * arctan(CAM_SENSOR_WIDTH / (2.0 * focal_length), 19);
                                      ^
../../../../core/gui_osd.c:232:38: note: each undeclared identifier is reported only once for each function it appears in
../../../../core/gui_osd.c:233:38: error: 'CAM_SENSOR_HEIGHT' undeclared (first use in this function)
             aov_rad_v = 2.0 * arctan(CAM_SENSOR_HEIGHT / (2.0 * focal_length), 19);
                                      ^
../../../../core/gui_osd.c:234:38: error: 'CAM_SENSOR_DIAGONAL' undeclared (first use in this function)
             aov_rad_d = 2.0 * arctan(CAM_SENSOR_DIAGONAL / (2.0 * focal_length), 19);

Edit3: Sx100 compiled fine...

Code: [Select]
Search "CAM_SENSOR_WIDTH" (20 hits in 18 files)
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\core\gui_osd.c (2 hits)
Line 232:             aov_rad_h = 2.0 * arctan(CAM_SENSOR_WIDTH / (2.0 * focal_length), 19);
Line 240:             aov_rad_h = 2.0 * arctan(CAM_SENSOR_WIDTH / (2.0 * S2), 19);
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\platform\s2is\platform_camera.h (1 hit)
Line 28:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\platform\s3is\platform_camera.h (1 hit)
Line 28:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\platform\s5is\platform_camera.h (1 hit)
Line 29:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\platform\sx10\platform_camera.h (1 hit)
Line 29:     #define CAM_SENSOR_WIDTH                6.17f
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\platform\sx100is\platform_camera.h (1 hit)
Line 29:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\platform\sx110is\platform_camera.h (1 hit)
Line 29:     #define CAM_SENSOR_WIDTH                6.16f
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\platform\sx120is\platform_camera.h (1 hit)
Line 30:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\CHDK-master\platform\sx20\platform_camera.h (1 hit)
Line 30:     #define CAM_SENSOR_WIDTH                6.16f
  D:\hostluaPortable\CHDK-Shell\trunk\core\gui_osd.c (2 hits)
Line 232:             aov_rad_h = 2.0 * arctan(CAM_SENSOR_WIDTH / (2.0 * focal_length), 19);
Line 240:             aov_rad_h = 2.0 * arctan(CAM_SENSOR_WIDTH / (2.0 * S2), 19);
  D:\hostluaPortable\CHDK-Shell\trunk\platform\s2is\platform_camera.h (1 hit)
Line 28:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\platform\s3is\platform_camera.h (1 hit)
Line 28:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\platform\s5is\platform_camera.h (1 hit)
Line 29:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\platform\sx10\platform_camera.h (1 hit)
Line 29:     #define CAM_SENSOR_WIDTH                6.17f
  D:\hostluaPortable\CHDK-Shell\trunk\platform\sx100is\platform_camera.h (1 hit)
Line 29:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\platform\sx110is\platform_camera.h (1 hit)
Line 29:     #define CAM_SENSOR_WIDTH                6.16f
  D:\hostluaPortable\CHDK-Shell\trunk\platform\sx120is\platform_camera.h (1 hit)
Line 30:     #define CAM_SENSOR_WIDTH                5.744f
  D:\hostluaPortable\CHDK-Shell\trunk\platform\sx20\platform_camera.h (1 hit)
Line 30:     #define CAM_SENSOR_WIDTH                6.16f
Edit4: So the others need automated #DEFINE...  :-[
« Last Edit: 01 / December / 2021, 15:50:12 by Caefix »
All lifetime is a loan from eternity.

Re: New CHDK features
« Reply #2 on: 01 / December / 2021, 00:53:39 »
The code was compiled by me only for the SX10IS and SX100IS that I have. It is necessary to define in platform\<your_camera_model>\platform_camera.h

platform\sx10\platform_camera.h

     #define CAM_SENSOR_WIDTH 6.17f
     #define CAM_SENSOR_HEIGHT 4.55f
     #define CAM_SENSOR_DIAGONAL 7.67f

Here 1/2.3" for the SX10, these size values are in mm for a specific sensor size. For example, 1/2.5" it is like this:

platform\sx100is\ platform_camera.h

     #define CAM_SENSOR_WIDTH 5.744f
     #define CAM_SENSOR_HEIGHT 4.308f
     #define CAM_SENSOR_DIAGONAL 7.18f

I did not define these values for other camera models because I did not have such a need, unfortunately it should be defined here. These values are used for AOV and FOV calculations.

This project using second configurations system based on text file in CHDK\CCHDK4_2.CFG. This file is created automatically if not exists.
« Last Edit: 01 / December / 2021, 01:40:22 by programmer0 »

*

Offline reyalp

  • ******
  • 14082
Re: New CHDK features
« Reply #3 on: 01 / December / 2021, 01:38:45 »
Welcome, and thanks for posting. It's always nice to see someone found this stuff CHDK useful for something.

I tried to make a diff against the 1.4 source to better understand the changes, but it seems there are quite a few files were completely reformatted, which makes it a bit difficult. Our formatting is inconsistent and often bad, so reformatting is quite reasonable, but it does make diffs noisy.

One small request:
Can you put a note in the README.md that it's a personal fork, and a link to the official source (https://app.assembla.com/spaces/chdk) or the wiki? With chdkptp, I've seen a few people find random clones on github and think it's the latest.
Don't forget what the H stands for.


Re: New CHDK features
« Reply #4 on: 01 / December / 2021, 01:55:26 »
This code requires refactoring, mainly an alternative text-based configuration system. A second configuration system is used next to the basic one without interfering with the existing configuration file. For now, it is difficult to compare the changes, many code fragments are repeated, e.g. responsible for reading from text files. The adams.zn file with the Adams zone system used in false colors and the ZONES directory may not be entirely correct, the values ​​are derived from the Y-histogram and may not be accurate. False colors can come in handy when assessing exposure. I have tried to implement recognition of possible color harmonies on the RGB wheel but this will be a problem with the Zebra extension due to performance limitations. In the future I am thinking of implementing the MLP artificial neural network to intelligently adjust the exposure and colors. The auto ETTR system in AutoISO2 based on the percentage of overexposed pixels will not work in every case. I tested on landscapes and it often works there.

The include/camera.h was updated, defult sensor is 1/2.5". This is example for 1/2.3" sensor in platform_camera.h

     #undef CAM_SENSOR_WIDTH
     #undef CAM_SENSOR_HEIGHT
     #undef CAM_SENSOR_DIAGONAL
     #define CAM_SENSOR_WIDTH 6.17f
     #define CAM_SENSOR_HEIGHT 4.55f
     #define CAM_SENSOR_DIAGONAL 7.67f
« Last Edit: 01 / December / 2021, 04:05:55 by programmer0 »

*

Offline reyalp

  • ******
  • 14082
Re: New CHDK features
« Reply #5 on: 01 / December / 2021, 13:09:19 »
This code requires refactoring, mainly an alternative text-based configuration system. A second configuration system is used next to the basic one without interfering with the existing configuration file.
Yes, saw that. If this were to be merged in the the main CHDK, I'd want to avoid having multiple config systems without a good reason.
Quote
The auto ETTR system in AutoISO2 based on the percentage of overexposed pixels will not work in every case. I tested on landscapes and it often works there.
Just FWIW 1.4 has some bugs in histogram which produce invalid data for some viewport sizes. These were fixed in 1.5 changeset 5987: https://app.assembla.com/spaces/chdk/subversion/commits/5987
Quote
The include/camera.h was updated, defult sensor is 1/2.5". This is example for 1/2.3" sensor in platform_camera.h
Hmm, might be clearer / simpler to define in terms of sensor size and aspect ratio, since there are only a few standard sizes which tend to be listed prominently, and most cams are 4:3.
Don't forget what the H stands for.

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: New CHDK features
« Reply #6 on: 01 / December / 2021, 15:43:08 »
Some compatibility limits:  :-[
Needs modernized  include/propset1-13.h AND properties.h to avoid
Quote
../../include/properties.h:28:6: error: #error unknown camera processor
     #error unknown camera processor
Code: [Select]
Ix265, Ix275,Sx610+620hs
kbd.c:26:7: error: 'KEY_WIFI' undeclared here (not in a function)
  { 2, KEY_WIFI            ,0x00000200 },
       ^
Sx620:
shooting.c:8:30: error: 'MODE_DISABLE_RAW' undeclared here (not in a function)
     { MODE_HIGHSPEED_BURST | MODE_DISABLE_RAW, 32776 },   

.lua scripts: bi.build_revision or bi.digic=nil
    if ( tonumber(bi.build_revision) or 0 > 0 ) then build = tonumber(bi.build_revision)

Just FWIW 1.4 has some bugs in histogram which produce invalid data for some viewport sizes. These were fixed in 1.5 changeset 5987: https://app.assembla.com/spaces/chdk/subversion/commits/5987
Probably the various platform/.../lib.c updates would help, too.

Free Wheel for 1.4.1  :xmas
All lifetime is a loan from eternity.

*

Offline reyalp

  • ******
  • 14082
Re: New CHDK features
« Reply #7 on: 01 / December / 2021, 15:50:04 »
Just FWIW 1.4 has some bugs in histogram which produce invalid data for some viewport sizes. These were fixed in 1.5 changeset 5987: https://app.assembla.com/spaces/chdk/subversion/commits/5987
Probably the various platform/.../lib.c updates would help, too.
FWIW, I only mentioned the histogram issue because it directly affects auto ISO. I suspect programmer0 doesn't want to backport every bugfix from 1.5 (and if they do, the most efficient approach would be to port their changes to 1.5 or 1.6 instead, IMO)
Don't forget what the H stands for.


Re: New CHDK features
« Reply #8 on: 02 / December / 2021, 00:59:43 »
I don't know in what direction the development of the official version of the CHDK will go, and I wouldn't like to follow every little change too much. I had a problem with CHDK 1.5 on SX100, RAW won't switch with Alt + ERASE. I only have two SX100IS and SX10IS cameras and I don't know what will happen on the other models. Don't take it at least for now that I would like to include it in the official version. The design is quite complicated and it is quite difficult.

An alternate configuration system was implemented because I didn't want to mess with the current system for backwards compatibility. Generally, after installing the official version of CHDK, if you then just overwrite the binary files from the compiled fork, everything should continue to work, but based on the features of version 1.4.1 with additional features.

In Auto ETTR, i.e. in AutoISO2, as well as in waveform or false colors, I use YUV411 from the display buffer. I mean more about how the number of overexposed pixels translates into automatic compensation, i.e. -0.33EV, -0.67EV, -1.00EV, -1.33EV, -1.67EV and -2.00EV. The code snippet I mean. Visualization threshold settings and percentage of pixels in AutoISO2 settings are taken.

Code: [Select]
int calculate_ev_auto(int range, int threshold, int yover, int ev_bias)
{
    if ((threshold < 3) || (yover == 0))
    {
        return 0;
    }

    int i, j;
    int levels[4][2];
    levels[0][0] = 0;
    levels[0][1] = 0;

    int partial_threshold = threshold / 3;
    int partial_ev = yover % 4;

    for (i = 1; i < 4; i++)
    {
        levels[i][0] = i * partial_threshold;
        levels[i][1] = i + partial_ev;
    }

    if (range > levels[3][0])
    {
        return clip192((levels[3][1] << 5) + ev_bias);
    }

    for (j = 2; j >= 0; j--)
    {
        if ((range <= levels[j+1][0]) && (range > levels[j][0]))
        {
            return clip192((levels[j][1] << 5) + ev_bias);
        }
    }

    return 0;
}


Too early for extensions to the official CHDK version, this is quite a complex matter. I would not like someone to have problems with the fact that the camera turns off due to my possible mistakes.

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: New CHDK features
« Reply #9 on: 02 / December / 2021, 10:09:41 »
I tried to make a diff against the 1.4 source to better understand the changes, but it seems there are quite a few files were completely reformatted, which makes it a bit difficult.
Was a diff vs CHDK 1.4 possible (~#4800), just to get the touched files...?

&& That was already 1.5 (~#5163) ... :haha
https://chdk.setepontos.com/index.php?topic=13875.msg141063#msg141063
and luascript got a lot of functions
Code: [Select]
...
get_imager_active
get_nd_current_ev96
get_nd_value_ev96
get_current_av96
get_current_tv96
get_max_av96
get_min_av96
bi.digic
...
...complicating scripting.

I think, if needed, new /..../ lib.c(/sub/../lib.c), shooting.c(?), platform_palette.c, ... (?) shouldn´t disturb alternative experimentals.
(Compiler will tell...)
Because zebra.c (very informative source), md_detect, histogram,... grep values from lib.c, there seems most headroom for c/p debuggging...
All lifetime is a loan from eternity.

 

Related Topics