您能否幫助我?在下面執行編碼時出錯。我是一個使用OpenCV的新手。我的老師是谷歌先生和你們在這個領域的專家。錯誤錯誤C3861:'cvPyrSegmentation':標識符未找到
智能感知:標識符 「cvPyrSegmentation」 未定義
錯誤錯誤C3861: 'cvPyrSegmentation':找不到
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
static void help(void)
{
printf("\nThis program present the function of pyramid segmentation which is
cvcvPyrSegmentation()\n""we can controlled the value of threshold by creating
the taskbar\n""Usage :\n");
}
IplImage* image[2] = { 0, 0 }, *image0 = 0, *image1 = 0;
CvSize size;
int w0, h0,i;
int threshold1, threshold2;
int l,level = 4;
int sthreshold1, sthreshold2;
int l_comp;
int block_size = 1000;
float parameter;
double threshold;
double rezult, min_rezult;
int filter = CV_GAUSSIAN_5x5;
CvConnectedComp *cur_comp, min_comp;
CvSeq *comp;
CvMemStorage *storage;
CvPoint pt1, pt2;
static void START_SEGMENT(int a)
{
(void) a;
cvPyrSegmentation (image0, image1, storage, &comp, level, threshold1+1,
threshold2+1);
cvShowImage("Segmentation", image1);
}
int main(int argc, char** argv)
{
char* filename;
help();
filename = argc == 2 ? argv[1] : (char*)"C:/Users/acer/Documents/Visual Studio
2012/Projects/me2.jpg";
if((image[0] = cvLoadImage(filename, 1)) == 0)
{
help();
printf("Cannot load fileimage - %s\n", filename);
return -1;
}
cvNamedWindow("Source", 0);
cvShowImage("Source", image[0]);
cvNamedWindow("Segmentation", 0);
storage = cvCreateMemStorage (block_size);
image[0]->width &= -(1<<level);
image[0]->height &= -(1<<level);
image0 = cvCloneImage(image[0]);
image1 = cvCloneImage(image[0]);
// segmentation of the color image
l = 1;
threshold1 =255;
threshold2 =30;
START_SEGMENT(1);
sthreshold1 = cvCreateTrackbar("Threshold1", "Segmentation", &threshold1, 255,
START_SEGMENT);
sthreshold2 = cvCreateTrackbar("Threshold2", "Segmentation", &threshold2, 255,
START_SEGMENT);
cvShowImage("Segmentation", image1);
cvWaitKey(0);
cvDestroyWindow("Segmentation");
cvDestroyWindow("Source");
cvReleaseMemStorage(&storage);
cvReleaseImage(&image[0]);
cvReleaseImage(&image0);
cvReleaseImage(&image1);
return 0;
}
#ifdef _EiC
main(1,"pyramid_segmentation.c");
#endif
當您編譯代碼或運行代碼時,是否出現此錯誤? – randomusername
您是否將正確的鏈接標誌傳遞給編譯器? – randomusername
當我試圖「構建解決方案」時得到這個錯誤...當然,如果有錯誤,我不能運行它。你知道我的編碼有什麼問題嗎? – ApipNate