浏览代码

Fix falsecolor

tags/v1.8.0
Xerbo 4 年前
父节点
当前提交
fb8dfc3de3
共有 2 个文件被更改,包括 15 次插入9 次删除
  1. +3
    -3
      fcolor.c
  2. +12
    -6
      pngio.c

+ 3
- 3
fcolor.c 查看文件

@@ -65,16 +65,16 @@ int readfcconf(char *file) {
return 1;
};

rgb_t falsecolor(float vis, float temp, float *r, float *g, float *b){
rgb_t falsecolor(float vis, float temp){
rgb_t buffer;
float land = 0, sea, cloud;
float land = 0.0, sea, cloud;

// Calculate intensity of sea
sea = CLIP(vis+fcinfo.Seaoffset, 0, fcinfo.Seaintensity)/fcinfo.Seaintensity;

// Land
if(vis > fcinfo.Landthreshold)
land = CLIP(vis+fcinfo.Landoffset, 0, fcinfo.Landintensity)/fcinfo.Landintensity;
land = CLIP(vis-fcinfo.Landoffset, 0, fcinfo.Landintensity)/fcinfo.Landintensity;
// Composite land on sea
buffer = RGBcomposite(fcinfo.Land, land, fcinfo.Sea, sea);


+ 12
- 6
pngio.c 查看文件

@@ -288,20 +288,26 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c
return 0;
}

//extern void falsecolor(float vis, float temp, float *r, float *g, float *b);

printf("Writing %s", outName);

int fcimage = strcmp(chid, "False Color") == 0;
extern rgb_t falsecolor(float vis, float temp);
int fcimage = strcmp(desc, "False Color") == 0;

// Build RGB image
for (int y = 0; y < img->nrow; y++) {
png_color pix[width];

for (int x = 0; x < width; x++) {
pix[x].red = (int)crow[y][x + offset].r;
pix[x].green = (int)crow[y][x + offset].g;
pix[x].blue = (int)crow[y][x + offset].b;
if(fcimage){
rgb_t pixel = falsecolor(img->prow[y][x + CHA_OFFSET], img->prow[y][x + CHB_OFFSET]);
pix[x].red = pixel.r;
pix[x].green = pixel.g;
pix[x].blue = pixel.b;
}else{
pix[x].red = (int)crow[y][x + offset].r;
pix[x].green = (int)crow[y][x + offset].g;
pix[x].blue = (int)crow[y][x + offset].b;
}
}
png_write_row(png_ptr, (png_bytep) pix);


正在加载...
取消
保存