Parameter passing
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.
精彩评论