|
|
|
@ -51,23 +51,6 @@ You can modify the pixel values the same way. |
|
|
|
|
Numpy is an optimized library for fast array calculations. So simply accessing each and every pixel |
|
|
|
|
value and modifying it will be very slow and it is discouraged. |
|
|
|
|
|
|
|
|
|
@note The above method is normally used for selecting a region of an array, say the first 5 rows |
|
|
|
|
and last 3 columns. For individual pixel access, the Numpy array methods, array.item() and |
|
|
|
|
array.itemset() are considered better. They always return a scalar, however, so if you want to access |
|
|
|
|
all the B,G,R values, you will need to call array.item() separately for each value. |
|
|
|
|
|
|
|
|
|
Better pixel accessing and editing method : |
|
|
|
|
@code{.py} |
|
|
|
|
# accessing RED value |
|
|
|
|
>>> img.item(10,10,2) |
|
|
|
|
59 |
|
|
|
|
|
|
|
|
|
# modifying RED value |
|
|
|
|
>>> img.itemset((10,10,2),100) |
|
|
|
|
>>> img.item(10,10,2) |
|
|
|
|
100 |
|
|
|
|
@endcode |
|
|
|
|
|
|
|
|
|
Accessing Image Properties |
|
|
|
|
-------------------------- |
|
|
|
|
|
|
|
|
|