Please help me in OMR
2 ビュー (過去 30 日間)
古いコメントを表示
pic = dir('C:\Users\USER\Desktop\MMW\BSBA-01\*.jpg');
for a=1:length(pic);
filename = strcat('C:\Users\USER\Desktop\MMW\BSBA-01\',pic(a).name);
I=rgb2gray(imread(filename));
options='ABCD'; % Options
ans=''; % This string stores the options entered by the student
key=' D C D C A D B A D B A A D D C A B C C C D A A A D D D A D D A A D A D D A D D A B C B B C C A C A A'; % This string contains correct answers
x=885; % x-coordinate of first bubble
y=770; % y-coordinate of first bubble
s=105; %spacing between each bubble
sr=95; %spacing between consecutive rows
for i=1:25
sy=y+(i-1)*sr;
for j=1:4
sx=x+(j-1)*s;
% disp(sx);
% disp(sy);
% disp(I(sy,sx));
if((I(sy,sx)<25))
c(i,j)=0;
else
c(i,j)=1;
end
end
end
what does the 25 mean in this line?
if((I(sy,sx)<25))
0 件のコメント
採用された回答
Walter Roberson
2018 年 8 月 9 日
It looks arbitrary to me. It looks like you are doing optical mark reading, and that that statement is detecting whether a particular location on the card is sufficiently dark to be considered filled in. Dark pixels have low uint8 values.
2 件のコメント
Walter Roberson
2018 年 8 月 9 日
It is not the number of pixels, it is the intensity associated with the pixel located in row given by sx, column given by sy.
This is, by the way, a bit misleading. MATLAB arrays are indexed with y as the first coordinate, x as the second coordinate: the row is considered to be how far up or down you are (corresponding to y) and the column is how far left or right you are (corresponding to x).
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!