[GRASS-dev] Landsat 5TM pre-processing - histogram matching - problem

joanna mardas joanna.mardas at wp.pl
Mon May 11 02:00:22 PDT 2015


Hey!
> All right :-).  Try what I posted on [2015-05-04 22:14:41]:
> 
> # if Reflectance > 1, set to 1000, else round and multiply by 1000
> r.mapcalc --o "TopoCorr_B_Trimmed_DOS1_ToCR_${Band_No}_${SCENE} = if(
> TopoCorr.B.Trimmed.DOS1.ToCR.${Band_No}@${SCENE} > 1, 1000, round( 1000
> * TopoCorr.B.Trimmed.DOS1.ToCR.${Band_No}@${SCENE} ) )"
> 
> # histogram matching
> ...
> 
> # convert histo-matched images back to floating point: rescale to 0-1.0
> r.mapcalc --o "${HistoMatchedMap} = ${HistoMatchedMap} / 1000.0"
> 
> 
> This is:
> 
> - don't use the int() function
> - just mulitply by 1000 and round, eg:
> r.mapcalc "output = if( inputmap > 1, 1000, round( 1000 * inputmap))"
> 
> - do the histogram matching
> - afterwards, divide by '1000.0'  # the dot is important!
> 
So I did all of that and there were still holes on images and spikes in the graph... so I did some "experiments" on bands 5 (the biggest holes). I've matched original bands, in result no holes in images, but spikes in the graph. I did again i.landsat.toar + this time DOS1 (cuz I thought that maybe it's the fault of DOS3), and then r.mapcalc and i.histo.match as you've said. After that, there were holes and spikes. I've checked raster statistics (for images after toar+dos and r.mapcalc) and its 
max and min values. The image's max value for landsat84 was 248 and for landsat07 346 (after toar+dos and r.mapcalc). The default value for parameter max in i.histo.match is 255, so I've changed it to 346 to see what's gonna happen. And the output images have no holes, spikes in the graphs are still present. But since there are spikes even in graphs of original landsat images, maybe the spikes are normal situation. Maybe the holes and spikes occure when the difference between max values of 
images is too big (in case of my bands 5 almost 100), after i.histo.match of r.recoded (to 0:255) images (band 4) there were no holes and no spikes - no or small differences between max values.
Greetings 
Joanna




More information about the grass-dev mailing list