@@ -19,7 +19,7 @@ use std::{
19
19
20
20
const SOURCE_WINDOW : & str = "Source image" ;
21
21
22
- #[ derive( Debug , Clone , Copy ) ]
22
+ #[ derive( Debug ) ]
23
23
enum DrawingState {
24
24
Init ,
25
25
DrawingMarkerPoint ,
@@ -143,10 +143,9 @@ fn main() {
143
143
if !marker_points. is_empty ( ) {
144
144
next_frame = src. clone ( ) ;
145
145
146
- let pts_mat = Mat :: from_slice ( marker_points. as_slice ( ) ) . unwrap ( ) ;
147
146
imgproc:: polylines (
148
147
& mut next_frame,
149
- & pts_mat ,
148
+ & Mat :: from_slice ( marker_points . as_slice ( ) ) . unwrap ( ) ,
150
149
true ,
151
150
Scalar :: new ( 0. , 0. , 0. , 0. ) ,
152
151
2 ,
@@ -198,8 +197,8 @@ fn main() {
198
197
///
199
198
/// Panics if the argument less than 0 or greater than 11.
200
199
fn mouse_event_from_i32 ( value : i32 ) -> opencv:: highgui:: MouseEventTypes {
201
- ( value. gt ( & ( opencv:: highgui:: MouseEventTypes :: EVENT_MOUSEHWHEEL as i32 ) /* 11 */ )
202
- || ( value. lt ( & ( opencv:: highgui:: MouseEventTypes :: EVENT_MOUSEMOVE as i32 ) /* 0 */ ) ) )
200
+ ( value. gt ( & ( opencv:: highgui:: MouseEventTypes :: EVENT_MOUSEHWHEEL as i32 /* 11 */ ) )
201
+ || ( value. lt ( & ( opencv:: highgui:: MouseEventTypes :: EVENT_MOUSEMOVE as i32 /* 0 */ ) ) ) )
203
202
. then ( || panic ! ( "Invalid cv::highgui::MouseEventTypes value: {}" , value) ) ;
204
203
205
204
// Safe because of the previous check
@@ -210,7 +209,7 @@ fn state_transform(drawing_state: DrawingState, mouse_event: highgui::MouseEvent
210
209
use self :: DrawingState :: * ;
211
210
use opencv:: highgui:: MouseEventTypes :: * ;
212
211
213
- match ( drawing_state, mouse_event) {
212
+ match ( & drawing_state, mouse_event) {
214
213
( Init , EVENT_LBUTTONDOWN ) => DrawingMarkerPoint ,
215
214
( DrawingMarkerPoint , EVENT_LBUTTONUP ) => DrawingMarkerPointFinished ,
216
215
( DrawingMarkerPointFinished , EVENT_LBUTTONDOWN ) => DrawingMarkerPoint ,
@@ -221,7 +220,7 @@ fn state_transform(drawing_state: DrawingState, mouse_event: highgui::MouseEvent
221
220
_ => {
222
221
println ! (
223
222
"Invalid state transition from {:?} with event {:?}" ,
224
- drawing_state, mouse_event
223
+ & drawing_state, mouse_event
225
224
) ;
226
225
drawing_state
227
226
}
0 commit comments