#include "opencv\cv.h"
#include "opencv\highgui.h"
int resize(IplImage* inputImage)
{
// Load input image
//IplImage* inputImage = cvLoadImage("b.jpg");
// Create images for resize
IplImage* resizedImageLinear =cvCreateImage(cvSize(220,220),inputImage->depth, inputImage->nChannels);
// Resize input image using different method
// Bilinear interpolation
cvResize(inputImage, resizedImageLinear, CV_INTER_LINEAR);
// Nearest neighbor
// Save images
cvSaveImage("b_resized.jpg", resizedImageLinear);
// Create windows to show images
cvNamedWindow("Input");
cvNamedWindow("Linear");
// Show images
cvShowImage("Input", inputImage);
cvShowImage("Linear", resizedImageLinear);
// Wait for user input
cvWaitKey(0);
// Destroy windows
cvDestroyWindow("Input");
cvDestroyWindow("Linear");
// Release memory
cvReleaseImage(&inputImage);
cvReleaseImage(&resizedImageLinear);
// Exit
return 0;
}
#include "opencv\highgui.h"
int resize(IplImage* inputImage)
{
// Load input image
//IplImage* inputImage = cvLoadImage("b.jpg");
// Create images for resize
IplImage* resizedImageLinear =cvCreateImage(cvSize(220,220),inputImage->depth, inputImage->nChannels);
// Resize input image using different method
// Bilinear interpolation
cvResize(inputImage, resizedImageLinear, CV_INTER_LINEAR);
// Nearest neighbor
// Save images
cvSaveImage("b_resized.jpg", resizedImageLinear);
// Create windows to show images
cvNamedWindow("Input");
cvNamedWindow("Linear");
// Show images
cvShowImage("Input", inputImage);
cvShowImage("Linear", resizedImageLinear);
// Wait for user input
cvWaitKey(0);
// Destroy windows
cvDestroyWindow("Input");
cvDestroyWindow("Linear");
// Release memory
cvReleaseImage(&inputImage);
cvReleaseImage(&resizedImageLinear);
// Exit
return 0;
}
No comments:
Post a Comment