1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| while(1)
{
cvResizeWindow("Capture iSigth", 400, 300);
cvShowImage("Capture iSigth", dst_frame);
val = sensibility(); //met la valeur qui provient du slider
//deltaVal = getDelta(); //petit essais pour ajouter un delta a la sensibilite
if(!val)val=255;//valeur par défaut
if(!deltaVal) deltaVal = 10;
src_frame = cvQueryFrame(capture);
//création de l'image de sortie
dst_frame = cvCreateImage(cvGetSize(src_frame), src_frame->depth, 1);
gray = cvCreateImage(cvGetSize(src_frame), src_frame->depth, 1);
//gray->origin = src_frame->origin;
size = src_frame->height;
imageChannels = src_frame->nChannels;
//cvConvertImage(src_frame, dst_frame, 0);
dst_frame=src_frame;
//CvCvtColor (image, imageHSV, CV_BGR2HSV);
imageHSV = src_frame;
cvConvertImage (src_frame, imageHSV, CV_BGR2HSV);
float value;
for(x=0; x<imageHSV->width; x++)
{
for(y=0;y<imageHSV->height;y++)
{
value = (imageHSV->imageData + imageHSV->widthStep*y)[x*3+2];
value = value + 128;
if((value>val))
{
cvCircle(dst_frame, cvPoint(x, y), 1, cvScalar(0, 0, 255, 0), 1, 1, 0);
}
}
}
// Méthode qui flip l'image
cvFlip(src_frame, dst_frame, 1);
if(cvWaitKey(1)=='q')
{
firstiteration=0;
[threadCam stopdetectionCouleurThread:nil];
threadCam = 0;
cvReleaseCapture(&capture);
cvDestroyWindow("Capture iSigth");
break;
}
} |
Partager