Ask Your Question
1

Is there a danger with using the same Mat object for both source and destination?

asked 2014-03-23 22:06:01 -0500

paulgfrey gravatar image

updated 2014-03-24 01:59:52 -0500

berak gravatar image

I'm using the OpenCV library for a Java project. Although this question probably really isn't specific to Java. Many of the OpenCV methods I'm using in my application like Imgproc.threshold() and Imgproc.equalize() all have a source and destination Mat as their parameters. I'm using the same object for both the source and destination and the application is working properly. Is there a danger to using the same object for both the source and destination Mat?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-03-24 02:09:03 -0500

Hi there,

There is OpenCV methods for which is safe to use the same source and destination images, but you should check the documentation and make sure that you know what you are doing.

When in doubt, use separate images. IMHO it is always better to use a bit more of memory than to deal with unexpected behaviors.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-03-23 22:06:01 -0500

Seen: 297 times

Last updated: Mar 24 '14