MATLAB Answers


Image reading and processing

Asked by Usha Silwal on 11 Sep 2019 at 20:00
Latest activity Answered by Sourav Bairagya on 16 Sep 2019 at 6:27
How do I generate just the red channel, from the colourful image that I have attached below?


on 11 Sep 2019 at 20:06
Sorry I don't see your image. Did you attach it? Also it would be good if you could please provide the actual data that you are plotting not just the image
Usha Silwal on 11 Sep 2019 at 20:15
This is the image I am working on and I just need to display the blue channel of the image.
on 12 Sep 2019 at 12:26
How is the image encoded? Please provide the matrix you are plotting

Sign in to comment.

1 Answer

Answer by Sourav Bairagya on 16 Sep 2019 at 6:27
 Accepted Answer

After reading the image properly, you can separate the channels using this code segment.
a_red=a(:,:,1); %RED channel
a_green=a(:,:,2); %GREEN channel
a_blue=a(:,:,3); %BLUE channel
figure;imshow(a);title('Color Image');
figure;imshow(a_red);title('Red Channel');
figure;imshow(a_green);title('Green Channel');
figure;imshow(a_blue);title('Blue Channel');
Now, you can also save each channel as separate image using ‘imwrite’ function. Hope this will help.


Sign in to comment.