Simplicity
Simplicity

Reputation: 48976

OpenCV - cvCreateTrackbar()

If you see cvCreateTrackbar() from: http://opencv.willowgarage.com/documentation/user_interface.html

If you look at the function signature:

int cvCreateTrackbar(const char* trackbarName, const char* windowName, int* value, int count, CvTrackbarCallback onChange)

It describes for example the function parameter trackbarName as follows:

trackbarName – Name of the created trackbar.

In the Learning OpenCV book, it had the following function signature:

cvCreateTrackbar("Position","Example3",&g_slider_position,frames,onTrackSlide);

trackbarName as we see is a pointer to a char, and thus has to hold an address as its value. How come we are passing "position" as an argument? And, isn't "position" a string, how can we pass that to a char?

Thanks.

Upvotes: 0

Views: 4445

Answers (1)

Adi Shavit
Adi Shavit

Reputation: 17295

"Position" is a const char* - a literal C string. It is a pointer to an array or chars!

Upvotes: 1

Related Questions