开发者

Parameter passing

开发者 https://www.devze.com 2023-03-22 08:38 出处:网络
In a program in the Learning OpenCV book: void onTrackbarSlide(int pos) { cvSetCaptureProperty(g_capture,CV_CAP_PROP_P开发者_StackOverflow社区OS_FRAMES,pos);

In a program in the Learning OpenCV book:

void onTrackbarSlide(int pos)
{
cvSetCaptureProperty(g_capture,CV_CAP_PROP_P开发者_StackOverflow社区OS_FRAMES,pos);
}

And, in another location:

if(frames!=0)
{
cvCreateTrackbar("Position","Example3",&g_slider_position,frames,onTrackbarSlide);
}

If you see onTrackbarSlide, there is no parameter passed. In this case, what value will be passed to the onTrackSlide(int pos) method?


You are passing the address of function

void onTrackbarSlide(int pos)

as the last parameter in the function cvCreateTrackbar

This doesn't call the onTrackbarSlide. The cvCreateTrackbar method must be storing the address of the function onTrackbarSlide and using it as an Callback to intimate of some asynchronous happening.

0

精彩评论

暂无评论...
验证码 换一张
取 消