Errata

Learning OpenCV

Errata for Learning OpenCV

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
PDF Page 46
Example 3-12

You called cvLoadImage, but forgot calling

cvReleaseImage( &src );
cvDestroyWindow("Roi_Add");

after cvWaitKey();

Cuong Thai  Nov 16, 2016 
Printed Page 54
Line 5 from bottom

Instead of 'm vectors of length n',
it should be
'm+1 vectors of length n+1'

since the index is from 0 to m, and 0 to n.

ColorRGB  Jun 11, 2013 
Printed Page 79
Table 4-6

Does Point(x, y) represent (column, row) or (row, column) ?

From my understanding of this table:

1) M.at<>(i, j) gives access to the square located on row i, column j.
2) M.at<>(p) gives access to the square located on row p.x, column p.y

But in this case 2) is wrong according to https://stackoverflow.com/questions/25642532/opencv-pointx-y-represent-column-row-or-row-column

Maybe that the table is exact and that I am not understanding it correctly, but in this case it could use some clarification.

Note from the Author or Editor:
Matrix addressing is done in row-major order as is standard:
https://stackoverflow.com/questions/8184053/accessing-elements-of-a-cvmat-with-atfloati-j-is-it-x-y-or-row-col/42327350#42327350
So:

1) Mat<>(row,col) will give access to the pixel or vector of pixels at row i, col j ... think of it as Img(y, x)

2) Good point, I will have to check, but I think, off hand, it does the opposite. col #p.x , row #p.y But, I will have to check.

Mr Gabriel Devillers  Jul 10, 2017 
Printed Page 116,117
Figures 5-6 and 5-7

The "confirmed errata" already has a discussion of fig 5-6 being incorrect, but I believe that in addition to the errata listed there, figs 5-6 and 5-7 have been swapped. I.e. 5-6 shows erosion and 5-7 shows dilation.

John Bain  Jan 13, 2015 
Printed Page 137
.

The line cvAddWeighted( s, 2./3., b, 1./3., 0.0, s );

Should be replaced with

cvAddWeighted( s, 1 , b, 1./3., 0.0, s );

Anonymous  May 09, 2013 
Printed Page 139
table 5.5

In page 139 of the it is stated that for adaptive threshold the parameter threshold_type can take any value that is shown in table 5.5.

Trying exercise 5.12b I had problems with values CV_THRESH_TOZERO_INV and CV_THRESH_TRUNC and find out from OpenCV Reference Manual that thresholdType ? Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV

Anonymous  Feb 15, 2012 
Printed Page 178

There is a mistake in the two-dimentional array appearing in the page.

Firrst column of the array is: Re (Y0,0) Re Y(1,0) ReY(2,0) ... ReY(N/2-1,0) ImY(N/2-1,0)ReY(N/2,0) . Should be: Re (Y0,0) Re Y(1,0) ImY(1,0) ... ReY(N/2-1,0) ImY(N/2-1,0)ReY(N/2,0) .

Regarding the last column of the array:
It is: Re (Y0,N/2) Re Y(1,N/2) ReY(2,N/2) ... ReY(N-3,N/2) ImY(N-2,N/2) ReY(N-1,N/2) . Should be: Re (Y0,N/2) Re Y(1,N/2) ImY(1,N/2) ... ReY(N/2-1,N/2) ImY(N/2-1,N/2)ReY(N/2,N/2) .

Remarks: N appearing in the first index is Ny, in the second: Nx

Anonymous  Jul 06, 2012 
PDF Page 286
1st paragraph

"If the pixel is within a learned box, 255 is returned (a positive detection of foreground); otherwise, 0 is returned (background)."

Must be:
"If the pixel is within a learned box, 0 is returned (background); otherwise, 255 is returned (a positive detection of foreground)."

Vladimir Semenchuk  Nov 24, 2011 
Printed Page 328
Matrices at top of page

Matrix b dimensions are labeled 2x1; should be 25x1.

Matt Montag  Oct 04, 2011 
Printed Page 379
matrix for rotation

At page 379,matrix for rotation about X-axis is different(in 'sign') from
rotation matrix described in *wikipedia article*:
*http://en.wikipedia.org/wiki/Rotation_matrix#In_three_dimensions*

I suspect signs of sin(theta) are swapped.

Anonymous  Jul 11, 2012 
PDF Page 380
1st paragraph

Possible typo:
Need to replace ',' with Matrix multiplication operator in equation for 'R'.

Clarification request:
Shouldn't the equation R=R(abt. Z)*R(abt. Y)*R(abt. X) be replaced by R=R(abt. X)*R(abt. Y)*R(abt. Z) since 'R' is pre-multiplied in equation P_c = R(P_o-T),as order of application is Z->Y->X in OpenCV?

Anonymous  Jul 10, 2012 
Printed, PDF Page 392
1st equation

the equation is inverted in the sens that the equation should be:

[Xd] = (1 + k1*r^2 + k2*r^4 + k3*r^6) * [Xp] + [2*p1*Xd*Yd + p2*(r^2+2*Xd^2)]
[Yd] = (1 + k1*r^2 + k2*r^4 + k3*r^6) * [Yp] + [2*p2*Xd*Yd + p1*(r^2+2*Yd^2)]

with r^2 = Xp^2 + Yp^2

There, the distortion coefficients are explicitly used to get the distorted points from the "perfect" points.

Severine Cloix  Nov 07, 2012 
PDF Page 432
Step 2 of Hartley’s algorithm

The entry at the bottom left corner of the 3-by-3 matrix G on page 432 should be -1/f and not -1/k.

IFEANYI EZEBILI  May 30, 2022 
Printed Page 502
2nd paragraph

The book says:
"""
To increase robustness, random trees use an out of bag measure to verify splits. That is, at any given node, training occurs on a new subset of the data that is randomly selected ...
"""

I believe this is wrong. For each individual tree the data is randomly chosen once and for all, not changed at every node.

Oleg Zabluda  Aug 19, 2012 
Other Digital Version 1803
Example 3-11

Example 3-11 claims to max out (saturate) the S and V parts of an HSV image. When run (as specified in ReadMe_run_programs.txt) it takes an RGB image and maxes out the R and G components (i.e. turns the image yellow).

(Page number is for the Kindle edition.)

John Brewer  Mar 09, 2012 
Other Digital Version 3672
Paragrah beginning "On Linux and MacOS..."

"A return value of indicates that no thread could be started..."

Presumably there should be a value after the word "of".

(Page number is from Kindle edition.)

John Brewer  Mar 15, 2012