The negative of an image is achieved by replacing the intensity ‘i’ in the original image by ‘i-1’, i.e. the darkest pixels will become the brightest and the brightest pixels will become the darkest. Image negative is produced by subtracting each pixel from the maximum intensity value.
For example in an 8-bit grayscale image, the max intensity value is 255, thus each pixel is subtracted from 255 to produce the output image.
The transformation function used in image negative is :
s = T(r) = (L – 1) – r Where L - 1 is the max intensity value, s is the output pixel value and r is the input pixel value
- Read RGB color image into the MATLAB environment using Matlab inbuilt function
- Calculate the levels of the image, for example an 8-bit image has 256 levels
- Use the formula stated above on every pixel of the image to get corresponding negative pixel value.
- Convert each RGB pixel value at location (i, j) to its negative image values and assign it to the corresponding location (i, j) of another matrix
- Display the negative image using Matlab in-built
- MATLAB | Converting a Grayscale Image to Binary Image using Thresholding
- Image Processing in Java | Set 4 (Colored image to Negative image conversion)
- MATLAB | RGB image to grayscale image conversion
- Image Resizing in Matlab
- MATLAB | RGB image representation
- Matlab | Erosion of an Image
- Matlab | Dilation of an Image
- Image Complement in Matlab
- MATLAB | Complement colors in RGB Image
- LSB based Image steganography using MATLAB
- How to vertically flip an Image using MATLAB
- Extract bit planes from an Image in Matlab
- Create Mirror Image using MATLAB
- MATLAB | Complement colors in a Grayscale Image
- Image Processing in MATLAB | Fundamental Operations
- MATLAB | Complement colors in a Binary image
- MATLAB | Display histogram of a grayscale Image
- Flip image across Secondary Diagonal in MATLAB
- MATLAB - Ideal Highpass Filter in Image Processing
- MATLAB - Ideal Lowpass Filter in Image Processing
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.