Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB VB.NET
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
Manoj
Posted 10-Apr-12 4:15am
Comments
V. at 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
good
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[^].
  Permalink  
Comments
manoj kumar choubey at 11-Apr-12 2:20am
   
Thank you lukeer
Rate this: bad
good
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.
  Permalink  
v2
Comments
manoj kumar choubey at 11-Apr-12 2:20am
   
Thak you Leonardo paneque
Rate this: bad
good
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
  Permalink  
Comments
lukeer at 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 at 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
0 OriginalGriff 245
1 Jochen Arndt 155
2 PIEBALDconsult 150
3 Afzaal Ahmad Zeeshan 120
4 DamithSL 115
0 OriginalGriff 5,695
1 DamithSL 4,591
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 11 Apr 2012
Copyright © CodeProject, 1999-2014
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