Sfoglia il codice sorgente

add gvi colormap

tags/v1.8.0
Thierry Leconte 19 anni fa
parent
commit
05e9507e14
3 ha cambiato i file con 22 aggiunte e 16 eliminazioni
  1. +1
    -1
      Makefile
  2. +11
    -9
      fcolor.c
  3. +10
    -6
      main.c

+ 1
- 1
Makefile Vedi File

@@ -8,7 +8,7 @@ OBJS= main.o image.o dsp.o filter.o reg.o fcolor.o
atpdec: $(OBJS)
$(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
filter.o: filter.c filter.h
image.o: image.c satcal.h offsets.h


+ 11
- 9
fcolor.c Vedi File

@@ -70,7 +70,7 @@ static struct {
hsvpix_t GroundTop;
hsvpix_t GroundBot;
} fcinfo = {
30.0, 90.0, 100.0, {
30.0, 90.0, 155.0, {
230, 0.2, 0.3}, {
230, 0.0, 1.0}, {
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;
double scv, sct;

if (t < fcinfo.Tthresold) {
if (t > fcinfo.Tthresold) {
if (v < fcinfo.Seathresold) {
/* sea */
top = fcinfo.SeaTop, bot = fcinfo.SeaBot;
scv = v / fcinfo.Seathresold;
sct = t / fcinfo.Tthresold;
sct = (256.0-t) / (256.0-fcinfo.Tthresold);
} else {
/* ground */
top = fcinfo.GroundTop, bot = fcinfo.GroundBot;
scv =
(v - fcinfo.Seathresold) / (fcinfo.Landthresold -
fcinfo.Seathresold);
sct = t / fcinfo.Tthresold;
sct = (256.0-t) / (256.0-fcinfo.Tthresold);
}
} else {
/* clouds */
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);
@@ -140,11 +140,11 @@ void falsecolor(double v, double t, float *r, float *g, float *b)
HSVtoRGB(r, g, b, c);
};

void Ngiv(float **prow, int nrow)
void Ngvi(float **prow, int nrow)
{
int n;

printf("Vegetation ... ");
printf("GVI ... ");
fflush(stdout);

for (n = 0; n < nrow; n++) {
@@ -154,9 +154,11 @@ void Ngiv(float **prow, int nrow)
pixelv = prow[n];
for (i = 0; i < CH_WIDTH; i++) {
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)
pv = 255.0;
if (pv < 0.0)


+ 10
- 6
main.c Vedi File

@@ -22,19 +22,23 @@

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#ifdef WIN32
#include "w32util.h"
#else
#include <libgen.h>
#endif
#include <string.h>
#include <sndfile.h>
#include <png.h>

#include "version.h"
#include "temppalette.h"
#include "offsets.h"

#include "temppalette.h"
#include "gvipalette.h"

extern int getpixelrow(float *pixelv);
extern int init_dsp(double F);;

@@ -271,7 +275,7 @@ fclose(df);

extern int Calibrate(float **prow, int nrow, 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 int optind, opterr;
extern char *optarg;
@@ -408,11 +412,11 @@ int main(int argc, char **argv)
ImageRGBOut(pngfilename, prow, nrow);
}

/* vegetation image */
/* GVI image */
if (chA==1 && chB==2 && strchr(imgopt, (int) 'c') != NULL) {
Ngiv(prow, nrow);
Ngvi(prow, nrow);
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);


Caricamento…
Annulla
Salva