Issues.00121 - lordmundi/wikidoctest GitHub Wiki
00121: DSF_GetMapData() may be returning grey when it shouldn't
Summary: DSF_GetMapData() may be returning grey when it shouldn't
Created: 2008–11–10 09:29
Status: Submitted
Category: Bug
From: frankie
Version: 2.0
Released_In:
Description:
When loading up some higher resolution imagery, the DSF_GetMapData() call is supposed to pre-populate the request buffer with the existing imagery. It seems like, for areas where I had partial tiles of valid data, the remaining areas were showing up grey instead of showing the lower detail imagery.
I'm not positive about this, but I want to document it before I forget. More testing is needed.
I don't think the grey color is coming from my source imagery since I had a filter in to try and detect grey pixels and not load them, but it is possible that it having some sort of unanticipated consequence. My filter code is below for peer review:
DSF_GetMapData();
for( pcol = imgdata, lat = pmap_info->max_lat, i = 0; i < pmap_info->h; i++, lat -= dlat )
{
for( lon = pmap_info->min_log, j = 0; j < pmap_info->w; j++, lon += dlon, pcol += 3 )
{
/* Calculate the amount of downsampling required and get pixel value */
e1 = GetDataSample( lat, lon, (dist/pinfo->adfGeoTransform[1]), &col, pinfo );
if(e1 != pinfo->nodata)
{
/* FG ++ Add in some manual checks to throw out dark or grey-scale imagery */
#define COLOR_IS_CLOSE_TO_GREY ((abs(col.r - col.g) < 2) && (abs(col.g - col.b) < 2))
#define COLOR_IS_CLOSE_TO_BLACK (V_COLOR_MAG(col) < 2)
if ( COLOR_IS_CLOSE_TO_GREY || COLOR_IS_CLOSE_TO_BLACK ) {
/* Do nothing... discard the pixel */
//fprintf(stderr, "+++ %d %d %d\n", col.r, col.g, col.b);
} else {
/* FG -- */
got_data = 1;
//fprintf(stderr, "Loading new data!!!!\n");
pcol[0] = col.r;
pcol[1] = col.g;
pcol[2] = col.b;
}
}
}
}