关于cvCreateTrackbar()使用

void on_change_threshold1(int pos)
{
 cvThreshold(ForeFrameGray1,ForeFrameB1,pos, 255.0, CV_THRESH_BINARY);
 cvMorphologyEx(ForeFrameB1,ForeFrameB1,0,0,CV_MOP_OPEN,1);
 cvMorphologyEx(ForeFrameB1,ForeFrameB1,0,0,CV_MOP_CLOSE,1);
 cvShowImage("Window 1",ForeFrameB1);  
}

 

void main()

{

      ...

  int Threshold1=20;
  on_change_threshold1(Threshold1);
  cvCreateTrackbar("threshold1","Window 1",&Threshold1, 255,on_change_threshold1);

  ...

}

你可能感兴趣的:(OpenCV)