Please help me in OMR
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Mark Jecel Rapir
il 9 Ago 2018
Commentato: Walter Roberson
il 9 Ago 2018
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 Commenti
Risposta accettata
Walter Roberson
il 9 Ago 2018
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 Commenti
Walter Roberson
il 9 Ago 2018
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).
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Data Distribution Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!