Please help me in OMR

조회 수: 1 (최근 30일)
Mark Jecel Rapir
Mark Jecel Rapir 2018년 8월 9일
댓글: Walter Roberson 2018년 8월 9일
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 Type Conversion에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by