Building a line profile of a pattern in a real time video

1 次查看(过去 30 天)
Hi guys,
I'm new to the Matlab Video processing module and want to get some help or some idea to start for the following problem.
1. I have a real time video, where there are two sets of ruler line marks. 2. These two sets of marks could be separate by a distance or could be in close proximity. 2. I want to recognize these two set of marks and see which mark on the left lines up with which one on the right. See figure below: https://dl.dropbox.com/u/10571500/matlab.png In this example, only 1 and 8 line line up.
My idea is to have a profile line drawn perpendicular to each sets of those marks ("A" and "B" in the figure) and build two sets of profile to compare. Once I get the line profile of the marks, I should be able to determine which one has lined up. Or does Matlab have a better way to do this?
Thanks,
Gene

回答(1 个)

Image Analyst
Image Analyst 2012-8-28
编辑:Image Analyst 2012-8-28
First sum the whole image vertically. That will allow you to get column1, column2, column3 and column4 where the bar patterns start and stop. Then sum the image horizontally between column 1 and column2 to get the profile of the left block. Then do the same to get the average profile of the right block. Then threshold each profile and pass into diff() to find where each bright-to-dark and dark-to-bright transition is. Now you have two arrays saying where each line starts and stops and you can compare them, for example subtract to find out how many image lines the line/bar on the left is separated vertically from the corresponding one on the right. Let me know if you can't figure it out. If you need me to work on the code, you should upload an image without the red lines.
When I try to download your image, all I get is the red lines on a black background - no bars at all. Please upload it somewhere where I can get the monochrome image of the bars without the red lines.
  1 个评论
Gene
Gene 2012-8-28
编辑:Gene 2012-8-28
Image Analyst,
Thank you for your reply. I'm a little bit confused. When you say column 1,2,3,4, where exactly are you referring to? And under some circumstance, these two sets of bar may intercept. For that case, I guess we couldn't sum horizontally. Please see the following pic: https://dl.dropbox.com/u/10571500/matlab2.jpg
And since the actual pattern will be taken by real time camera video, the actual image will not be as clear as the one I show above. Usually there should be some other feature that will confuse the Matlab program if it assume bars are the only thing in the image. So I'm thinking that I should be able to manually select the area I want to analyze in a real time video and have the program do the rest. What should I look into?
Thanks, Gene

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by