algo

is there any algo built in java to scale up or down a 2D matrix.....
[75 byte] By [piyushagrawala] at [2007-9-28 4:52:12]
# 1
Please specify what you mean by scaling. I am not sure what you mean. Do you want to add more elements to matrix or do you want to scale matrix in mathematical terms?Tuukka
turri69_fia at 2007-7-8 0:25:36 > top of Java-index,Other Topics,Algorithms...
# 2
i have a 2D matrix representing the image..so just like image scaling..i want to scale the matrix of that image...
piyushagrawala at 2007-7-8 0:25:36 > top of Java-index,Other Topics,Algorithms...
# 3

Image has method getScaledInstance that can be used to scale images. Could you use this to accomplish what you are trying to do?

Image img = createImage(new MemoryImageSource(w, h, pix, 0, w))

w - the width of the rectangle of pixels

h - the height of the rectangle of pixels

pix - an array of pixels

off - the offset into the array of where to store the first pixel

scan - the distance from one row of pixels to the next in the array

More info can be found at: http://java.sun.com/j2se/1.4/docs/api/java/awt/image/MemoryImageSource.html

hope this helps you

Tuukka

turri69_fia at 2007-7-8 0:25:36 > top of Java-index,Other Topics,Algorithms...
# 4
http://forum.java.sun.com/thread.jsp?thread=335929&forum=54&message=1374342
tsitha at 2007-7-8 0:25:36 > top of Java-index,Other Topics,Algorithms...