[GRASS-dev] Landsat 5TM pre-processing - histogram matching - problem
Nikos Alexandris
nik at nikosalexandris.net
Sun May 10 00:20:32 PDT 2015
* joanna mardas <joanna.mardas at wp.pl> [2015-05-10 02:28:02 +0200]:
> Hey!
> > joanna, once again, the easy "other way" is posted in my first reply, I
> > think. You just need to multiply with 1000, perform the histogram
> > matching, then divide by 1000.0 to get back to floats.
>
> So I did that: int(oldmap*1000), then i.histo.match (band to band). I did also r.recode (oldlow:oldhigh:0:255), and then i.histo.match (band to band). Histograms in the middle (results of int(oldmap*1000) and i.hist.match) look strange and the images have "holes"-places with no data, totally transparent. After r.recode there are no places with no data or there are 1 or 2 very small (max 5 pixels). I don't know why it is like that. So I will either do the classification after r.recode and
> i.histo.match or without r.recode and i.histo.match.
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!
> BTW, does classification work with both float and integer?
> Joanna
I think so. Check the manuals.
Best of success, Nikos
More information about the grass-dev
mailing list