• invertimage(M)—Returns the matrix M with each element inverted.
The inverted value depends on the maximum value of matrix M.
Inversion can be used to enhance details.
Arguments
• M is an image matrix.
Additional Information
• If max(M) ≤ 255, then each element in the returned matrix is set to (255 - level); where level is the value of each element of the original image matrix and has a range of 0 ≤ level ≤ 255.
For grayscale images, this is equivalent to a "photographic" negative, while for color images, the effect is simply to replace all colors with their color complements.
• If max(M) > 255, then each element in the returned matrix is set to (max(M) + min(M) - level); where level is the value of each element of the original image matrix and has a range of 0 ≤ level.