Ask Your Question
-1

error:exchanges bgr to hsv, gray

asked 2018-06-20 14:00:07 -0600

puggg gravatar image

updated 2018-06-20 14:52:48 -0600

LBerger gravatar image

it's a instance:

Mat src = imread("linuxconfig_logo.png", IMREAD_COLOR);
Mat gray, hsv, ycrcb, j;
cvtColor(src, gray, CV_8UC2);
cvtColor(src, hsv, CV_8UC3);
cvtColor(src, ycrcb, CV_8UC4);
imshow("src", src);
imshow("gray", gray);
imshow("hsv", hsv);
imshow("ycrcb", ycrcb);
waitKey(0);

my sublime replys: terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(4.0.0-pre) /opt/opencv/modules/imgproc/src/color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'CvtHelper'. src has 3 channels and 8bit. Can somebody tell me what'wrong ? i just have learnd it, yesterday. Sry for my EL.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2018-08-16 02:27:11 -0600

This error is generated because your document file is corrupt or bad.

Try to do this, it will work fine:

try:
   #Your Code here
except cv2.error as e:
   pass
edit flag offensive delete link more
0

answered 2018-06-20 14:57:02 -0600

LBerger gravatar image

No read cvtColor doc it is :

cvtColor(src, gray,COLOR_BGR2GRAY );
cvtColor(src, hsv, COLOR_BGR2HSV);
cvtColor(src, ycrcb, COLOR_BGR2YCrCb );

All docs are here and you can find tutorials in doc too

edit flag offensive delete link more

Comments

oh. Maybe i have a bad document. In there they said: cvtColor(src, gray, CV_BGR2GRAY);. that's right?

puggg gravatar imagepuggg ( 2018-06-20 21:45:22 -0600 )edit

and i don't know how to use docs.opencv.org. that's a file tar.xz so i should install it or what else?

puggg gravatar imagepuggg ( 2018-06-20 21:51:09 -0600 )edit

You know how to use this forum and you don't know how to use doc : sorry I don't understand your problem.

LBerger gravatar imageLBerger ( 2018-06-21 01:21:57 -0600 )edit

lol because i do not click on 3.4.1 but click on download. ok thank you so much

puggg gravatar imagepuggg ( 2018-06-21 06:24:46 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-06-20 14:00:07 -0600

Seen: 4,108 times

Last updated: Jun 20 '18