How to detect peaks in laser strip

조회 수: 2 (최근 30일)
Lalit Patil
Lalit Patil 2012년 11월 19일
I = imread('1.jpg'); z = im2bw(I); skel = bwmorph(z,'skel',Inf); imshow(skel)
I want to detect middle of laser strip in image 1, called peak detection.. i tried thinning and morphological operations, but it exactly doesn't work and gives image 2.. I want single middle line.. So, which function or logic or code may be applied, please suggest me...

채택된 답변

Image Analyst
Image Analyst 2012년 11월 19일
편집: Image Analyst 2012년 11월 19일
I'd just scan down line by line, determining the center on a line-by-line basis. You could just threshold and determine the center that way, or, if it has a nice non-saturated profile, use something like a Savitzky-Golay filter (a sliding window polynomial fit, sgolay() is in the signal processing toolbox) to find the peak. The Signal Processing Toolbox also has a findpeaks() function. Then make groups where the column of the center doesn't move much from line to line. Then fit each group to a line with polyfit().
  댓글 수: 2
Lalit Patil
Lalit Patil 2012년 11월 20일
편집: Lalit Patil 2012년 11월 20일
If i follow your first statement then i write a code that gives all centre points to me.. But, then how to create centre line image from it..!
And if i follow second statement then i got following image. http://www.fileconvoy.com/dfl.php?id=g1835684e61f18243171923475a58f31fdedd20 I think the space between the three different regions get filled, so this second can not be applied...
But still the problem is same.. How to create image from first solution.?
Lalit Patil
Lalit Patil 2012년 11월 20일
편집: Lalit Patil 2012년 11월 20일
Ok... Now i understand the concept... In real i need only that middle points and saved it to text file, no need of image.. and i got it.. I have done same as per your first suggestion "scan down line by line" Thank you...

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Harshit
Harshit 2012년 11월 19일
It is not possible due to noise. Although if you just want a line use hough transform to get different lines and then select the biggest line.
  댓글 수: 1
Lalit Patil
Lalit Patil 2012년 11월 19일
편집: Lalit Patil 2012년 11월 19일
If i do this, Image = imread('1.jpg'); bwImage = im2bw(Image); imshow(bwImage)
then the noise is removed, now i want to detect middle single straight line.. How can i do this..?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by