我有一个功能
void doCorrectIntensityVariation(Mat& image)
{
Mat kernel = getStructuringElement(MORPH_ELLIPSE, Size(19,19));
Mat closed;
morphologyEx(image, closed, MORPH_CLOSE, kernel);
image.convertTo(image, CV_32F); // divide requires floating-point
divide(image, closed, image, 1, CV_32F);
normalize(image, image, 0, 255, NORM_MINMAX);
image.convertTo(image, CV_8UC1); // convert back to unsigned int
imshow("gamma corrected",image); cvWaitKey(0);
}
和
IplImage* processImage(IplImage *imrgb, IplImage *n_im)
{
..................
..................
Mat pre(n_im);
doCorrectIntensityVariation(pre);
n_im=new IplImage( pre);// this line throws segmentation fault (core dumped)
...............
...............
return n_im;
}
我的程序一直运行到最后一行 但在最后抛出 glibc检测到 *:双重免费或损坏(!prev):0x0886dee8 * 分段错误(核心转储) 我已经尝试了所有我熟悉的技巧,但我被困住了,不知道出了什么问题