RGB Image To Grayscale Image Without Using Rgb2gray Function
Maybe your like
- HOME
- TABLE OF CONTENTS
- ABOUT ME
- CONTACT ME
- VIDEOS
- PYTHON
Lets Learn together... Happy Reading " Two roads diverged in a wood, and I, I took the one less traveled by, And that has made all the difference "-Robert Frost
RGB Image to Grayscale Image without using rgb2gray function
A gray-scale image is composed of different shades of grey color. A true color image can be converted to a gray scale image by preserving the luminance(brightness) of the image. Here the RGB image is a combination of RED, BLUE AND GREEN colors. The RGB image is 3 dimensional. In an image , at a particular position say ( i,j) Image(i,j,1) gives the value of RED pixel. Image(i,j,2) gives the value of BLUE pixel. Image(i,j,3) gives the value of GREEN pixel. The combination of these primary colors are normalized with R+G+B=1; This gives the neutral white color. The grayscale image is obtained from the RGB image by combining 30% of RED , 60% of GREEN and 11% of BLUE. This gives the brightness information of the image. The resulting image will be two dimensional. The value 0 represents black and the value 255 represents white. The range will be between black and white values. MATLAB CODE: Im=imread('peppers.png'); figure,imshow(Im); title('Original Image'); %0.2989 * R + 0.5870 * G + 0.1140 * B GIm=uint8(zeros(size(Im,1),size(Im,2))); for i=1:size(Im,1) for j=1:size(Im,2) GIm(i,j)=0.2989*Im(i,j,1)+0.5870*Im(i,j,2)+0.1140*Im(i,j,3); end end %Without using for loop: %GIm=0.2989*Im(:,:,1)+0.5870*Im(:,:,2)+0.1140*Im(:,:,3); figure,imshow(GIm); title('Grayscale Image');
Check out : Partially colored gray scale image - MATLAB CODE
Like "IMAGE PROCESSING" page Labels: Image Conversion 8 comments:
This looks nice. How do you show just one of the colours? Let's say that you turn a picture into grayscale, but want to keep the blue color?
how to convert gray scale image back to original true color???????????
how to convert gray scale image back to original image's true color?????????
thanks too much.....after convertng how to plot histogram and cumulative histogram and how to verify that we got correct results by ensuring that final value in the cumulative histogram equals to the number of pixels in the image
GIm(i,j)=0.2989*Im(i,j,1)+0.5870*Im(i,j,2)+0.1140*Im(i,j,3);----------------i coudnt get this can any can one can explain this........
Ainatul Radhiah said...
thank you :)
Humayun Ahmed Ashik said...
@Ammayi TeluguAccording to this equation, Red has contribute 30%, Green has contributed 59% which is greater in all three colors and Blue has contributed 11%This method is called weighted method.And this method gives the correct grayscale imageOther method is 'Average method' in which (R + G +B)/3 is used to calculate the grayscale ; but this leads to incorrectness
what if i want to convert whole image into grey scale except red pepper...can you guide me plz..Thanks in advance
Enjoyed Reading? Share Your Views
X FOLLOW US
Follow @AaronAngel_Search This Blog
GRAB YOUR FREE GIFT TODAY
Featured Post
Image Processing with Python
Python is a high level programming language which has easy to code syntax and offers packages for wide range of applications including nu...
LIKE "IMAGE PROCESSING"
Support this blog by leaving your valuable comments and a like on Facebook Fan Page.THANKS FOR READINGSubscribe Now:
TAGS
Removing Image noise GUI Components in MATLAB Image Conversion Edge detection Photoshop effects in MATLAB MATLAB BUILT_IN FUNCTIONS Morphological Image Processing Video Processing Array functions in MATLAB Files Histogram equalization Image Compression Object Identification Optical illusion Shapes Templates Image Geometry Image ArithmeticFollowers
Tag » Code Rgb Image Matlab
-
How To Create An RGB Image? - - MathWorks
-
How Can I Get A RGB Values From A Picture? - - MathWorks
-
How To Convert RGB Image To Binary Image Using MATLAB?
-
USING MATLAB TO READ RGB & INDEXED IMAGES - YouTube
-
Convert Gray Images To Rgb Images And Replace It By Imread() In Matlab
-
Introduction (Image Processing Toolbox)
-
Red Component And Synthesize RGB #Multimedia_Systems #matlab
-
How To Determine Histogram Of A Color Image Using Matlab Code?
-
Project 5 - Image Compression
-
Convert RGB To Gray Scale In Matlab - Delft Stack
-
How Do I Get RGB Color Matrices Of An Image Using MATLAB? - Quora
-
MATLAB Code For Analysis Of RGB Images: To Measure Chlorophyll A ...
-
How To Construct False-color RGB Image From MODIS Data In MATLAB
-
Matlab Tutorial : Digital Image Processing 3 - Grayscale Image I - 2020
:)
:(
:))
:((
=))
=D>
:D
:P
:-O
:-?
:-SS
:-f
d(
:-*
b-(
h-(
g-)
5-p
y-)
c-)
s-)
d-)
w-)
:-h
:X