フィルターのクリア

How can I detect regions in image using x,y coordinates?

3 ビュー (過去 30 日間)
AminaOsmanova
AminaOsmanova 2017 年 2 月 22 日
コメント済み: AminaOsmanova 2017 年 2 月 27 日
I am a newbie in Image Processing using Matlab. have been successful in doing Marked Circle recognition using Template Matching.This is the code I used:
function[res] = findtemplate(image, template, th, showtemp)
im = rgb2gray(imread(image));
temp = rgb2gray(imread(template));
close all
out = normxcorr2(temp, im);
[m, n] = size(temp);
out = out(m+1: end, n+1: end);
bw = out > th;
r = regionprops(bwlabel(bw));
if nargin > 3
im(1:m, 1:n) = temp;
end
res = r;
clf
imshow(im, [])
hold on
for i=1:length(r)
rectangle('position', [r(i).Centroid(1), r(i).Centroid(2), m, n], 'EdgeColor','r','LineWidth',2);
end
Output image looks like this:
And now I must detect that numbers using x,y coordinates.It would be helpful if someone explains it better since I am a newbie.Thanks in advance!
  1 件のコメント
AminaOsmanova
AminaOsmanova 2017 年 2 月 22 日
編集済み: AminaOsmanova 2017 年 2 月 22 日
I already detected for example that student chose 'A' in question '1' in attached image,now i need to detect each question number(ex:from 1-105) thanks in advance

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

採用された回答

Image Analyst
Image Analyst 2017 年 2 月 25 日
I may still work on the demo, but try what I have so far using the attached m-file and the attached PNG image file (slightly cropped from the one you uploaded).
  1 件のコメント
AminaOsmanova
AminaOsmanova 2017 年 2 月 27 日
Thanks for your reply and explanation,you helped me a lot

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2017 年 2 月 23 日
編集済み: Image Analyst 2017 年 2 月 23 日
I don't understand how or why you found that the filled-in circle for question #1 was A instead of B, but whatever....
For the rest of the circles, simply use your template (list of circle locations) to determine which circle on the row has the most non-white and non-red pixels on it. I.e. find the most gray, black, or blue pixels. If none have enough, then that question went unanswered. Just do what you did to find the first question for all the other questions. What's the difficulty?
[EDIT] Ooooohhhh. I just took a look at your code. That's not good. Bad idea. I know you might think it's a good idea (like many other beginners), but it's not. And if someone says to try findcircles() or hough(), don't pay attention to them either. It's another idea that some beginners might suggest but it is ridiculous. What you need to do is to have a list of rows and columns where the circles are, then simply look in those regions. This is a much, much simpler approach. Simply use the FAQ http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F to build a binary mask at each circle centroid location, and check the darkness by asking regionprops for MeanIntensity of the blue channel of the image.
  3 件のコメント
Image Analyst
Image Analyst 2017 年 2 月 25 日
This is a commonly enough asked question that I'm working on a demo. I'll post something tomorrow.
AminaOsmanova
AminaOsmanova 2017 年 2 月 25 日
Thank you for your help

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

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by