参考博客地址:https://blog.csdn.net/jizhidexiaoming/article/details/84036665
原来的博客是彩色的图片,现改为灰度图和彩色都可以适用,然后子块的大小也可以用参数指定,嗯,
子块没有写作subblock,我用的是拼音,zikuai
clear;
clc;
tic
% img = imread('test.jpg');
img=imread('rice.png');%自带图片
[row, col,dim] = size(img);
if dim~=1
%% resize the image into the new size with 500x*500y
r_img = img(:, :, 1);
g_img = img(:, :, 2);
b_img = img(:, :, 3);
% [