@@ -8,7 +8,7 @@ OBJS= main.o image.o dsp.o filter.o reg.o fcolor.o | |||||
atpdec: $(OBJS) | atpdec: $(OBJS) | ||||
$(CC) -o $@ $(OBJS) -lm -lsndfile -lpng | $(CC) -o $@ $(OBJS) -lm -lsndfile -lpng | ||||
main.o: main.c version.h temppalette.h offsets.h | |||||
main.o: main.c version.h temppalette.h gvipalette.h offsets.h | |||||
dsp.o: dsp.c filtercoeff.h filter.h | dsp.o: dsp.c filtercoeff.h filter.h | ||||
filter.o: filter.c filter.h | filter.o: filter.c filter.h | ||||
image.o: image.c satcal.h offsets.h | image.o: image.c satcal.h offsets.h | ||||
@@ -70,7 +70,7 @@ static struct { | |||||
hsvpix_t GroundTop; | hsvpix_t GroundTop; | ||||
hsvpix_t GroundBot; | hsvpix_t GroundBot; | ||||
} fcinfo = { | } fcinfo = { | ||||
30.0, 90.0, 100.0, { | |||||
30.0, 90.0, 155.0, { | |||||
230, 0.2, 0.3}, { | 230, 0.2, 0.3}, { | ||||
230, 0.0, 1.0}, { | 230, 0.0, 1.0}, { | ||||
200.0, 0.7, 0.6}, { | 200.0, 0.7, 0.6}, { | ||||
@@ -112,25 +112,25 @@ void falsecolor(double v, double t, float *r, float *g, float *b) | |||||
hsvpix_t top, bot, c; | hsvpix_t top, bot, c; | ||||
double scv, sct; | double scv, sct; | ||||
if (t < fcinfo.Tthresold) { | |||||
if (t > fcinfo.Tthresold) { | |||||
if (v < fcinfo.Seathresold) { | if (v < fcinfo.Seathresold) { | ||||
/* sea */ | /* sea */ | ||||
top = fcinfo.SeaTop, bot = fcinfo.SeaBot; | top = fcinfo.SeaTop, bot = fcinfo.SeaBot; | ||||
scv = v / fcinfo.Seathresold; | scv = v / fcinfo.Seathresold; | ||||
sct = t / fcinfo.Tthresold; | |||||
sct = (256.0-t) / (256.0-fcinfo.Tthresold); | |||||
} else { | } else { | ||||
/* ground */ | /* ground */ | ||||
top = fcinfo.GroundTop, bot = fcinfo.GroundBot; | top = fcinfo.GroundTop, bot = fcinfo.GroundBot; | ||||
scv = | scv = | ||||
(v - fcinfo.Seathresold) / (fcinfo.Landthresold - | (v - fcinfo.Seathresold) / (fcinfo.Landthresold - | ||||
fcinfo.Seathresold); | fcinfo.Seathresold); | ||||
sct = t / fcinfo.Tthresold; | |||||
sct = (256.0-t) / (256.0-fcinfo.Tthresold); | |||||
} | } | ||||
} else { | } else { | ||||
/* clouds */ | /* clouds */ | ||||
top = fcinfo.CloudTop, bot = fcinfo.CloudBot; | top = fcinfo.CloudTop, bot = fcinfo.CloudBot; | ||||
scv = v / 255.0; | |||||
sct = t / 255.0; | |||||
scv = v / 256.0; | |||||
sct = (256.0-t) / 256.0; | |||||
} | } | ||||
c.s = top.s + sct * (bot.s - top.s); | c.s = top.s + sct * (bot.s - top.s); | ||||
@@ -140,11 +140,11 @@ void falsecolor(double v, double t, float *r, float *g, float *b) | |||||
HSVtoRGB(r, g, b, c); | HSVtoRGB(r, g, b, c); | ||||
}; | }; | ||||
void Ngiv(float **prow, int nrow) | |||||
void Ngvi(float **prow, int nrow) | |||||
{ | { | ||||
int n; | int n; | ||||
printf("Vegetation ... "); | |||||
printf("GVI ... "); | |||||
fflush(stdout); | fflush(stdout); | ||||
for (n = 0; n < nrow; n++) { | for (n = 0; n < nrow; n++) { | ||||
@@ -154,9 +154,11 @@ void Ngiv(float **prow, int nrow) | |||||
pixelv = prow[n]; | pixelv = prow[n]; | ||||
for (i = 0; i < CH_WIDTH; i++) { | for (i = 0; i < CH_WIDTH; i++) { | ||||
float pv; | float pv; | ||||
double gvi; | |||||
pv = (pixelv[i + CHA_OFFSET]-pixelv[i + CHB_OFFSET])/(pixelv[i + CHA_OFFSET]+pixelv[i + CHB_OFFSET])*128.0+128.0; | |||||
gvi = (pixelv[i + CHA_OFFSET]-pixelv[i + CHB_OFFSET])/(pixelv[i + CHA_OFFSET]+pixelv[i + CHB_OFFSET]); | |||||
pv = (gvi+0.1)*340.0; | |||||
if (pv > 255.0) | if (pv > 255.0) | ||||
pv = 255.0; | pv = 255.0; | ||||
if (pv < 0.0) | if (pv < 0.0) | ||||
@@ -22,19 +22,23 @@ | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | |||||
#ifdef WIN32 | #ifdef WIN32 | ||||
#include "w32util.h" | #include "w32util.h" | ||||
#else | #else | ||||
#include <libgen.h> | #include <libgen.h> | ||||
#endif | #endif | ||||
#include <string.h> | |||||
#include <sndfile.h> | #include <sndfile.h> | ||||
#include <png.h> | #include <png.h> | ||||
#include "version.h" | #include "version.h" | ||||
#include "temppalette.h" | |||||
#include "offsets.h" | #include "offsets.h" | ||||
#include "temppalette.h" | |||||
#include "gvipalette.h" | |||||
extern int getpixelrow(float *pixelv); | extern int getpixelrow(float *pixelv); | ||||
extern int init_dsp(double F);; | extern int init_dsp(double F);; | ||||
@@ -271,7 +275,7 @@ fclose(df); | |||||
extern int Calibrate(float **prow, int nrow, int offset); | extern int Calibrate(float **prow, int nrow, int offset); | ||||
extern void Temperature(float **prow, int nrow, int ch, int offset); | extern void Temperature(float **prow, int nrow, int ch, int offset); | ||||
extern int Ngiv(float **prow, int nrow); | |||||
extern int Ngvi(float **prow, int nrow); | |||||
extern void readfconf(char *file); | extern void readfconf(char *file); | ||||
extern int optind, opterr; | extern int optind, opterr; | ||||
extern char *optarg; | extern char *optarg; | ||||
@@ -408,11 +412,11 @@ int main(int argc, char **argv) | |||||
ImageRGBOut(pngfilename, prow, nrow); | ImageRGBOut(pngfilename, prow, nrow); | ||||
} | } | ||||
/* vegetation image */ | |||||
/* GVI image */ | |||||
if (chA==1 && chB==2 && strchr(imgopt, (int) 'c') != NULL) { | if (chA==1 && chB==2 && strchr(imgopt, (int) 'c') != NULL) { | ||||
Ngiv(prow, nrow); | |||||
Ngvi(prow, nrow); | |||||
sprintf(pngfilename, "%s/%s-c.png", pngdirname, name); | sprintf(pngfilename, "%s/%s-c.png", pngdirname, name); | ||||
ImageOut(pngfilename, "Vegetation", prow, nrow, CH_WIDTH, CHB_OFFSET, (png_color*)TempPalette); | |||||
ImageOut(pngfilename, "GVI", prow, nrow, CH_WIDTH, CHB_OFFSET, (png_color*)GviPalette); | |||||
} | } | ||||
} | } | ||||
exit(0); | exit(0); | ||||