From 2213e46ddf25437c57aa4f91f2f2efcb1de5fa4b Mon Sep 17 00:00:00 2001 From: Xerbo Date: Thu, 27 Aug 2020 19:23:17 +0100 Subject: [PATCH] Stack image types as much as you want Create a copy of the image before modifying it for temperature calibration --- README.md | 3 +-- src/main.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 04a2bce..ddff175 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ Apply a falsecolor palette ### Arguments ``` --i [r|a|b|t|m|p] Output type (stackable*) +-i [r|a|b|t|m|p] Output type (stackable) -e [t|h|l|d|p|f] Effects (stackable) -o Output filename -d Destination directory @@ -73,7 +73,6 @@ Apply a falsecolor palette -g Gamma adjustment (1.0 = off) -k Map offset (in px, default: 0) ``` -\* Should work with all combinations, but temperature needs to be done last as it calibrates the buffer ### Image output types diff --git a/src/main.c b/src/main.c index f5b5452..11d6f29 100644 --- a/src/main.c +++ b/src/main.c @@ -227,8 +227,16 @@ static int processAudio(char *filename, options_t *opts){ // Temperature if (CONTAINS(opts->type, Temperature) && img.chB >= 4) { - temperature(opts, &img, CHB_OFFSET, CH_WIDTH); - ImageOut(opts, &img, CHB_OFFSET, CH_WIDTH, "Temperature", Temperature, (char *)TempPalette); + // Create another buffer as to not modify the orignal + image_t tmpimg = img; + for(int i = 0; i < img.nrow; i++){ + tmpimg.prow[i] = (float *) malloc(sizeof(float) * 2150); + memcpy(tmpimg.prow[i], img.prow[i], sizeof(float) * 2150); + } + + // Perform temperature calibration + temperature(opts, &tmpimg, CHB_OFFSET, CH_WIDTH); + ImageOut(opts, &tmpimg, CHB_OFFSET, CH_WIDTH, "Temperature", Temperature, (char *)TempPalette); } // MCIR