我有一个ImageProcessing类。这个类有两个方法:on_trackbar和process。
我想从process方法调用on_trackbar方法。代码:
void ImageProcessingBasler::on_trackbar(int, void* )
{
alpha = (double)alpha_slider / alpha_slider_max;
beta = (1.0 - alpha);
addWeighted(src1, alpha, src2, beta, 0.0, dst);
imshow("Linear Blend", dst);
}
void ImageProcessingBasler::processImages(Mat srcImage, Mat premaskImage)
{
src1 = anomalyImg;
if (!src2.data) { printf("Error loading src2 \n"); return -1; }*/
alpha_slider = 0;
namedWindow("anomalyImg", 1);
char TrackbarName[50];
sprintf(TrackbarName, "Alpha x %d", alpha_slider_max);
createTrackbar(TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar );
// Show some stuff
on_trackbar(alpha_slider, 0);
}
但是当我调用createTrackbar
函数时,参数on_trackbar
带有红色下划线,错误显示:
void ImageProcessing::on_trackbar(int, void *) argument of type "void(ImageProcessing::*)(int, void *)
is incompatible with parameter of type "cv::TrackbarCallback"
我在这里做错了什么?!