Note that there are some explanatory texts on larger screens.

plurals
  1. POIdentify all co-linear line segments (in matlab)
    primarykey
    data
    text
    <p>I have posted a related but not the same question here <a href="https://stackoverflow.com/questions/8279698/measuring-length-of-dna-fibers-from-an-image-of-single-molecules">https://stackoverflow.com/questions/8279698/measuring-length-of-dna-fibers-from-an-image-of-single-molecules</a></p> <p>Background: I have many images that look like this: <img src="https://i.stack.imgur.com/kX4H3.png" alt="enter image description here"></p> <p>I would like to identify all line segments that are co-linear and then measure the length of these segments. In the image above there are 3 pairs of segments that are on an imaginary line with a negative slope. The line segment that is the longest does not have a pair so it would not be considered i.e. there must be atleast 2 segments that are colinear.</p> <p>I get the following: <img src="https://i.stack.imgur.com/arIIi.png" alt="enter image description here"></p> <pre><code>I = imread('http://dl.dropbox.com/u/18072545/c_39_green.tif'); BW = edge(I,'canny'); [H,T,R] = hough(BW); NUMPEAKS=15; PEAKTHRESHOLD= 80; SUPPRESSNHBR=[40 40]; P = houghpeaks(H,NUMPEAKS,'threshold',PEAKTHRESHOLD,'NHoodSize',SUPPRESSNHBR); MINLENGTH_OF_SEGMENT=50; GAPLENGTH_TO_MERGE=30; lines = houghlines(BW,T,R,P,'FillGap',GAPLENGTH_TO_MERGE,'MinLength',MINLENGTH_OF_SEGMENT); max_len = 0; figure, imshow(I), hold on for k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; plot(xy(:,1),xy(:,2),'LineWidth',2,'Color','green'); plot(xy(1,1),xy(1,2),'x','LineWidth',2,'Color','yellow'); plot(xy(2,1),xy(2,2),'x','LineWidth',2,'Color','red'); end </code></pre> <p>I had to play around with the parameters in order to get a reasonable performance (though I am unable to find a parameter that will capture the starting bit of the segment that is at the bottom). However, I am unable to avoid finding multiple segments that are overlapping.</p> <p>Can someone please help me 1. Prevent identification of overlapping segments. 2. Identify all the lines that are co-linear</p> <p>Many thanks!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload