I have some small (typically about 60x60 orless) BGR images for which I’m generating polar projections using OpenCV’s warpPolar. Most of the time it works fine, but occasionally I get an image (from that same camera source as the images that worked OK) that has a scattering of artifacts within it. Three different interpolation methods all produce artifacts. I did find that increasing the maxradius eliminates the artifacts for this image, but it adds artifacts for the others! Can anyone help me prevent those artifacts? I’ve noticed that it’s sensitive to the maxRadius parameter. Changing that by a bit can make it better or worse, but it’s unclear as to how to pick a good value. I’ve also tried using the max(image.cols,image.rows), but that does guarantee the results either.
Here is code representative of the call to warpPolar:
Mat m = imread( "image.png", IMREAD_COLOR);
Moments mom = moments( m);
int len = //... semi-major axis*2 for ellipse fit
warpPolar( m, polar, Size(), Point( mom.m10/mom.m00, mom.m01/mom.m00) , len, INTER_LINEAR);
Here is a resulting polar image that has a rainbow of artifacts about a quarter of the way down and an extra band of grayish at the bottom, using NEAREST: