Hi,
I have a curved image and I want to measure the length of this
curved image. Can I do this without straightening it out ?
If not, then how to straighten the image? For example, given a curved
image like a "S", how to straighten it out to form a vertical line ?
Is there any image processing software/library/code for this ? I found
a few, but all require the user to manually select the points/nodes
along which the image is to be straightened.
Any help is appreciated. Thanks.
Andrew Thompson - 15 Nov 2007 17:53 GMT
...
>Is there any image processing software/library/code for this ?
'Wetware' springs to mind.
>..I found
>a few, but all require the user to manually select the points/nodes
>along which the image is to be straightened.
Open source? Freeware? Would you like an AI with that?

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Andrew Thompson - 15 Nov 2007 18:02 GMT
...
> Any help is appreciated. ..
Possibly almost as much as people who refrain from
multi-posting. Please refrain from multi-posting,
in future.
(X-post to c.l.j.p./h., w/ f-u to c.l.j.p. only)
--
Andrew T.
Lasse Reichstein Nielsen - 15 Nov 2007 19:46 GMT
> I have a curved image and I want to measure the length of this
> curved image. Can I do this without straightening it out ?
Length in pixels? How do you *define* the length of a "curve" of pixels?
How do you define "curve", even?
> If not, then how to straighten the image? For example, given a curved
> image like a "S", how to straighten it out to form a vertical line ?
Here you go:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Scale to fit :)
If you can straighten it to a vertical line, then you already know the
length.
> Is there any image processing software/library/code for this ? I found
> a few, but all require the user to manually select the points/nodes
> along which the image is to be straightened.
Try searching for "edge detection". The first thing you need is to
find the pixels that comprise the curve. When you have those, you'll
have to define how length is measured.
/L

Signature
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Owen Jacobson - 15 Nov 2007 21:07 GMT
> > I have a curved image and I want to measure the length of this
> > curved image. Can I do this without straightening it out ?
[quoted text clipped - 19 lines]
> find the pixels that comprise the curve. When you have those, you'll
> have to define how length is measured.
One approach might be to use the points to concoct a parametric
function defining a curve of best fit. Once you have a description of
a curve (note that it's not "the" curve, just "a" curve) that fits the
points, you can take its length a number of ways.
Implementation left as an exercise. ;)
Michael Jung - 19 Nov 2007 21:26 GMT
>> > I have a curved image and I want to measure the length of this
>> > curved image. Can I do this without straightening it out ?
[quoted text clipped - 25 lines]
> points, you can take its length a number of ways.
> Implementation left as an exercise. ;)
I'd count the number of pixels, if the "curve" is given as a
collection of pixels. (For the advanced: take anti-aliasing into
account by considering gray values as partial pixels.) Then divide by
the resolution.
If it is already given parametrized, just compute the appropriate
integral by a suitable approximation.
Michael
Jeff Higgins - 15 Nov 2007 23:11 GMT
> Hi,
>
[quoted text clipped - 9 lines]
>
> Any help is appreciated. Thanks.
Gee, thanks for posing the question. The first result of a web search
produced a link to Straighten Curved Objects plugin for ImageJ.
I had no idea such existed. A good bit of user interaction is involved
so probably will not be much good for batch straightening.
<http://rsb.info.nih.gov/ij/plugins/straighten.html>
Maybe java.awt.Shape, and java.awt.geom.PathIterator will help.
Probably not for auto-finding curved shapes in an image though.
JH
Roger Lindsjö - 16 Nov 2007 11:52 GMT
> Hi,
>
[quoted text clipped - 7 lines]
> a few, but all require the user to manually select the points/nodes
> along which the image is to be straightened.
If you have some constraints such as that the image is made of lines
with a constant width, then you could just measure the area of the image.
I'm not even sure who to solve it for the general case, say you have a
figure that looks as a line 2 pixels wide and 2 pixels long how long
would it be if you straighten it? Say we label the pixels like this:
ab
cd
One solution would be 2 pixels if it is a line 2 pixels wide, the line
goes left to right from (ac) to (bd). Another could be 4 pixels if the
line is 1 pixel wide and goes travels (a)->(b)->(d)->(c). I'm not sure
how we would measure the length if the line instead traveled
(a)->(d)->(c)->(b).
//Roger Lindsjö