Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cvResize identifier is undefined

Tags:

opencv

All my OpenCV functions are working perfectly fine. But cvResize() is not found by the compiler. I guess this function is not installed during installation. The following program tells me the error that cvResize identifier is undefined

Is it possible to download this function separately and use it? How?

#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <ctype.h>
#include <iostream>

using namespace std;

int main( int argc, char** argv )
{

    // Create an IplImage object *image 
    IplImage *source = cvLoadImage( argv[1]);
    // Here we retrieve a percentage value to a integer
    int percent = atoi(argv[3]);

    // declare a destination IplImage object with correct size, depth and channels
      IplImage *destination = cvCreateImage
    ( cvSize((int)((source->width*percent)/100) , (int)((source->height*percent)/100) ), source->depth, source->nChannels );

    //use cvResize to resize source to a destination image
    cvResize(source, destination);

    // save image with a name supplied with a second argument
      cvSaveImage( argv[2], destination );

    return 0;
}
like image 678
gpuguy Avatar asked Dec 08 '22 19:12

gpuguy


2 Answers

You are missing an include:

#include "opencv2/imgproc/imgproc_c.h"
like image 55
Andrey Kamaev Avatar answered Mar 16 '23 14:03

Andrey Kamaev


I fixed the error by

#import <opencv2/imgproc/imgproc_c.h>
like image 20
kb920 Avatar answered Mar 16 '23 16:03

kb920