Browse Source

Clear up confusion between "equalisation" and "calibration"

tags/v1.8.0
Xerbo 4 years ago
parent
commit
764694582e
3 changed files with 12 additions and 11 deletions
  1. +2
    -2
      README.md
  2. +4
    -4
      image.c
  3. +6
    -5
      main.c

+ 2
- 2
README.md View File

@@ -89,7 +89,7 @@ Image names are `audiofile-x.png`, where `x` is:

Currently there are 3 available enhancements:

- `c` for contrast equalise, on by default
- `c` for calibration, on by default
- `t` for crop telemetry, on by default, only has effects on raw images
- `h` for histogram equalise, make the darkest color black and the brightest white

@@ -97,7 +97,7 @@ Currently there are 3 available enhancements:

`aptdec -d images -i ab *.wav`

This will process all `.wav` files in the current directory, generate equalised channel A and B images and put them in the `images` directory.
This will process all `.wav` files in the current directory, generate calibrated channel A and B images and put them in the `images` directory.

## Further reading



+ 4
- 4
image.c View File

@@ -83,8 +83,8 @@ void histogramEqualise(float **prow, int nrow, int offset, int width){
prow[y][x+offset] = (prow[y][x+offset]-min) / (max-min) * 255;
}

// Brightness equalise, including telemetry
void equalise(float **prow, int nrow, int offset, int width, int telestart, rgparam regr[30]){
// Brightness calibrate, including telemetry
void calibrateBrightness(float **prow, int nrow, int offset, int width, int telestart, rgparam regr[30]){
offset -= SYNC_WIDTH+SPC_WIDTH;

for (int n = 0; n < nrow; n++) {
@@ -126,7 +126,7 @@ void equalise(float **prow, int nrow, int offset, int width, int telestart, rgpa
}

// Get telemetry data for thermal calibration/equalization
int calibrate(float **prow, int nrow, int offset, int width, int contrastEqualise) {
int calibrate(float **prow, int nrow, int offset, int width, int calibrate) {
double teleline[3000] = { 0.0 };
double wedge[16];
rgparam regr[30];
@@ -236,7 +236,7 @@ int calibrate(float **prow, int nrow, int offset, int width, int contrastEqualis
}
nbtele = k;

if(contrastEqualise) equalise(prow, nrow, offset, width, telestart, regr);
if(calibrate) calibrateBrightness(prow, nrow, offset, width, telestart, regr);

return(channel + 1);
}


+ 6
- 5
main.c View File

@@ -224,10 +224,10 @@ static void distrib(char *filename, float **prow, int nrow) {
distrib[y][x] = distrib[y][x] / max * 255;


ImageOut(filename, "Value distribution", distrib, 256, 256, 0, NULL, 0);
ImageOut(filename, "Brightness distribution", distrib, 256, 256, 0, NULL, 0);
}

extern int calibrate(float **prow, int nrow, int offset, int width, int contrastEqualise);
extern int calibrate(float **prow, int nrow, int offset, int width, int calibrate);
extern void histogramEqualise(float **prow, int nrow, int offset, int width);
extern void temperature(float **prow, int nrow, int ch, int offset);
extern int Ngvi(float **prow, int nrow);
@@ -242,7 +242,7 @@ static void usage(void) {
printf("Aptdec [options] audio files ...\n"
"Options:\n"
" -e [c|t] Enhancements\n"
" c: Contrast equalise\n"
" c: Contrast calibration\n"
" t: Crop telemetry\n"
" h: Histogram equalise\n"
" -i [r|a|b|c|t] Output image type\n"
@@ -371,11 +371,12 @@ int main(int argc, char **argv) {
ImageOut(pngfilename, "Temperature", prow, nrow, CH_WIDTH, CHB_OFFSET, (png_color*)TempPalette, 0);
}

// Run the contrast equalise here because the temperature calibration requires raw data
// Also layered & false color images both need brightness equalization
// Run the brightness calibration here because the temperature calibration requires raw data
// Layered & false color images both also need brightness calibration
if(CONTAINS(enchancements, 'c') || CONTAINS(enchancements, 'h') || CONTAINS(imgopt, 'l') || CONTAINS(imgopt, 'c'))
calibrate(prow, nrow, CHA_OFFSET, CH_WIDTH+TELE_WIDTH+SYNC_WIDTH+SPC_WIDTH+CH_WIDTH, 1);

// Histogram equalise
if(CONTAINS(enchancements, 'h')){
histogramEqualise(prow, nrow, CHA_OFFSET, CH_WIDTH);
histogramEqualise(prow, nrow, CHB_OFFSET, CH_WIDTH);


Loading…
Cancel
Save