Ask Your Question

Blaze's profile - activity

2016-04-01 03:46:48 -0600 commented question can't get trackbar working, getting : "Type invalid conversion from 'void (*)(int)' to 'cv::TrackbarCallback {aka void (*)(int, void*)}' [-fpermissive]"

Thanks for your reply: berak, Steven. As suggested by both of you, I tried adding a void pointer but still the same results. Added:

int var = 9;
createTrackbar("test","Example1",&contrast,100,MyCallBack,&var);

and

void MyCallBack(int contrast, void* data){
//some code goes here
}
2016-04-01 00:49:24 -0600 asked a question 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
}
2016-03-31 11:07:20 -0600 received badge  Supporter (source)