Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

can't get trackbar working, getting : "Type invalid conversion from 'void (*)(int)' to 'cv::TrackbarCallback {aka void (*)(int, void*)}' [-fpermissive]"

Hello,

I am trying to implement trackbar in a gui that shows up an AVI video. But I am getting "Type invalid conversion from 'void ()(int)' to 'cv::TrackbarCallback {aka void ()(int, void*)}' [-fpermissive]". Also, I am getting "Invalid arguments" for "createTrackbar".

I am using MinGW as compiler and eclipse kepler as IDE.

I must be doing something terribly wrong, please help me. Given below is the code I am using.

#include "stdio.h"
#include "opencv2/opencv.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"

using namespace cv;
using namespace std;

void MyCallBack(int);

int main(int argc, char** argv) {

    int contrast=50;
    namedWindow("Example1", CV_WINDOW_AUTOSIZE);
    createTrackbar("test","Example1",&contrast,100,MyCallBack,0);
    cout<<endl;
    VideoCapture cap(argv[1]);
    if (!cap.isOpened()) return -1;
    //  CvCapture* capture = cvCreateFileCapture(argv[1]);
    Mat img;
    while(1){
        bool success = cap.read(img);
        if(!success) break;
        imshow("Example1", img);
        char c = cvWaitKey(33);
        if (c == 27) break;
    }
    cap.release();
    destroyWindow("Example2");
    return 0;
}

 void MyCallBack(int contrast){
//some code goes here
}