#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>
int main(int argc, char *argv[])
{
IplImage* img = 0;
IplImage* img1 = 0;
int height,width,step,channels;
uchar *data;
int i,j,k;
// load an image
img=cvLoadImage("C:\\boat.png");
if(!img){
printf("Could not load image file: %s\n","C:\\House24.bmp");
exit(0);
}
// get the image data
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
int dataOrder = img->dataOrder;
int imageSize = img->imageSize;
printf("Processing a %dx%d image with %d channels\n",height,width,channels);
printf("Step size = %d\n",step);
printf("Data Order = %d\n",dataOrder);
printf("Image Size = %d\n",imageSize);
printf("Number of Channels = %d\n",channels);
img1 = cvCloneImage(img);
IplImage* img2 = cvCloneImage(img);
// create a window
//cvNamedWindow("Image Negative", CV_WINDOW_AUTOSIZE);
//cvMoveWindow("Image Negative", 100, 100);
cvNamedWindow("Original Image", CV_WINDOW_AUTOSIZE);
cvMoveWindow("Original Image", 200,200);
cvNamedWindow("Smooth Image", CV_WINDOW_AUTOSIZE);
cvMoveWindow("Smooth Image", 300,300);
// invert the image
// for(i=0;i<height;i++) for(j=0;j<width;j++) for(k=0;k<channels;k++)
// data[i*step+j*channels+k]=255-data[i*step+j*channels+k];
//void cvSmooth( const CvArr* img, CvArr* img2, int smoothtype=CV_MEDIAN, int param1=15);
//void cvSobel(const CvArr* img, CvArr* img2, int xorder=2, int yorder=2, int aperture_size=3);
// show the image
//cvCanny(img,img2,10,100,3);
cvShowImage("Original Image", img1);
//cvShowImage("Image Negative", img );
cvShowImage("Smooth Image", img2);
// wait for a key
cvWaitKey(0);
// release the image
cvReleaseImage(&img1 );
cvReleaseImage(&img2);
return 0;
}
#include "stdafx.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cv.h>
#include <highgui.h>
int main(int argc, char *argv[])
{
IplImage* img = 0;
int height,width,step,channels;
uchar *data;
int i,j,k;
// load an image
img=cvLoadImage("C:\\boat.png");
if(!img){
printf("Could not load image file: %s\n","C:\\House24.bmp");
exit(0);
}
// get the image data
height = img->height;
width = img->width;
step = img->widthStep;
channels = img->nChannels;
int dataOrder = img->dataOrder;
int imageSize = img->imageSize;
printf("Processing a %dx%d image with %d channels\n",height,width,channels);
printf("Step size = %d\n",step);
printf("Data Order = %d\n",dataOrder);
printf("Image Size = %d\n",imageSize);
printf("Number of Channels = %d\n",channels);
// create a window
cvNamedWindow("Original Image", CV_WINDOW_AUTOSIZE);
cvMoveWindow("Original Image", 200,200);
// show the image
cvShowImage("Original Image", img);
// wait for a key
cvWaitKey(0);
// release the image
cvReleaseImage(&img );
return 0;
}
No comments:
Post a Comment