Matlab彩色图像处理

来源:互联网 发布:运动紧身裤品牌 知乎 编辑:程序博客网 时间:2024/04/29 23:52

笔记:

图像R,G,B分解示例

clc;close all;clear all;rgb = imread('office.jpg');R = rgb(:,:,1);%红色分量G = rgb(:,:,2);%绿色分量B = rgb(:,:,3);%蓝色分量R1 = rgb(:,:,1)*0;%将图像三维矩阵的每一页清零G1 = rgb(:,:,2)*0;B1 = rgb(:,:,3)*0;R_img = cat(3,R,G1,B1);G_img = cat(3,R1,G,B1);B_img = cat(3,R1,G1,B);subplot(1,4,1);imshow(rgb);title('原图');subplot(1,4,2);imshow(R_img);title('R红');subplot(1,4,3);imshow(G_img);title('G绿');subplot(1,4,4);imshow(B_img);title('B蓝');

运行结果:


0 0
原创粉丝点击