Ask Your Question
5

Bug in Documentation Code

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

useanalias gravatar image

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

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

Comments

useanalias gravatar imageuseanalias ( 2014-08-12 23:11:46 -0600 )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 -0600 )edit

@StevenPuttemans may i provide a documentation fix through a pull request http://docs.opencv.org/master/db/da5/...

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

yeah go ahead and add the PR link here!

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

1 answer

Sort by ยป oldest newest most voted
2

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

edit flag offensive delete link more

Comments

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 -0600 )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 -0600 )edit

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

sturkmen gravatar imagesturkmen ( 2015-07-30 14:43:12 -0600 )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 -0600 )edit

http://answers.opencv.org/users/16589... surely it upvoted before conversion

sturkmen gravatar imagesturkmen ( 2015-07-30 14:44:24 -0600 )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 -0600 )edit

sorry, i fail to see it.

berak gravatar imageberak ( 2015-07-30 14:52:39 -0600 )edit

Question Tools

Stats

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

Seen: 475 times

Last updated: Aug 12 '14