Image.pixel#
- Image.pixel(u: int, v: int) int | float | ndarray[source][source]#
Return pixel value
- Parameters:
u (int) – column coordinate
v (int) – row coordinate
- Returns:
pixel value
- Return type:
int, float or ndarray
Return the specified pixel. If the image has multiple planes, the result is a vector over planes.
Note
This method is faster than the more general
__getitem__for the individual pixel case.Warning
The order of the indices is column, row and plane. This is the opposite of the order used for NumPy index on the underlying array. It is consistent with the column-first convention used across the Toolbox and is consistent with the \((u,v)\) coordinate system for images.
Example:
>>> from machinevisiontoolbox import Image >>> img = Image.Read("flowers4.png", mono=True) >>> pix = img.pixel(100, 200) >>> pix # grey scale pixel value np.uint8(92) >>> img = Image.Read("flowers4.png") >>> pix = img.pixel(100, 200) >>> pix # color pixel value (R, G, B) array([ 79, 105, 55], dtype=uint8)
- Seealso: