[R] Increasing the resolution of a raster

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Tue Mar 23 21:15:26 CET 2021


Hi Javad,
You may be trying to reinvent the wheel. Have you looked at Image Magick?

Jim

On Tue, Mar 23, 2021 at 11:42 PM javad bayat <j.bayat194 using gmail.com> wrote:
>
> Dear R users;
> Is there any way to increase the resolution of a raster so as to be seen
> more clear?
> I have a raster which is not very clear. I want to read it in R and get its
> values and increase the resolution to be seen clearly.
> please help me to do this.
> I have tried using the following codes, but did not work.
>
> bayat <- raster("./Bayat.jpg")
> bayat
> class      : RasterLayer
> band       : 1  (of  3  bands)
> dimensions : 1181, 827, 976687  (nrow, ncol, ncell)
> resolution : 1, 1  (x, y)
> extent     : 0, 827, 0, 1181  (xmin, xmax, ymin, ymax)
> crs        : NA
> source     : E:/New/Bayat.jpg
> names      : Bayat
> values     : 0, 255  (min, max)
>
> bayat2 <- bayat
> bayat_value = data.frame(xyFromCell(bayat2, 1:ncell(bayat2)))
> valu <- getValues(bayat2)
> i <- !is.na(valu)
> bayat_value <- bayat_value[i,]
> valu <- valu[i]
> library(fields)
> gc()
> tps <- Tps(bayat_value, valu)
> bayat3 <- raster(bayat)
> bayat3 <- interpolate(bayat3, tps)
> bayat3 <- mask(bayat3, bayat)
> plot(bayat3)
>
>
>
> Sincerely
>
>
>
> --
> Best Regards
> Javad Bayat
> M.Sc. Environment Engineering
> Alternative Mail: bayat194 using yahoo.com
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list