Conversion of RGB Image into Intensity Image

5 views (last 30 days)
Here I am adding a simple code which performs sharpening of an image:
% Clears command prompt and closes all windows
clear all;
close all;
% Read in image and display
im = imread('coin.png');
figure;
imshow(im);
% Create special unsharp mask filter
mask = fspecial('unsharp');
out = imfilter(im, mask);
% Display sharpened result
figure;
imshow(out);
My problem is that: I am operating the process on an 8 bit intensity image(which is named as 'coin' here), but after I perform the operation and save it, it automatically gets converted into an RGB image (8 bit). So, is there any procedure to get the resultant image ('out') as the same 8 bit intensity image? Please help me in this regard.
Thanks!
  2 Comments
Image Analyst
Image Analyst on 18 Aug 2013
How are you saving it? for example are you calling imwrite() and telling it to save as a BMP or JPG?
Amith Kamath
Amith Kamath on 19 Aug 2013
could you please clarify what you mean by 8 bit RGB image? When I follow your code example, I see that 'out' is a 246x300 uint8, which is the same type as 'im'. Typically, RGB images have 3 layers, each of which are typically 8 bit wide.

Sign in to comment.

Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!