bettor
Electrical
- Aug 7, 2002
- 1
Hi
I have a 152x149 bitmap that I'm trying to map to a log-polar grid. To do this, first I calculate a cartesian grid for the image (ie figure out the cartesian coordinates for each pixel given one pixel chosen as the origin). Then I use cart2pol to get the polar matrices r and Th (theta, the angle) and take the log of the radial distance
r. I then use 2 vectors ro and theta that represent the evenly spaced log-polar grid that I want to interpolate to. This allows me to use griddata(th, r,image, theta',ro) to get my data points. However some NaNs always appear when I do this. I think it may be because I use the smallest circle containing the bitmap to set the range of my log-polar axes and thus extra data points are added which forces griddata to extrapolate as well as interpolate. Is this really the source of the error and is there a way to get around this and get rid of those NaNs? Should I be using another function instead of griddata?
Thanks for you help
I have a 152x149 bitmap that I'm trying to map to a log-polar grid. To do this, first I calculate a cartesian grid for the image (ie figure out the cartesian coordinates for each pixel given one pixel chosen as the origin). Then I use cart2pol to get the polar matrices r and Th (theta, the angle) and take the log of the radial distance
r. I then use 2 vectors ro and theta that represent the evenly spaced log-polar grid that I want to interpolate to. This allows me to use griddata(th, r,image, theta',ro) to get my data points. However some NaNs always appear when I do this. I think it may be because I use the smallest circle containing the bitmap to set the range of my log-polar axes and thus extra data points are added which forces griddata to extrapolate as well as interpolate. Is this really the source of the error and is there a way to get around this and get rid of those NaNs? Should I be using another function instead of griddata?
Thanks for you help