Click here to Skip to main content
13,249,035 members (47,681 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have a image containing Multiple lines in different color's and this line can be overlap I need to count Number of line's from Image,
and also need to detect line area.
How could I achieve it.

With Regards
Posted 10-Apr-12 4:15am
V. 10-Apr-12 9:23am
I have no clue what you have or what you're trying to achieve. Can you elaborate?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I'd try something like that

1. Check for existing colours in the image
2. For each existing colour, Hough-transform[^] the image to get straight lines (could be tricky if colours actually are gradients)
3. You should now have some equations that represent straight lines. An equation should have two parameters. Find a formula that transforms two sets of such parameters into a distance.
4. Every pair of lines whose distance is less than a threshold (experiment for the value) are indeed segments of the same line. You could use a clustering algorithm[^].
manoj kumar choubey 11-Apr-12 2:20am
Thank you lukeer
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

the solution provider by lukeer is good, but could take a lot of work.
you can also do it with a quick pass over the image.

since those are lines, you will and not curves you can easily do this by:
1) walk the matrix of the image, this is going to be O(n^2) and for each color you find (that is not background). grab the min and max x and y coordinates, then you can get the two points of each line with these values.

now, finding "colors"
1) if the image colors are solid (no gradients) then is just what I placed above. but
2) if line colors are a bit distorted (due to jpeg compression etc) then you just use a distance function to compare 2 colors. since a color is a vector with (R,G,B), you can have the distance D(colorA,ColorB) and use threshold, so if D(colorA,colorB)<threshold it will be considered the same color.

hope it helps.
manoj kumar choubey 11-Apr-12 2:20am
Thak you Leonardo paneque
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Sure it will help you,Uploading two images and comparing both images are same by comparing its bandwidth,pixel,etc.

Really a nice article...........

Comparing two images
lukeer 11-Apr-12 2:17am
What's that got to do with finding lines in an image, despite the obvious image-processing background?
manoj kumar choubey 11-Apr-12 2:21am
Thank you vino

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171114.1 | Last Updated 11 Apr 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100