Ask Your Question
1

cvFlip function

asked 2013-08-27 01:48:05 -0500

Nenad Bulatovic gravatar image

updated 2013-08-27 03:03:32 -0500

I found this in some code that I am adjusting for my needs:

 cvFlip ( img, NULL, 1 );

I don't see any logic behind it. Am I missing something?

EDIT: NULL confused me.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2013-08-27 02:00:18 -0500

Michael Burdinov gravatar image

updated 2013-08-27 02:01:46 -0500

This mean that img is flipped in place around Y axis. See documentation of cvFlip.

edit flag offensive delete link more

Comments

Right, I looked at: void flip(InputArray src, OutputArray dst, int flipCode) and totally neglected void cvFlip(const CvArr* src, CvArr* dst=NULL, int flip_mode=0 ), because I am used to OpenCV2. Thanks.

Nenad Bulatovic gravatar imageNenad Bulatovic ( 2013-08-27 03:02:34 -0500 )edit
1

The NULL was basically a way of telling to use the same array for storing the data. However, supplying two times the same name in a flip operation is not that smart, since the data that gets transformed is changed while transforming. Any operation on matrices should perform a check whether they are the same or not, but make it safe for yourself, create a temp mat then copy that mat to the original afterwards. No screwup of data will ever happen then.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-27 03:11:22 -0500 )edit
1

@StevenPuttemans Thank you for advice. I will follow it.

Nenad Bulatovic gravatar imageNenad Bulatovic ( 2013-08-27 10:05:44 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-08-27 01:48:05 -0500

Seen: 602 times

Last updated: Aug 27 '13

Related questions