作者:
出处:#include#include #include void TrackBarFunc(int val); struct _TrackBarData{ char *Name; //trackbar的名字 int Pos; //trackbar的初始位置 int MaxValue; //上限値};_TrackBarData TBData={"TrackBar",127,255};IplImage *imgA = cvCreateImage(cvSize(300,300),IPL_DEPTH_8U,3);int main( int argc, char **argv){ cvSet (imgA, CV_RGB(0,255,0) ); cvNamedWindow("OpenCV",CV_WINDOW_AUTOSIZE); cvCreateTrackbar( TBData.Name, "OpenCV", &TBData.Pos, TBData.MaxValue , TrackBarFunc); cvWaitKey(0); cvReleaseImage(&imgA); cvDestroyAllWindows(); return 0;}void TrackBarFunc(int val){ std::cout << "now : " << val << "/n"; cvSet (imgA, CV_RGB(0,val,0) ); cvShowImage("OpenCV",imgA);}
作者:
出处: