2

I'm in the process of converting my application that was using an old OpenCV wrapper to EmguCV (updated and very good wrapper).

So far so good, except that in one of my class, I was using 3 trackbars to adjust the threshold in some filters. The trackbar were created using this code in the old wrapper which is exactly how it's created in openCV C++

cvlib.cvCreateTrackbar("minH", "Couleur", ref dValueMin, 256, new cvlib.CvTrackbarDelegate(onTrackbarSlide));

The trackbar was creating using the HighGui of OpenCV ans the trackbar were visible on the I'm pretty sure that Emgu team remove this from the wrapper and replace it with something better but I can't find anything about this in the documentation. Can anybody suggest me how to achieve that?

Thanks!

P.S: I have googled this and all the question were unanswered... I hope to have more luck here on Stack Overflow.

Jean-François Côté
  • 4,200
  • 11
  • 52
  • 88

1 Answers1

2

If still relevant

public delegate void CallbackDelegate(int pos);
[DllImport("opencv_highgui249", CallingConvention = CallingConvention.Cdecl, EntryPoint = "cvCreateTrackbar")]
public static extern int CvCreateTrackbar([MarshalAs(UnmanagedType.LPStr)] String trackbar_name, [MarshalAs(UnmanagedType.LPStr)] String window_name,
       [In,Out] ref int value, int count, [MarshalAs(UnmanagedType.FunctionPtr)] CallbackDelegate callbackPtr);

public static IntPtr capture = IntPtr.Zero;

public static void myTrackbarCallback(int pos)
    {
        CvInvoke.cvSetCaptureProperty(capture, Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_POS_FRAMES, pos);
    }

...
CallbackDelegate cbd = new CallbackDelegate(myTrackbarCallback);
...
CvCreateTrackbar("Position", "original", ref currentPosition, frames, cbd);
Valery Petrov
  • 653
  • 7
  • 19
  • Will try that in a couple of weeks! I have changed project for a while and will be back on this. Don't worry, if it work, I will reward your answer. Thanks! – Jean-François Côté Jul 15 '13 at 12:13