HandDetector icon indicating copy to clipboard operation
HandDetector copied to clipboard

Small error I can't figure out

Open ookikoi opened this issue 9 years ago • 2 comments

Hiya,

Your code looks great, compiling it fine (osx el capitan). At run time I get: OpenCV Error: Assertion failed (scn == 1 && (dcn == 3 || dcn == 4)) in cvtColor, file /tmp/opencv20160107-29960-t5glvv/opencv-2.4.12/modules/imgproc/src/color.cpp, line 3791 libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv20160107-29960-t5glvv/opencv-2.4.12/modules/imgproc/src/color.cpp:3791: error: (-215) scn == 1 && (dcn == 3 || dcn == 4) in function cvtColor

I've tried different with different transform values but to no avail.

Any small pointer in the right direction would be much appreciated!

Thanks

ookikoi avatar Mar 12 '16 12:03 ookikoi

Hi,

Do you use original code or modified version? What camera do you use? This project works only with MS Kinect camera (using OpenNI wrapper).

Regards, BeS

bes-dev avatar Mar 12 '16 18:03 bes-dev

Hi Sergei,

Thanks a lot for your reply. I managed to fix the issue: It seems: cv::cvtColor(depthMap, tmp, CV_GRAY2BGR); expects depthMap to be in grayscale already.

so I added these 2 lines jsut before: cv:Mat image=depthMap; cvtColor(image,depthMap,CV_RGB2GRAY); and got it to work!

Yes, for Kinect indeed, and I read (with google translate) that AFTER fixing the above of course, hehe.. :) Your video had impressed me so I was very stubborn. I then tried to play with background substraction but no, can't quite get there without the kinect! I guess image from the kinect was in greyscale already and 'native' background substraction I guess?

Thanks a lot for your reply and sharing your code btw. I know a few languages but not c++, being stubborn about your script I now know a little bit of c++ :)

Thanks again!

ookikoi avatar Mar 12 '16 23:03 ookikoi