I need to get subpixel (interpolated) values to convert a image from polar coordinates to cartesian:
-> See the attached image.
Angular resolution: 1 degree
Rmax = 610
Rmin = 10
SizeX: Rmax - Rmin = 610 - 10 = 600
SizeY: (full circle)/(ang resol) = 360/1 = 360 lines
I need to convert from (x,y) to -> (teta,r)
1. Calculate the x, y position:
Loop teta from 0 to SizeY (number of lines)
Loop r from Rmin to Rmax (number of columns)
x = CenterX + rcos(teta);
y = CenterY - rsin(teta);
2. Get the interpolated pixel
From the CUDA Programming guide:
tex(x, y) = (1âˆ’Î± )(1âˆ’ Î² )T[i, j] +Î± (1âˆ’ Î² )T[i +1, j] + (1âˆ’Î± )Î²T[i, j +1] +Î±Î²T[i +1, j +1]
but x,y can have only 1 decimal precision (1.0). How can I get more?
My first try was to make a table with all the weights (Î±Î²…) already calculated and the coordinates used from the input image to make the output image. But this structure was too large so my kernel was slow.
Another try is is to use shared memory, but I would get a lot of conflicts since every pixel of the output need 4 pixels from the input neighborhood. More than one thread will need to get the same pixel value.
Textures can make it for me, but the coordinate resolution is only 1/10 pixel resolution. eg: [1.5,4.8] and I need [1.52,4.86]
Anybody can help?