View Issue Details

IDProjectCategoryView StatusLast Update
0001905CCdcielGeneralpublic18-02-24 13:53
Reporterhan Assigned ToPatrick Chevalley  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionfixed 
Target Version1.0 
Summary0001905: Adjustable gamma function for displaying FITS files
DescriptionThe current possibilities work fine, but I miss some flexibility. Sqrt is equivalent to a fixed gamma value of 0.5. Suggest to allow all gamma values. The Log option could removed.
See:
https://en.wikipedia.org/wiki/Gamma_correction

Calculating gamma is a CPU intensive operation which could slowdown the display, so for my viewer ASTAP, I have solved it by array filled with power values. This array is filled during the formshow or when the gamma value is changed. This doesn’t slow down the display by calculating the power for 6m or 10m pixel values.

Display could be a Tcombobox with fixed values or manual entry.

One possible solution:
var
   gamma_c : array[0..32768] of single; {prepared power values for gamma correction}
....

   if gamma_on then
          begin
            col_r:=round(255*gamma_c[trunc(32768*colrr)]);{sqrt is equivalent to gamma=0.5}
            col_g:=round(255*gamma_c[trunc(32768*colgg)]);
            col_b:=round(255*gamma_c[trunc(32768*colbb)]);
          end
.....
{gamma2change is called from form show or change in gamma settings}
procedure Tmainwindow.gamma2Change(Sender: TObject);
var
  i: integer;
  gamma: single;
begin
  gamma:=strtofloat2(gamma2.Text);
  for i:=0 to 32768 do gamma_c[i]:=power(i/32768.0, gamma);
end;

 
TagsNo tags attached.

Activities

han

18-02-22 23:09

reporter  

gamma menu.png (3,781 bytes)   
gamma menu.png (3,781 bytes)   

Patrick Chevalley

18-02-23 09:20

administrator   ~0004483

This look very useful, I look to replace the 3 buttons by a gamma slider.

At the moment my stretching function is still compatible with 256 color screen support I do 20 years ago for the webcam, it's time for a refresh.

Patrick Chevalley

18-02-23 23:52

administrator   ~0004487

This is done in revision 824, finally I use a spinedit because the slider was too small.
This work fine and with the saved space I add two buttons for histogram truncation at 96% and 98%.

https://sourceforge.net/p/ccdciel/code/824/

han

18-02-24 11:40

reporter   ~0004491

Works great, the 98% is more appropriate for my images then 95%. But:

- If compiled with all checks=off, program crashes if I do the following. Select 98%, spinedit a few times quickly up or down => crash. If you do it slowly there seems to be no problem.
- Minor thing is that the 98% or 95% settings are not remembered during startup. Would be nice if they stay as selected by the user. Without these settings my images are displayed almost black. I have to click on the 98% every time when I start the program.


ps cosmetic tweak in cu_fits, use img_height rather then img_width in line 7380:
    old 7380: // scale_factor:=img_width*0.25/median_worst;
  new 7380: scale_factor:=img_height*0.33/median_worst;

Patrick Chevalley

18-02-24 13:53

administrator   ~0004492

I can reproduce the crash as a stack overflow if the spinedit is clicked very rapidly and call many image redraw at the same time.
This is fixed by adding a timer to skip the unnecessary intermediate redraw.
https://sourceforge.net/p/ccdciel/code/829/

Now it save the clipping setting.
https://sourceforge.net/p/ccdciel/code/830/

And change the image measurement function:
https://sourceforge.net/p/ccdciel/code/831/

Issue History

Date Modified Username Field Change
18-02-22 23:09 han New Issue
18-02-22 23:09 han File Added: gamma menu.png
18-02-23 09:20 Patrick Chevalley Assigned To => Patrick Chevalley
18-02-23 09:20 Patrick Chevalley Status new => assigned
18-02-23 09:20 Patrick Chevalley Target Version => 1.0
18-02-23 09:20 Patrick Chevalley Note Added: 0004483
18-02-23 23:52 Patrick Chevalley Status assigned => resolved
18-02-23 23:52 Patrick Chevalley Resolution open => fixed
18-02-23 23:52 Patrick Chevalley Note Added: 0004487
18-02-24 11:40 han Status resolved => new
18-02-24 11:40 han Resolution fixed => reopened
18-02-24 11:40 han Note Added: 0004491
18-02-24 13:53 Patrick Chevalley Status new => resolved
18-02-24 13:53 Patrick Chevalley Resolution reopened => fixed
18-02-24 13:53 Patrick Chevalley Note Added: 0004492