-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoordEachDigitsOpt.m
More file actions
21 lines (18 loc) · 905 Bytes
/
coordEachDigitsOpt.m
File metadata and controls
21 lines (18 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
% Fonction pour obtenir les coordonnées gauche/haut et droite/bas de chaque
% chiffre dans les images.
% Sortie tableau 10 x 4 x nombre répétition
% 4 --> [x1 y1 x2 y2]
function coordEachDigitsOpt_matrix = coordEachDigitsOpt(image, nb_times_each_digit)
%on recupere l'histogramme de l'axe des ordonnees
h_horizontale = histo_horizontale(image);
%on utilise l'histogramme obtenu avant afin de séparer chaque ligne
coord_ligne = getCoordVertical(h_horizontale, image);
%on utilise les lignes obtenu avant afin de séparer chaque chiffre de
%chaque ligne
coordEachDigits = getCoordHorizontal(coord_ligne, nb_times_each_digit, 10, image);
%on optimise l'encapsulation des chiffres obtenus avant
coordEachDigitsOpt_matrix = optimiserEachDigit(coordEachDigits, image, 10, nb_times_each_digit);
end
function [result] = histo_horizontale(I)
result = sum(I < 50, 2);
end