Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Do all opencv functions support in-place mode for their arguments?

in cases where this question arises.

For example, should I write:

Mat img = imread(filename);
{ 
  Mat tmp;
  cvtColor(img, tmp, CV_BGR2Lab);
  img = tmp;
}

(not in-place variant)

or:

Mat img = imread(filename);
cvtColor(img, img, CV_BGR2Lab);

(in-place variant)?

If some functions do not support in-place mode, how can I know about this?

Do all opencv functions support in-place mode for their arguments?

in cases where this question arises.

For example, should I write:

Mat img = imread(filename);
{ 
  Mat tmp;
  cvtColor(img, tmp, CV_BGR2Lab);
  img = tmp;
}

(not in-place variant)

or:

Mat img = imread(filename);
cvtColor(img, img, CV_BGR2Lab);

(in-place variant)?

If some functions do not support in-place mode, how can I know about this?

Do all opencv functions support in-place mode for their arguments?

in cases where this question arises.

For example, should I write:

Mat img = imread(filename);
{ 
  Mat tmp;
  cvtColor(img, tmp, CV_BGR2Lab);
  img = tmp;
}

(not in-place variant)

or:

Mat img = imread(filename);
cvtColor(img, img, CV_BGR2Lab);

(in-place variant)?

If some functions do not support in-place mode, how can I know about this?

Do all opencv functions support in-place mode for their arguments?

in cases where this question arises.

For example, should I write:

Mat img = imread(filename);
{ 
  Mat tmp;
  cvtColor(img, tmp, CV_BGR2Lab);
  img = tmp;
}

(not in-place variant)

or:

Mat img = imread(filename);
cvtColor(img, img, CV_BGR2Lab);

(in-place variant)?

If some functions do not support in-place mode, how can I know about this?