I'm trying to run a distance transform on a thresholded binary image in order to assist anomaly detection (my hope is that I can detect large changes around the edges of the object), however for some reason, upon running my Distance Transform script, I'm getting a strange banding type of effect. I tested something similar in the Distance Transform demo script in the samples directory, with the same results. One possible reason I came up with was that the distance was going beyond the 0-255 scale and therefore essentially being modulus'ed to keep it within the boundaries. Has anyone had any experience with this that could advise? I have posted images and code on my blog if that helps Thanks in advance, Ian
+1
A:
One quick way to test your theory: try with a grey scale image that's muted (all values v --> 128+(v-128)/32 or something) and see if that makes the bands much wider or eliminates them completely.
It's always a good idea to nail down what the problem is first, and then try to fix it.
MarkusQ
2009-03-08 19:14:30
Thanks, I changed the scale in a similar way to your advise and that fixed it! Somehow I missed the cvConvertScale line with a factor of 5000 - decreasing that did exactly as you suggested.
2009-03-08 20:02:44
A:
I can't help with the code, but I'd like to point out that the expected result on your blog is probably incorrect as well: look at the sharp black-gray border in the bottom part of the large object: it should not be there, as the maximum difference between two adjacent pixels should be 1.
Lale
2009-04-09 08:58:09