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))

采纳的回答

Walter Roberson
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 个评论
Mark Jecel Rapir
Mark Jecel Rapir 2018-8-9
thank you. YEs Im working on OMR.
what does I(sx,sy) give? is it the number of pixel? if so, how can I determine the number of pixels?
Walter Roberson
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 CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by