4

我所有的 OpenCV 功能都运行良好。但是cvResize()编译器找不到。我猜这个功能在安装过​​程中没有安装。以下程序告诉我 cvResize 标识符未定义的错误

是否可以单独下载此功能并使用它?如何?

#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;
}
4

2 回答 2

12

您缺少包括:

#include "opencv2/imgproc/imgproc_c.h"
于 2012-11-11T11:53:50.553 回答
2

我通过以下方式修复了错误

#import <opencv2/imgproc/imgproc_c.h>
于 2019-10-15T00:27:32.013 回答