I don't know Python, so keep that in mind in interpreting these comments. On Monday, March 17, 2014 08:27:53 AM Siddha Ganju wrote: > I am trying to perform resize using Nearest Neighbour distance and then > using Grid.jl interpolate the new image. > > In Python I would do: > > [1]val = img.getPixel(col/scale_y, row/scale_x) > [2]newImage.setPixel(col,row,val) > > So this snippet of code in Julia would be: > > convert(Array, img)
Use A = data(img), not convert. convert might transpose the underlying data array. See the documentation about "Matlab compatibility". > [1]val = Array(col/scale_y, row/scale_x) > > How do I set each pixel value for a new image data array, corresponding to > [2]? Then I can convert this data array into an image using > convert(new_img, new_img_data). Follow the example in the README in Grid.jl. Specifically, define an InterpGrid from A and then access elements with something like Ai[i/scale_i, j/scale_j]. --Tim
