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!