Programming Computer Vision with Python

Errata for Programming Computer Vision with Python

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. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.


Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page 21
4th line of first source code block

and example source morphology.py : the method 'measurements.label()' in : m = 1*(im < 128l) labels, numObjects = measurements.label( im ) throws exception "data type not supported" in c:\Python27\lib\site-packages\scipy\ndimage\measurements.py, 167 im is a matrix of 0's and 1's. When using the statement im = ( im < 128 ) the program does work as expected. Here, im is a boolean array containing values True and False. This same type of array is returned by the line im = morphology.binary_opening(im, ones((9, 5)), iterations=2) in the (original) second part of the example. I am running Windows 7 64bit, python 2.7.3 32-bit, and scipy 0.11.0, numpy 1.6.2 (from the matching binary installer)

Note from the Author or Editor:
On my Mac with OS X 10.8.2, Python 2.7.2 I get the exact same result (45 and 48 objects) for all three versions: im = 1*(im<128) im = 1.0*(im<128) im = (im<128) Perhaps this is a platform specific problem? I will add note in future versions.

Frans van der Klip  Dec 19, 2012 
Printed, PDF, ePub
Page 30
Last row of example, bottom of the page.

The Harris response function code is missing a square of the trace in the denominator. The line return Wdet / Wtr should be return Wdet / (Wtr*Wtr) The code online has been updated. https://github.com/jesolem/PCV

Jan Erik Solem
Jan Erik Solem
O'Reilly Author 
Jan 23, 2013 
Printed
Page 40
the center of the code

matchscores = zeros((desc1_size[0],1),'int') should be matchscores = zeros(desc1_size[0],'int')

Note from the Author or Editor:
Both versions work but your suggestion is better.

aikawa  Feb 17, 2013 
Printed
Page 76
Fourth row from bottom

The index "j+1" should be "4". Replace im1 = array(Image.open(imname[j+1])) with im1 = array(Image.open(imname[4]))

Jan Erik Solem
Jan Erik Solem
O'Reilly Author 
May 06, 2013 
Printed
Page 88
10th line down

When running code in book, program stops and I get the following error: box_trans = homography.normalize(dot(H,box_cam1)) ValueError: setting an array element with a sequence. Runs fine up to this point.

Note from the Author or Editor:
This is indeed a mistake. The line 8 lines down on p87 that reads: H = homography.H_from_ransac(fp,tp,model) should read: H, inliers = homography.H_from_ransac(fp,tp,model) Updated example code is available on https://github.com/jesolem/PCV/blob/master/examples/ar_cube.py

Doug Blanding  Sep 27, 2012 
Printed
Page 91
code

aspect = (width*fy)/(height*fx) will truncate the value if the all values are integer. This should be: aspect = float(width*fy)/(height*fx)

Note from the Author or Editor:
This could indeed be a problem if someone has integer focal lengths (unlikely). The suggested improvement: aspect = float(width*fy)/(height*fx) should be used.

aikawa  Feb 17, 2013 
Printed
Page 150
code

import vlfeat as sift should be import sift

Note from the Author or Editor:
Yes. The module was called vlfeat but changed name during the book review process. The suggestion import sift is correct.

aikawa  Feb 23, 2013 
Printed
Page 154
code

The comment says "go through all images", but the code below it loops only the first 100 images. for i in range(nbr_images)[:100]: should be for i in range(nbr_images):

Note from the Author or Editor:
Yes. There is a typo there. The suggested for i in range(nbr_images): is correct.

aikawa  Mar 13, 2013 
Printed, PDF, ePub, Mobi, Safari Books Online
Page 182
Code example at the bottom of the page

The tiny helper function convert_labels is missing from this example. def convert_labels(labels,transl): """ Convert between strings and numbers. """ return [transl[l] for l in labels]

Jan Erik Solem
Jan Erik Solem
O'Reilly Author 
Feb 10, 2013 
Printed
Page 212,213
P212: at the end of the first code; P213: at the end of the code

Bothe codes teriminated normally when run on the MSDOS command line. However they can not terminated when run in IDLE(Python GUI) and PyScripter. Adding the following function at the end of the code can solve this problem for most of platform. cv2.destroyAllWindows()

Note from the Author or Editor:
Thanks. A comment should be added in future versions of the text.

ColorRGB  Feb 28, 2013