Download presentation
Presentation is loading. Please wait.
Published byAntony Clarke Modified over 8 years ago
1
Multimedia Programming 12: Mouse, Draw and Morphing2 Departments of Digital Contents Sang Il Park
2
Outline Review Various Drawing Morphing
3
Mouse Callback in OpenCV Mouse Interaction with OpenCV
4
Mouse Callback Two things you have to do: –Implementation Define what you are going to do when events happen –Setting (registration) Let the OpenCV know which one is the callback function void cvSetMouseCallback(window_name, yourFunction) void yourFunction (int event, int x, int y, int flags, void *param);
5
Implementation Message from the OpenCV Telling what kind of the mouse event is coming Examples) CV_EVENT_MOUSEMOVE CV_EVENT_LBUTTONDOWN CV_EVENT_RBUTTONDOWN CV_EVENT_MBUTTONDOWN CV_EVENT_LBUTTONUP CV_EVENT_RBUTTONUP CV_EVENT_MBUTTONUP CV_EVENT_LBUTTONDBLCLK CV_EVENT_RBUTTONDBLCLK CV_EVENT_MBUTTONDBLCLK void yourFunction (int event, int x, int y, int flags, void *param);
6
Implementation Message from the OpenCV Telling the status of the mouse or the keyboard Examples) CV_EVENT_FLAG_LBUTTON CV_EVENT_FLAG_RBUTTON CV_EVENT_FLAG_MBUTTON CV_EVENT_FLAG_CTRLKEY CV_EVENT_FLAG_SHIFTKEY CV_EVENT_FLAG_ALTKEY void yourFunction (int event, int x, int y, int flags, void *param);
7
Registration Example) cvSetMouseCallback( “test”, on_mouse); void cvSetMouseCallback(window_name, yourFunction)
8
Draw Line void cvLine( IplImage, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1); Draw Line from pt1 to pt2 with the given thickness CvPoint: a structure for storing 2D position –Use cvPoint(x,y) for a quick usage. struct CvPoint { int x; // x-coordinate int y; // y-coordinate } struct CvPoint { int x; // x-coordinate int y; // y-coordinate }
9
Draw Rectangle void cvRectangle( IplImage, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1 ) void cvRectangle( IplImage, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1 ) Draw a rectangle with two opposite corners pt1 and pt2 pt1 pt2 What happens if thickness is -1?
10
Draw Circle void cvCircle( IplImage, CvPoint center, int radius, CvScalar color, int thickness=1 ) void cvCircle( IplImage, CvPoint center, int radius, CvScalar color, int thickness=1 ) Draw a circle with given center and radius center radius
11
Basic Morphing with Mouse Moving one point to the other
12
Basic Morphing with Mouse Moving one point to the other
13
Basic Morphing with Mouse Moving one point to the other
14
Linear Interpolation 1-αα α 고정이동 ?
15
Basic Morphing with Mouse Moving one point to the other
16
? Basic Morphing with Mouse Moving one point to the other
17
Basic Morphing with Mouse Moving one point to the other
18
? Basic Morphing with Mouse Moving one point to the other
19
Bilinear interpolation Sampling at f(x,y): displacement at (x,y)
20
중간고사 10 월 16 일 ( 화요일 ) 저녁 7 시 ???? 필기고사 – 알고리즘 설명 – 프로그램 틀린 것 찾기 – 프로그램 채우기 – 결과 예측
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.