
24 A Computational Introduction to Digital Image Processing, Second Edition
(Recall that indexing in Python starts at zero, so to obtain the same results as with MAT-
LAB and Octave, the indices need to be one less.)
A usef ul function for obtaining RGB values is
impixel; the command
MATLAB/Octave
>> impixel(b,200,100)
ans
=
114 126 58
returns the red, green, and blue values of the pixel at column 200, row 100. Notice that
the order of indexing is the same as that which is provided by the
impixelinfo command.
This is opposite to the row, column order for matrix indexing. This command also applies
to grayscale images:
MATLAB/Octave
>> impixel(w,100,200)
ans