% 直接上matlab代码
close all; clear; clc;
orgin_image = imread('QQ图片20190514094429.png');
row = size(orgin_image, 1); % 行
column = size(orgin_image, 2); %列
N = zeros(1, 256); % N是1*256的行向量
for i = 1:row
for j = 1:column
k = orgin_image(i, j);
N(k+1) = N(k+1) + 1;
end
end
subplot(121), imshow(orgin_image);
subplot(122), bar(N); %绘制直方图
axis tight; % 使坐标系的最大值和最小值和你的数据范围一致。
matlab灰度直方图
最新推荐文章于 2023-10-25 19:45:07 发布