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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| #include <iostream>
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include <math.h>
#include <fstream>
//==============================================================================================//
// Image Analogies using only comparison of luminance and using Gaussian Pyramid //
//==============================================================================================//
using namespace std;//enlève les conflits de nommages
struct ColorPoint
{
int LevelB;
int LevelG;
int LevelR;
};
int main( int argc, char** argv)
{
ofstream fileout;//créer un fichier appelé fileout
fileout.open("text.txt");//ouvrir le fichier sous le nom text.txt en écriture
ofstream file;//créer un fichier appelé fileout
file.open("text1.txt");
CvScalar s;
int Width, Height, i, j;
IplImage* srcL;
IplImage* srcGL;
srcL=cvLoadImage(argv[1]);
Width= srcL->width;
Height= srcL->height;
srcGL = cvCreateImage(cvSize(srcL->width,srcL->height),IPL_DEPTH_8U, 1);
cvConvertImage(srcL, srcGL, 0);
cvNamedWindow("win1", CV_WINDOW_AUTOSIZE);
cvShowImage("win1", srcL);
cvNamedWindow("win2", CV_WINDOW_AUTOSIZE);
cvShowImage("win2", srcGL);
int** imG;
imG=new int* [Height];
for (i=0; i<Height; i++) imG[i]=new int [Width];
for (i=0; i<Height; i=i+1)
{
for (j=0; j< Width ; j=j+1)
{
s=cvGet2D(srcGL,i,j);
imG[i][j]=s.val[0];
fileout << "t";
file << "r";
}
}
if(imG[0][0]==0)file << "noir! " ;
cvWaitKey(0);
cvDestroyWindow("win1");
cvDestroyWindow("win2");
//===============================
cvReleaseImage(&srcL);
return 0;
}
//==============================================================================================
//============================================================================================== |
Partager