Mat dst,m,src; int lightness = 50; static void on_track(int, void*) { m = Scalar(lightness, lightness, lightness); add(src, m, dst); imshow("亮度调整", dst); } void QuickDemo::tracking_bar_demo(Mat& image) { namedWindow("亮度调整", WINDOW_AUTOSIZE); dst = Mat::zeros(image.size(), image.type()); m = Mat::zeros(image.size(), image.type()); src = image; int max_value = 100; createTrackbar("value bar", "亮度调整", &lightness, max_value, on_track); on_track(50, 0); }