Larry Serflaten
12/21/2004 9:14:00 PM
"Craig Parsons" <info@ycpexchange.com> wrote
> Folks,
>
> I have an image of a circle, which I am trying to straighten out into a
> flat line. I am essentially wanting to look at the image, and read a
> straight line from the centre, and then plot this on a graph. Then I want
> to rotate the image 1 degree and read the next line down, if you see what I
> mean.
I've seen this same post for several days now, have you made no progress?
If I had to do it, and assuming the data points are distinguishable from the
background chart (ex. differnt color) I would simply locate the center of the
circle (you may know it, or you can average all the data points) and start sweeping
the chart, (like a clock's second hand).
At each incremental tick, find how far the data point that intersects with the
sweep arm is from the center, and plot that value to your chart. To find the
data point, start at the center and test the pixels stretching outward from the
center point along the sweep arm. When you find a data pixel, use its distance
from the center point as input to your chart.
With one radius of the circle done, increment the sweep arm some small
amount and again test the pixels along the length of the sweep arm to find
the data point. When you sweep the entire circle, you're done....
(Imagine a weather radar updating its display; the sweep arm rotates around
in a circle, updating the image as it goes. Instead of adding data to the image,
you want to find what is already out there.)
You could add a few optimizations depending on the data you expect to find,
like start with larger increment values for one pass and do a second pass for
the middle of only those adjacent points where the difference is above a
certain value. And, again, depending on the data you expect, if you know
the distance of a data point on one increment, you can assume the distance
for the next sweep increment will be within a certain range, avoiding tests
for the entire length of the sweep arm. (etc...)
HTH
LFS