Filter löschen
Filter löschen

8 bit depth RGB image(gif)

3 Ansichten (letzte 30 Tage)
Mahua Nandy(Pal)
Mahua Nandy(Pal) am 11 Mär. 2012
is it possible to separate red ,green and blue channel of a 8 bit depth gif image with the following code?
redimg=im;
blueimg=im;
redimg(:,:,2:3)=0;
blueimg(:,:,1:2)=0;
greenimg=im;
greenimg(:,:,3)=0;
greenimg(:,:,1)=0;
if not then how can that be achieved?

Akzeptierte Antwort

Image Analyst
Image Analyst am 11 Mär. 2012
Copy and paste this example code:
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 20;
% Change the filename to your filename!
[gifImage cmap] = imread('C:\Users\yourname\Pictures\whatever.gif');
% Display indexed GIF image.
subplot(2,3, 1);
imshow(gifImage);
% Convert to true color RGB image.
rgbImage = ind2rgb(gifImage, cmap);
title('GIF Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
subplot(2,3, 2);
imshow(rgbImage);
title('After conversion to RGB', 'FontSize', fontSize);
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
% Display the three component color channels.
subplot(2,3, 4);
imshow(redChannel);
title('Red Channel', 'FontSize', fontSize);
subplot(2,3, 5);
imshow(greenChannel);
title('Green Channel', 'FontSize', fontSize);
subplot(2,3, 6);
imshow(blueChannel);
title('Blue Channel', 'FontSize', fontSize);
  1 Kommentar
Mahua Nandy(Pal)
Mahua Nandy(Pal) am 12 Mär. 2012
thank u for clearing my doubts.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Object Properties finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by