Thanks for the reply. Running the opencv example code exactly as given works but produces the console warnings I’m trying to avoid in the first place:
[ WARN:0@0.001] global samples.cpp:61 findFile cv::samples::findFile(‘LinuxLogo.jpg’) => ‘/usr/local/lib/…/share/opencv4/samples/data/LinuxLogo.jpg’
[ WARN:0@0.001] global samples.cpp:61 findFile cv::samples::findFile(‘WindowsLogo.jpg’) => ‘/usr/local/lib/…/share/opencv4/samples/data/WindowsLogo.jpg’
[ WARN:0@0.027] global window.cpp:703 createTrackbar UI/Trackbar(Alpha x 100@Linear Blend): Using ‘value’ pointer is unsafe and deprecated. Use NULL as value pointer. To fetch trackbar value setup callback.
How can I suppress or fix the trackbar warning? (not important, but why do the jpg load operations also give warnings?)
BTW, the way I implement my trackbars is more like this, which also works and gives same warning:
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
const int alpha_slider_max = 100;
int alpha_slider;
double alpha;
double beta;
Mat src1;
Mat src2;
Mat dst;
static void on_trackbar( int, void* )
{
alpha = (double) alpha_slider/alpha_slider_max;
beta = ( 1.0 - alpha );
cout << alpha_slider << endl;
}
int main( void )
{
src1 = imread( samples::findFile("LinuxLogo.jpg") );
src2 = imread( samples::findFile("WindowsLogo.jpg") );
if( src1.empty() ) { cout << "Error loading src1 \n"; return -1; }
if( src2.empty() ) { cout << "Error loading src2 \n"; return -1; }
alpha_slider = 0;
alpha = (double) alpha_slider/alpha_slider_max;
beta = ( 1.0 - alpha );
int keycode = 0;
namedWindow("Linear Blend", WINDOW_AUTOSIZE); // Create Window
char TrackbarName[50];
snprintf( TrackbarName, sizeof(TrackbarName), "Alpha x %d", alpha_slider_max );
createTrackbar( TrackbarName, "Linear Blend", &alpha_slider, alpha_slider_max, on_trackbar );
while (keycode != 27) {
addWeighted( src1, alpha, src2, beta, 0.0, dst);
imshow( "Linear Blend", dst );
//on_trackbar( alpha_slider, 0 );
keycode = waitKey(1);
}
return 0;
}