Table of Contents

Method CreateTrackbar

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

CreateTrackbar(string, string, ref int, int, TrackbarCallbackNative?, nint)

Creates a trackbar and attaches it to the specified window. An optional callback reports changes to the trackbar position.

public static int CreateTrackbar(string trackbarName, string winName, ref int value, int count, TrackbarCallbackNative? onChange = null, nint userData = 0)

Parameters

trackbarName string

Name of the created trackbar.

winName string

Name of the window that will be used as a parent of the created trackbar.

value int

Initial slider position. To read later changes, use the callback or GetTrackbarPos(string, string).

count int

Maximal position of the slider. The minimal position is always 0.

onChange TrackbarCallbackNative

Pointer to the function to be called every time the slider changes position. This function should be prototyped as void Foo(int, void*); , where the first parameter is the trackbar position and the second parameter is the user data(see the next parameter). If the callback is the NULL pointer, no callbacks are called; use GetTrackbarPos(string, string) to read the position.

userData nint

User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables.

Returns

int

CreateTrackbar(string, string, int, TrackbarCallbackNative?, nint)

Creates a trackbar and attaches it to the specified window. An optional callback reports changes to the trackbar position.

public static int CreateTrackbar(string trackbarName, string winName, int count, TrackbarCallbackNative? onChange = null, nint userData = 0)

Parameters

trackbarName string

Name of the created trackbar.

winName string

Name of the window that will be used as a parent of the created trackbar.

count int

Maximal position of the slider. The minimal position is always 0.

onChange TrackbarCallbackNative

Pointer to the function to be called every time the slider changes position. This function should be prototyped as void Foo(int, void*); , where the first parameter is the trackbar position and the second parameter is the user data(see the next parameter). If the callback is the NULL pointer, no callbacks are called; use GetTrackbarPos(string, string) to read the position.

userData nint

User data that is passed as is to the callback. It can be used to handle trackbar events without using global variables.

Returns

int