[R] changing image dimensions

Duncan Murdoch murdoch at stats.uwo.ca
Tue Nov 7 13:09:54 CET 2006


On 11/7/2006 6:57 AM, Milton Cezar Ribeiro wrote:
> Hi there,
>    
>   I have some 1024x1024 binary images (as matrix), and I need change the dimensions to 1280x1280. 
>    
>   Any idea?

I'd get an external program to do it (e.g. ImageMagick) rather than 
reinventing.  But if I had to reinvent, I'd do it by creating a function 
to interpolate [0,1] x [0,1] values from within the original image, and 
evaluate that function at the appropriate spots within the bigger one.

Choosing which kind of interpolation could be tricky, especially if the 
image is in colour:  that's why I'd suggest using someone else's work.

Duncan Murdoch



More information about the R-help mailing list