Increasing the resolution of a raster

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Increasing the resolution of a raster

javad bayat
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: [hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Increasing the resolution of a raster

Jim Lemon-4
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 <[hidden email]> 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: [hidden email]
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.