Instructions say (help(histmatch))
Arguments:
master: The target image, in SpatialGridDataFrame, data frame, matrix
or vector format.
tofix: The image to be normalized, in any format.
but what you have is a *raster* object, not a SpatialGridDataFrame, or
any other of those.
You can convert a raster, r, to a SpatialGridDataFrame, rg:
> rg = as(r,"SpatialGridDataFrame")
and then feed those to histmatch. You probably have to convert both arguments.
Barry
On Tue, Aug 12, 2014 at 4:45 PM, sarah crabbe <sarah_crabbe at yahoo.com> wrote:
Dear all,
We are trying to apply a histogram matching on cloudmasked landsat 8 images, with the intention to fill the clouds.
Therefore we want to use the package "Landsat"
We tried to import two bands with the package "raster":
image1<-raster("LC82280562013211LGN00_B1.tif")
image2<-raster("LC82280562013227LGN00_B1.tif")
whereafter we try to apply a histogram matching with the landsat package:
histmatch(image1, image2, minval=0, maxval= 65535, by=1)
And we get following error:
Error in as.vector(data) :
no method for coercing this S4 class to a vector
This might be easy to solve, but we just started to learn how to work with R for image processing, So could we please get some advice on this..
Many thanks
Sarah
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo