📄 ifcosisgood.m
字号:
clear all
close all
clc
[filename,pathname] = uigetfile('*.bmp','打开拍摄回来的红色图像...');
fName = strcat(pathname,filename);
Rpicture = double(imread(fName));
% idisp(uint8(Rpicture))
[Row,Column,n] = size(Rpicture);
sumR1 = zeros(1,Column);
sumR2 = zeros(1,Column);
sumR3 = zeros(1,Column);
for i = 20:Row-20
sumR1 = sumR1 + Rpicture(i,:,1);
sumR2 = sumR2 + Rpicture(i,:,2);
sumR3 = sumR3 + Rpicture(i,:,3);
end
sumR1 = sumR1./Row;
sumR2 = sumR2./Row;
sumR3 = sumR3./Row;
figure;plot(sumR1,'r');hold on;plot(sumR2,'k');hold on;plot(sumR3,'g');title('Red');grid on
[filename,pathname] = uigetfile('*.bmp','打开拍摄回来的绿色图像...');
fName = strcat(pathname,filename);
Gpicture = double(imread(fName));
% idisp(uint8(Gpicture))
[Row,Column,n] = size(Gpicture);
sumG1 = zeros(1,Column);
sumG2 = zeros(1,Column);
sumG3 = zeros(1,Column);
for i = 20:Row-20
sumG1 = sumG1 + Gpicture(i,:,2);
sumG2 = sumG2 + Gpicture(i,:,1);
sumG3 = sumG3 + Gpicture(i,:,3);
end
sumG1 = sumG1./Row;
sumG2 = sumG2./Row;
sumG3 = sumG3./Row;
figure;plot(sumG1,'r');hold on;plot(sumG2,'k');hold on;plot(sumG3,'g');title('Green');grid on
[filename,pathname] = uigetfile('*.bmp','打开拍摄回来的蓝色图像...');
fName = strcat(pathname,filename);
Bpicture = double(imread(fName));
% idisp(uint8(Bpicture))
[Row,Column,n] = size(Bpicture);
sumB1 = zeros(1,Column);
sumB2 = zeros(1,Column);
sumB3 = zeros(1,Column);
for i = 20:Row-20
sumB1 = sumB1 + Bpicture(i,:,3);
sumB2 = sumB2 + Bpicture(i,:,2);
sumB3 = sumB3 + Bpicture(i,:,1);
end
sumB1 = sumB1./Row;
sumB2 = sumB2./Row;
sumB3 = sumB3./Row;
figure;plot(sumB1,'r');hold on;plot(sumB2,'k');hold on;plot(sumB3,'g');title('Blue');grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -