Ask Your Question

OpenCVFan19's profile - activity

2016-03-21 15:58:57 -0500 received badge  Student (source)
2015-05-01 04:25:31 -0500 asked a question goodFeaturesToTrack returns 2 channel image and can't be imshowed

Hi,

I'm using goodFeaturesToTrack() method to locate corners from an image. However when I try to view the image, using imshow(), I get an error:

OpenCV Error: Bad number of channels (Source image must have 1, 3 or 4 channels) in cvConvertImage

Here is the code:

Mat outPutImage;
goodFeaturesToTrack(src_gray, outPutImage, 20, 0.5, 500);
imshow("Output", outPutImage);

goodFeaturesToTrack takes in only a 1 channel image and outputs a 2 channel image. How can I convert the 2 channel to 3 channel or is there an alternative for imshow?