réorganisation et debuggage des descripteurs
176
learning/code/algo.c
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "constant.h"
|
||||||
|
#include "global.h"
|
||||||
|
#include "algo.h"
|
||||||
|
|
||||||
|
void Erreur(char * chaine,int numero)
|
||||||
|
{
|
||||||
|
fprintf(stderr,chaine);
|
||||||
|
fprintf(stderr,"\nerreur %d\n",numero);
|
||||||
|
exit(numero);
|
||||||
|
}
|
||||||
|
|
||||||
|
int LireVecteurs (void)
|
||||||
|
{
|
||||||
|
int k;
|
||||||
|
if((ent=fopen(noment,"rb"))==NULL)
|
||||||
|
return 1;
|
||||||
|
fread(&M,sizeof(int),1,ent);
|
||||||
|
fread(&dimvec,sizeof(int),1,ent);
|
||||||
|
fread(&dico,sizeof(int),1,ent);
|
||||||
|
fread(&numiter,sizeof(int),1,ent);
|
||||||
|
if((vecteurs=(float**)calloc(M,sizeof(float *)))==NULL)
|
||||||
|
return 3;
|
||||||
|
for(k=0;k<M;k++)
|
||||||
|
{
|
||||||
|
if((vecteurs[k]=(float*)calloc(dimvec,sizeof(float)))==NULL)
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
for(k=0;k<M;k++)
|
||||||
|
fread(vecteurs[k],sizeof(float),dimvec,ent);
|
||||||
|
fclose(ent);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int InitDictionnaire(void)
|
||||||
|
{
|
||||||
|
int k;
|
||||||
|
if((vecteurs_classes=(float**)calloc(dico,sizeof(float *)))==NULL)
|
||||||
|
return 1;
|
||||||
|
for(k=0;k<dico;k++)
|
||||||
|
{
|
||||||
|
if((vecteurs_classes[k]=(float*)calloc(dimvec,sizeof(float)))==NULL)
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if((vecteurs_final=(float**)calloc(dico,sizeof(float *)))==NULL)
|
||||||
|
return 3;
|
||||||
|
for(k=0;k<dico;k++)
|
||||||
|
{
|
||||||
|
if((vecteurs_final[k]=(float*)calloc(dimvec,sizeof(float)))==NULL)
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
if((index_final=(int*)calloc(M,sizeof(int)))==NULL)
|
||||||
|
return 5;
|
||||||
|
if((popul_final=(int*)calloc(dico,sizeof(int)))==NULL)
|
||||||
|
return 6;
|
||||||
|
if((index_classes=(int*)calloc(M,sizeof(int)))==NULL)
|
||||||
|
return 7;
|
||||||
|
if((popul_classes=(int*)calloc(dico,sizeof(int)))==NULL)
|
||||||
|
return 8;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CalculDictionnaire(void)
|
||||||
|
{
|
||||||
|
int n,k,p,index;
|
||||||
|
double energie_prec,distance,distancemin;
|
||||||
|
char fini;
|
||||||
|
for(k=0;k<dico;k++)
|
||||||
|
{
|
||||||
|
index=(int)floor(((double)(M-1)*(double)(rand()))/(double)RAND_MAX);
|
||||||
|
for(n=0;n<dimvec;n++)
|
||||||
|
vecteurs_classes[k][n]=vecteurs[index][n];
|
||||||
|
}
|
||||||
|
energie=0.0;
|
||||||
|
etape=0;
|
||||||
|
fini=0;
|
||||||
|
while(!fini)
|
||||||
|
{
|
||||||
|
memset(popul_classes,0,dico*sizeof(int));
|
||||||
|
energie_prec=energie;
|
||||||
|
energie=0.0;
|
||||||
|
for(k=0;k<M;k++)
|
||||||
|
{
|
||||||
|
index=0;
|
||||||
|
distancemin=0.0;
|
||||||
|
for(n=0;n<dimvec;n++)
|
||||||
|
{
|
||||||
|
distancemin+=
|
||||||
|
(vecteurs[k][n]-vecteurs_classes[0][n])*
|
||||||
|
(vecteurs[k][n]-vecteurs_classes[0][n]);
|
||||||
|
}
|
||||||
|
for(p=1;p<dico;p++)
|
||||||
|
{
|
||||||
|
distance=0.0;
|
||||||
|
for(n=0;n<dimvec;n++)
|
||||||
|
{
|
||||||
|
distance+=
|
||||||
|
(vecteurs[k][n]-vecteurs_classes[p][n])*
|
||||||
|
(vecteurs[k][n]-vecteurs_classes[p][n]);
|
||||||
|
}
|
||||||
|
if(distance<distancemin)
|
||||||
|
{
|
||||||
|
distancemin=distance;
|
||||||
|
index=p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
index_classes[k]=index;
|
||||||
|
popul_classes[index]+=1;
|
||||||
|
energie+=distancemin;
|
||||||
|
}
|
||||||
|
for(p=0;p<dico;p++)
|
||||||
|
{
|
||||||
|
if(popul_classes[p])
|
||||||
|
{
|
||||||
|
memset(vecteurs_classes[p],0,dimvec*sizeof(float));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(k=0;k<M;k++)
|
||||||
|
{
|
||||||
|
index=index_classes[k];
|
||||||
|
if(popul_classes[index])
|
||||||
|
{
|
||||||
|
for(n=0;n<dimvec;n++)
|
||||||
|
{
|
||||||
|
vecteurs_classes[index][n]+=vecteurs[k][n];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(p=0;p<dico;p++)
|
||||||
|
{
|
||||||
|
if(popul_classes[p])
|
||||||
|
{
|
||||||
|
for(n=0;n<dimvec;n++)
|
||||||
|
{
|
||||||
|
vecteurs_classes[p][n]/=popul_classes[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(etape!=0)
|
||||||
|
{
|
||||||
|
if(((energie_prec-energie)/energie)<SEUIL)
|
||||||
|
fini=1;
|
||||||
|
}
|
||||||
|
etape++;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SauveClasses(void)
|
||||||
|
{
|
||||||
|
int k;
|
||||||
|
if((sor=fopen(nomsor,"wb"))==NULL)
|
||||||
|
return 1;
|
||||||
|
fwrite(&dimvec,sizeof(int),1,sor);
|
||||||
|
fwrite(&dico,sizeof(int),1,sor);
|
||||||
|
for(k=0;k<dico;k++)
|
||||||
|
fwrite(vecteurs_final[k],sizeof(float),dimvec,sor);
|
||||||
|
fwrite(popul_final,sizeof(int),dico,sor);
|
||||||
|
fclose(sor);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SauveCode(void)
|
||||||
|
{
|
||||||
|
if((cod=fopen(nomcod,"wb"))==NULL)
|
||||||
|
return 1;
|
||||||
|
fwrite(index_final,sizeof(int),M,sor);
|
||||||
|
fclose(sor);
|
||||||
|
return 0;
|
||||||
|
}
|
6
learning/code/algo.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
void Erreur(char *,int);
|
||||||
|
int LireVecteurs(void);
|
||||||
|
int InitDictionnaire(void);
|
||||||
|
int CalculDictionnaire(void);
|
||||||
|
int SauveClasses(void);
|
||||||
|
int SauveCode(void);
|
BIN
learning/code/code
Normal file
10
learning/code/constant.h
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#define NOM 50
|
||||||
|
#define SEUIL 1e-5
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
int popul;
|
||||||
|
float * vecteur;
|
||||||
|
}
|
||||||
|
TRI;
|
4
learning/code/data_set.m
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
function [image]=data_set(i, n)
|
||||||
|
|
||||||
|
|
||||||
|
end
|
28
learning/code/descripteurfouriernorm.m
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
function [coeff,num]=descripteurfouriernorm(z,cmax)
|
||||||
|
cmin=-cmax;
|
||||||
|
z_moy=mean(z);
|
||||||
|
longc=length(z);
|
||||||
|
% on calcule les coefficients de Fourier
|
||||||
|
TC=fft(z-z_moy)/longc;
|
||||||
|
num=cmin:cmax;
|
||||||
|
% on sélectionne les coefficients entre cmin et cmax
|
||||||
|
coeff=zeros(cmax-cmin+1,1);
|
||||||
|
coeff(end-cmax:end)=TC(1:cmax+1);
|
||||||
|
coeff(1:-cmin)=TC(end+cmin+1:end);
|
||||||
|
|
||||||
|
% on retourne la séquence si le parcours est dans le
|
||||||
|
% sens inverse du sens trigonométrique
|
||||||
|
if abs(coeff(num==-1))>abs(coeff(num==1))
|
||||||
|
coeff=coeff(end:-1:1);
|
||||||
|
end
|
||||||
|
|
||||||
|
% corrections de phase pour normaliser
|
||||||
|
% par rapport à la rotation et l'origine
|
||||||
|
% du signal z
|
||||||
|
Phi=angle(coeff(num==-1).*coeff(num==1))/2;
|
||||||
|
coeff=coeff*exp(-1i*Phi);
|
||||||
|
theta=angle(coeff(num==1));
|
||||||
|
coeff=coeff.*exp(-1i*num'*theta);
|
||||||
|
|
||||||
|
% correction pour normaliser la taille
|
||||||
|
coeff=coeff/abs(coeff(num==1));
|
BIN
learning/code/dict
Normal file
25
learning/code/global.c
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "constant.h"
|
||||||
|
|
||||||
|
char noment[NOM];
|
||||||
|
char nomsor[NOM];
|
||||||
|
char nomcod[NOM];
|
||||||
|
int dimvec,M,dico,numiter;
|
||||||
|
|
||||||
|
FILE * ent,* sor,* cod;
|
||||||
|
|
||||||
|
float ** vecteurs;
|
||||||
|
float ** vecteurs_classes;
|
||||||
|
int * index_classes;
|
||||||
|
int * popul_classes;
|
||||||
|
float ** vecteurs_final;
|
||||||
|
int * index_final;
|
||||||
|
int * popul_final;
|
||||||
|
int etape;
|
||||||
|
double energie;
|
||||||
|
double energieminimale;
|
||||||
|
|
||||||
|
TRI * buftri;
|
||||||
|
|
25
learning/code/global.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern char noment[NOM];
|
||||||
|
extern char nomsor[NOM];
|
||||||
|
extern char nomcod[NOM];
|
||||||
|
extern int dimvec,M,dico,numiter;
|
||||||
|
|
||||||
|
extern FILE * ent,* sor,* cod;
|
||||||
|
|
||||||
|
extern float ** vecteurs;
|
||||||
|
extern float ** vecteurs_classes;
|
||||||
|
extern int * index_classes;
|
||||||
|
extern int * popul_classes;
|
||||||
|
extern float ** vecteurs_final;
|
||||||
|
extern int * index_final;
|
||||||
|
extern int * popul_final;
|
||||||
|
extern int etape;
|
||||||
|
extern double energie;
|
||||||
|
extern double energieminimale;
|
||||||
|
|
||||||
|
extern TRI * buftri;
|
||||||
|
|
41
learning/code/kmoyennes.m
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
% kmoyennes.m
|
||||||
|
% [vecteursliste,code,occur]=kmoyennes(vecteurs,dico,numiter)
|
||||||
|
% vecteurs : vecteurs de la base (rangés en colonnes)
|
||||||
|
% dico : nombre de classes
|
||||||
|
% numiter : nombre d'essais pour trouver le dictionnaire
|
||||||
|
% vecteursliste : contient les vecteurs prototypes
|
||||||
|
% code : contient les index des classes
|
||||||
|
% occur : nombre d'éléments dans chaque classe
|
||||||
|
|
||||||
|
function [vecteursliste,code,occur]=kmoyennes(vecteurs,dico,numiter)
|
||||||
|
|
||||||
|
% nombre de lignes du tableau vecteurs : dimension des vecteurs
|
||||||
|
dimvec=size(vecteurs,1);
|
||||||
|
% nombre de colonnes du tableau vecteurs : nombre de vecteurs
|
||||||
|
M=size(vecteurs,2);
|
||||||
|
|
||||||
|
% ecriture des fichiers nécessaires au fonctionnment du programme quantvec
|
||||||
|
fid=fopen('vecteurs','w');
|
||||||
|
fwrite(fid,M,'int');
|
||||||
|
fwrite(fid,dimvec,'int');
|
||||||
|
fwrite(fid,dico,'int');
|
||||||
|
fwrite(fid,numiter,'int');
|
||||||
|
fwrite(fid,vecteurs,'float');
|
||||||
|
fclose(fid);
|
||||||
|
|
||||||
|
% lancement du programme quantvec
|
||||||
|
unix('./quantvec vecteurs dict code');
|
||||||
|
|
||||||
|
% lecture des fichiers résultat
|
||||||
|
fid=fopen('dict','r');
|
||||||
|
dimvec=fread(fid,1,'int');
|
||||||
|
dico=fread(fid,1,'int');
|
||||||
|
vecteursliste=fread(fid,[dimvec dico],'float');
|
||||||
|
occur=fread(fid,dico,'int');
|
||||||
|
fclose(fid);
|
||||||
|
disp('vecteurs dans la liste')
|
||||||
|
disp([dimvec dico])
|
||||||
|
|
||||||
|
fid=fopen('code','r');
|
||||||
|
code=fread(fid,M,'int');
|
||||||
|
fclose(fid);
|
58
learning/code/learning.m
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
close all
|
||||||
|
|
||||||
|
%acceptable threshold values: 15-30
|
||||||
|
threshold = 20;
|
||||||
|
cmax = 10;
|
||||||
|
cmin = -cmax;
|
||||||
|
n_classes = 16;
|
||||||
|
iterations = 50;
|
||||||
|
N = 200;
|
||||||
|
|
||||||
|
dataset = dir('../images/*/*.jpg');
|
||||||
|
dataset_size = length(dataset);
|
||||||
|
|
||||||
|
vecteurs=zeros(2*(cmax-cmin+1),dataset_size); %TODO: renommer en vectors
|
||||||
|
|
||||||
|
% c'est lent
|
||||||
|
% s'assurer que l'on choisit toutes les images
|
||||||
|
%
|
||||||
|
for n=1:dataset_size
|
||||||
|
% choix d'une image aléatoire
|
||||||
|
choix = 1 + floor(dataset_size*rand(dataset_size, 1));
|
||||||
|
% extraction de l'image du dataset
|
||||||
|
image = dataset(choix(1));
|
||||||
|
% lecture de l'image
|
||||||
|
img = imread([image.folder '/' image.name]);
|
||||||
|
% filtrage de la couleur de la peau
|
||||||
|
binary = rgb_filter(img, threshold);
|
||||||
|
% détermination du contour
|
||||||
|
c = contourc(binary);
|
||||||
|
% Détermination du contour de taille max
|
||||||
|
cont = max_contour(c);
|
||||||
|
% transformation en signal complex
|
||||||
|
z = cont(:,1) + 1i*cont(:,2);
|
||||||
|
% calcul des descripteurs de Fourrier
|
||||||
|
[coeff,ncoeff]=descripteurfouriernorm(z,cmax);
|
||||||
|
% Extraction des composantes
|
||||||
|
vecteurs(:,n)=[real(coeff);imag(coeff)];
|
||||||
|
% affichage de l'avancement
|
||||||
|
disp(n/dataset_size);
|
||||||
|
end
|
||||||
|
|
||||||
|
% utilisation de l'algorithme des kmeans
|
||||||
|
kmeans = kmoyennes(vecteurs, n_classes, iterations);
|
||||||
|
|
||||||
|
% affichage des prototypes
|
||||||
|
figure
|
||||||
|
for n=1:n_classes
|
||||||
|
contfil=resconstrdesfour(kmeans(1:end/2,n)+1i*kmeans(end/2+1:end,n),N,cmax);
|
||||||
|
subplot(4,4,n)
|
||||||
|
h=plot(real(contfil),imag(contfil),'-',real(contfil(1)),imag(contfil(1)),'o');
|
||||||
|
title(['prototype ' int2str(n)])
|
||||||
|
set(h(1),'LineWidth',2)
|
||||||
|
set(h(2),'LineWidth',3)
|
||||||
|
grid on
|
||||||
|
axis equal
|
||||||
|
axis ij
|
||||||
|
drawnow
|
||||||
|
end
|
8
learning/code/makefile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
all : quantvec
|
||||||
|
|
||||||
|
quantvec : *.c *.h
|
||||||
|
g++ -O3 -Wall *.c -o quantvec
|
||||||
|
|
||||||
|
clean :
|
||||||
|
rm quantvec
|
||||||
|
|
18
learning/code/max_contour.m
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
function [cont]=max_contour(contours)
|
||||||
|
i=1;
|
||||||
|
id=1;
|
||||||
|
max = 0;
|
||||||
|
while i+contours(2, id) < size(contours, 2)
|
||||||
|
contours(2,i);
|
||||||
|
if contours(2,i) > max
|
||||||
|
max = contours(2,i);
|
||||||
|
id = i;
|
||||||
|
end
|
||||||
|
i=i+1+contours(2,i);
|
||||||
|
end
|
||||||
|
|
||||||
|
cont = zeros(max, 2);
|
||||||
|
cont(1:end,1) = contours(1, id+1:id+max);
|
||||||
|
cont(1:end,2) = contours(2, id+1:id+max);
|
||||||
|
|
||||||
|
end
|
BIN
learning/code/quantvec
Executable file
63
learning/code/quantvec.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#define _CRT_SECURE_NO_DEPRECATE
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include "constant.h"
|
||||||
|
#include "global.h"
|
||||||
|
#include "algo.h"
|
||||||
|
|
||||||
|
int main(int ac,char ** av)
|
||||||
|
{
|
||||||
|
int erreur,iter,p;
|
||||||
|
if(ac != 4)
|
||||||
|
Erreur((char*)"Il faut 3 parametres",1);
|
||||||
|
strncpy(noment,av[1],NOM-1);
|
||||||
|
strncpy(nomsor,av[2],NOM-1);
|
||||||
|
strncpy(nomcod,av[3],NOM-1);
|
||||||
|
|
||||||
|
srand( (unsigned)time( NULL ) );
|
||||||
|
|
||||||
|
if((erreur=LireVecteurs())!=0)
|
||||||
|
Erreur((char*)"Erreur de lecture des vecteurs",erreur);
|
||||||
|
fprintf(stderr,"nombre de vecteurs : %d\n",M);
|
||||||
|
fprintf(stderr,"dimension des vecteurs : %d\n",dimvec);
|
||||||
|
fprintf(stderr,"taille du dictionnaire : %d\n",dico);
|
||||||
|
fprintf(stderr,"nombre d'iterations : %d\n",numiter);
|
||||||
|
if((erreur=InitDictionnaire())!=0)
|
||||||
|
Erreur((char*)"Erreur d'initialisation du dictionnaire",erreur);
|
||||||
|
|
||||||
|
iter=0;
|
||||||
|
if((erreur=CalculDictionnaire())!=0)
|
||||||
|
Erreur((char*)"Erreur de calcul itératif du dictionnaire",erreur);
|
||||||
|
energieminimale=energie;
|
||||||
|
memcpy(index_final,index_classes,M*sizeof(int));
|
||||||
|
memcpy(popul_final,popul_classes,dico*sizeof(int));
|
||||||
|
for(p=0;p<dico;p++)
|
||||||
|
memcpy(vecteurs_final[p],vecteurs_classes[p],dimvec*sizeof(float));
|
||||||
|
fprintf(stderr,"iteration %d, distorsion %lf en %d etapes\n",iter,energie/((double)M*(double)dimvec),etape);
|
||||||
|
|
||||||
|
for(iter=1;iter<numiter;iter++)
|
||||||
|
{
|
||||||
|
if((erreur=CalculDictionnaire())!=0)
|
||||||
|
Erreur((char*)"Erreur de calcul itératif du dictionnaire",erreur);
|
||||||
|
if(energie<energieminimale)
|
||||||
|
{
|
||||||
|
energieminimale=energie;
|
||||||
|
memcpy(index_final,index_classes,M*sizeof(int));
|
||||||
|
memcpy(popul_final,popul_classes,dico*sizeof(int));
|
||||||
|
for(p=0;p<dico;p++)
|
||||||
|
memcpy(vecteurs_final[p],vecteurs_classes[p],dimvec*sizeof(float));
|
||||||
|
}
|
||||||
|
fprintf(stderr,"iteration %d, distorsion %lf en %d etapes\n",iter,energie/((double)M*(double)dimvec),etape);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr,"distorsion finale %lf\n",energieminimale/((double)M*(double)dimvec));
|
||||||
|
if((erreur=SauveClasses())!=0)
|
||||||
|
Erreur((char*)"Erreur de sauvegarde des classes",erreur);
|
||||||
|
if((erreur=SauveCode())!=0)
|
||||||
|
Erreur((char*)"Erreur de sauvegarde du code",erreur);
|
||||||
|
}
|
11
learning/code/resconstrdesfour.m
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
function z_fil=resconstrdesfour(coeff,N,cmax)
|
||||||
|
|
||||||
|
cmin=-cmax;
|
||||||
|
TC=zeros(N,1);
|
||||||
|
|
||||||
|
TC(1:cmax+1)=coeff(end-cmax:end);
|
||||||
|
TC(end+cmin+1:end)=coeff(1:-cmin);
|
||||||
|
|
||||||
|
z_fil=ifft(TC)*N;
|
||||||
|
|
||||||
|
z_fil=[z_fil;z_fil(1)];
|
23
learning/code/rgb_filter.m
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
function [filtered_img]=rgb_filter(img, threshold)
|
||||||
|
height = size(img, 1);
|
||||||
|
width = size(img, 2);
|
||||||
|
depth = size(img, 3);
|
||||||
|
|
||||||
|
filtered_img = zeros(height, width, 1);
|
||||||
|
|
||||||
|
for i=1:height
|
||||||
|
for j=1:width
|
||||||
|
r = img(i, j, 1);
|
||||||
|
g = img(i, j, 2);
|
||||||
|
b = img(i, j, 3);
|
||||||
|
if (r > g && r > b)
|
||||||
|
if (r-b > threshold || r-g > threshold)
|
||||||
|
filtered_img(i, j, 1) = 1;
|
||||||
|
else
|
||||||
|
filtered_img(i, j, 1) = 0;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
3
learning/code/traitement.h
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
int InitInfo(void);
|
||||||
|
void TraiteErreur(int,char*);
|
||||||
|
DWORD WINAPI Traitement(LPVOID);
|
BIN
learning/code/vecteurs
Normal file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |