Ask Your Question
1

change the Height and Width of the image

asked 2013-06-05 01:03:18 -0500

dhanash gravatar image

updated 2013-06-05 01:20:29 -0500

berak gravatar image
#include "opencv2/opencv.hpp"
#include "opencv2/objdetect/objdetect.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include "opencv2/imgproc/imgproc.hpp"

#include <iostream>
#include <stdio.h>

using namespace std;
using namespace cv;

IplImage* doPyrDown(IplImage* in,int filter = IPL_GAUSSIAN_5x5)
{
// Best to make sure input image is divisible by two.
assert( in->width%2 == 0 && in->height%2 == 0 );
IplImage* out = cvCreateImage(cvSize( in->width/2, in->height/2 ),in->depth,in->nChannels);
cvPyrDown( in, out );
return( out );
}

int main( int argc, char* argv[]) 
{
IplImage* img = cvLoadImage( argv[1],1);//load the image and 1 for color image
cvNamedWindow( "Display", CV_WINDOW_AUTOSIZE );//Create and Name the window

doPyrDown(img,0);

cvShowImage( "Display",img);//Display the image
cvWaitKey(0);//wait until user hits a key,if number is +ve then that much milli seconds image will wait to be closed
cvDestroyWindow( "Display" );//Destroy and De-allocate memory
}

hi i got "sample.cpp:15:47: error: ‘IPL_GAUSSIAN_5x5’ was not declared in this scope" while compiling...please help me to get output...

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
3

answered 2013-06-05 01:29:36 -0500

berak gravatar image

man, where did you dig up that code ? if it uses a constant with an IPL_ prefix, that must be like 10 years old ;)

  • pyrDown() does not need such a constant
  • pyrUp() might like CV_GAUSSIAN_5x5 instead

AND DAMN, USE THE C++ API !

edit flag offensive delete link more

Comments

2

We should motivate the openCV team to just blow up the old C API :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-06-05 02:40:53 -0500 )edit

code works...but image didnt resize even i was load image which is divisible by two. what can i do now..reply me

dhanash gravatar imagedhanash ( 2013-06-09 14:18:00 -0500 )edit

First switch to a usefull C++ interfacing, then see if the error still occurs. I am guessing that a 95% chance one of your pointers is screwing the result up :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-06-13 08:04:45 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-06-05 01:03:18 -0500

Seen: 1,624 times

Last updated: Jun 05 '13