Ask Your Question
0

cvCvtColor Crash?

asked 2013-05-14 11:17:44 -0600

lowpolyjoe gravatar image

Just started using OpenCV. Good stuff.

Playing with conversion of 24bit color image (8,8,8) to various representations.

Getting an exception in cvCvtColor. I thought my problem might have been with how i was stuffing my Mat objects with my image data (not using an OpenCV load function), so i left them empty. I assume they are filled with garbage or zeros - i don't care either way for this test. Problem is that i still get an exception with the following code:

cv::Mat matInput(nHeight, nWidth, CV_8UC3);
cv::Mat matOutput(nHeight, nWidth, CV_8UC3);
cvCvtColor(&matInput, &matOutput, CV_BGR2HSV);

"......\src\opencv\modules\core\src\matrix.cpp:698: error: (-5) Unknown array type"

I'm still coming to grips with the type constants and all, but i thought i was inputting a 3 channel image, 8bits per channel BGR matrix (CV_8UC3) and requesting the same type as output. cvCvtColor documentation suggests this is supported unless i've misread it.

OpenCV version 2.4.5.0 prebuilt binaries C++ under MSVC2010 on Windows7 x64 Debug build of my app

I'm sure it's something stupid but I don't want to waste any more time on it. Please point out my mistake.

Thanks, Joe

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2013-05-14 11:24:39 -0600

berak gravatar image

updated 2013-05-14 11:25:49 -0600

don't use cvCvtColor, but cv::cvtColor instead.

cv::Mat matInput(nHeight, nWidth, CV_8UC3);
cv::Mat matOutput; // empty, cvtColor will care for that
cv::cvtColor(matInput, matOutput, CV_BGR2HSV);

in short, try to avoid mixing old cv* functions and new cv::* ones.

edit flag offensive delete link more

Comments

DOH! <embarrassed>

Thanks.

lowpolyjoe gravatar imagelowpolyjoe ( 2013-05-14 11:45:18 -0600 )edit

Question Tools

Stats

Asked: 2013-05-14 11:17:44 -0600

Seen: 1,912 times

Last updated: May 14 '13