how to scan image for specific pattern

15 ビュー (過去 30 日間)
genesis
genesis 2013 年 10 月 28 日
コメント済み: Anand 2013 年 10 月 28 日
i want to scan a binary image row by row for a consistent pattern of black:white:black:white:black to the scale of 1:1:3:1:1 pixels respectively. i want to use it for QR code scanning. something like this

回答 (2 件)

Anand
Anand 2013 年 10 月 28 日
Use normalized cross correlation (NCC) provided by the normxcorr2 function.
You can try something like this:
%the pattern you're looking for is B W B B B W B
template = logical([0 1 0 0 0 1 0]);
%find NCC of template with image BW
cc = normxcorr2(template,BW);
Then find peaks in cc to locate co-ordinates of the pattern.
  2 件のコメント
Image Analyst
Image Analyst 2013 年 10 月 28 日
編集済み: Image Analyst 2013 年 10 月 28 日
I thought of that first also but then I realized that it wouldn't work if the QR bar code in the image isn't the same size and pattern as the pattern he's searching for. I believe he wants to locate any QR code, not just some code of a pattern and size that is known in advance. So if he can't specify in advance what to look for then he'll have to look to texture segmentation. Or else search the literature for papers like I mentioned in my comment.
Anand
Anand 2013 年 10 月 28 日
Yes, I agree. Bur since genesis mentioned that the scale specifically as 1:1:3:1:1 "pixels" I thought he might know more about his image data.

サインインしてコメントする。


Image Analyst
Image Analyst 2013 年 10 月 28 日
Try using stdfilt() to look for areas of high texture in the image.
  1 件のコメント
Image Analyst
Image Analyst 2013 年 10 月 28 日
You might try this:
Kato, Y.[Yuji], Deguchi, D.[Daisuke], Takahashi, T.[Tomokazu], Ide, I.[Ichiro], Murase, H.[Hiroshi], Low Resolution QR-Code Recognition by Applying Super-Resolution Using the Property of QR-Codes, ICDAR11(992-996).
By the way, if you do want to play around with normxcorr2 (which probably won't work in your situation) you can try the demo I attached below.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by