Ask Your Question

Bug in Documentation Code

asked 2014-08-12 20:55:01 -0500

useanalias gravatar image

updated 2017-08-22 16:12:04 -0500

I was reading through the OpenCV tutorial for image scanning when I ran into a peculiar line of code (link):

// accept only char type matrices
CV_Assert(I.depth() != sizeof(uchar));

This code partially works because I.depth() returns CV_8U (which is 0), while sizeof(uchar) returns 1. If an array of another type is passed in though, the code will fail unless (coincidentally) I.depth() returns 1.

Here is what I recommend replacing these lines with:

// accept only char type matrices
CV_Assert(I.depth() == CV_8U);
edit retag flag offensive close merge delete


useanalias gravatar imageuseanalias ( 2014-08-12 23:11:46 -0500 )edit

Could you provide a documentation fix through a pull request? More info here. Thanks in advance!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-08-13 04:23:48 -0500 )edit

@StevenPuttemans may i provide a documentation fix through a pull request

sturkmen gravatar imagesturkmen ( 2015-07-29 08:41:35 -0500 )edit

yeah go ahead and add the PR link here!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-07-30 03:43:26 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-07-30 05:34:40 -0500

edit flag offensive delete link more


i think answers converted from comments does not affect to karma. to test it @berak could you upvote?

sturkmen gravatar imagesturkmen ( 2015-07-30 14:25:39 -0500 )edit

upvote the answer above :) it was a comment i think steven convert it to answer

sturkmen gravatar imagesturkmen ( 2015-07-30 14:38:45 -0500 )edit

now 2nd upvote affected :) thank you.. you can downvote.

sturkmen gravatar imagesturkmen ( 2015-07-30 14:43:12 -0500 )edit

k,k (was lacking context for a second)

see, upvotes on comments will give you no karma gain, while upvotes on answers will give you 10 ;)

(well done with the pr, btw, worth any karma here:)

berak gravatar imageberak ( 2015-07-30 14:44:04 -0500 )edit surely it upvoted before conversion

sturkmen gravatar imagesturkmen ( 2015-07-30 14:44:24 -0500 )edit

thank you so much my master. i hope i don't bother you with trivial questions.

sturkmen gravatar imagesturkmen ( 2015-07-30 14:51:37 -0500 )edit

sorry, i fail to see it.

berak gravatar imageberak ( 2015-07-30 14:52:39 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2014-08-12 20:55:01 -0500

Seen: 196 times

Last updated: Aug 12 '14