Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Matrix depth equals 0

If I do the following :

cv::Mat image = imread("someImage.bmp");

cv::Mat dst;

image.copyTo(dst);

int depth = dst.depth()//dst has a depth of 0

I'm not sure I follow why the depth is zero, according to the doc copyTo does:

dst.create(this->size(), this->type);

Doesn't the type tell the depth since it's likely CV_83C3?

Otherwise how should I make dst have the same properties as 'image' after a copyTo? I'm asking because I've hard-coded the depth to 8 in my code and it works fine, so I just need to match the settings of the first mat to the second one. The create function only takes rows, cols and type. I assumed giving it the type would be enough for the mat to figure out it's depth. The channels() is set properly to 3.

Matrix depth equals 0

If I do the following :

cv::Mat image = imread("someImage.bmp");

cv::Mat dst;

image.copyTo(dst);

int depth = dst.depth()//dst has a depth of 0

I'm not sure I follow why the depth is zero, according to the doc copyTo does:does(Before the copy):

dst.create(this->size(), this->type);

Doesn't the type tell the depth since it's likely CV_83C3?

Otherwise how should I make dst have the same properties as 'image' after a copyTo? I'm asking because I've hard-coded the depth to 8 in my code and it works fine, so I just need to match the settings of the first mat to the second one. The create function only takes rows, cols and type. I assumed giving it the type would be enough for the mat to figure out it's depth. The channels() is set properly to 3.

Matrix depth equals 0

If I do the following :

cv::Mat image = imread("someImage.bmp");

cv::Mat dst;

image.copyTo(dst);

int depth = dst.depth()//dst has a depth of 0

I'm not sure I follow why the depth is zero, according to the doc copyTo does(Before the copy):

dst.create(this->size(), this->type);

Doesn't the type tell the depth since it's likely CV_83C3?CV_8UC3?

Otherwise how should I make dst have the same properties as 'image' after a copyTo? I'm asking because I've hard-coded the depth to 8 in my code and it works fine, so I just need to match the settings of the first mat to the second one. The create function only takes rows, cols and type. I assumed giving it the type would be enough for the mat to figure out it's depth. The channels() is set properly to 3.