Wednesday, October 7, 2009

Reading and Displaying Image in Open CV

// Reading and Displaying Image

#include "stdafx.h"

#include <cv.h>

#include <cxcore.h>

#include <highgui.h>

int _tmain(int argc, _TCHAR* argv[])

{

int apertureSize = 3;

int dx=1;

int dy=0;

int r,g,b;

IplImage *img = cvLoadImage("C:\\lena.png");

IplImage *img1 = cvCreateImageHeader(cvSize(img->width,img->height),img->depth,img->nChannels);

printf("Number of channels %d",img->nChannels);


//cvLaplace(img,img1,apertureSize);

//CV_RGB(r,g,b)(int)((uchar)(b)+((uchar)(g)<<8)+((uchar)(r)<<16));

//cvCanny(img,img1,

cvNamedWindow("Image",1);

cvShowImage("Image",img);

cvWaitKey();

return 0;

}

// Reading and Displaying Image

#include "stdafx.h"

#include <cv.h>

#include <cxcore.h>

#include <highgui.h>

int _tmain(int argc, _TCHAR* argv[])

{

int apertureSize = 3;

int dx=1;

int dy=0;

int r,g,b;

IplImage *img = cvLoadImage("C:\\lena.png");

IplImage *img1 = cvCreateImageHeader(cvSize(img->width,img->height),img->depth,img->nChannels);

printf("Number of channels %d",img->nChannels);



//cvLaplace(img,img1,apertureSize);

//CV_RGB(r,g,b)(int)((uchar)(b)+((uchar)(g)<<8)+((uchar)(r)<<16));

//cvCanny(img,img1,

cvNamedWindow("Image",1);

cvShowImage("Image",img);

cvWaitKey();

return 0;

}

No comments: