谁能帮我解释一下这个matlab的语句?tic;close all;clear;clc;format compact;%%pic = imread('C:\Users\xll\Desktop\littleduck.jpg');% figure;% imshow(pic);[m,n,k] = size(pic);% data = zeros(m*n,5);data(1:m*n,1:3) = double(reshape(pic,m*n,k));%

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 01:21:39
谁能帮我解释一下这个matlab的语句?tic;close all;clear;clc;format compact;%%pic = imread('C:\Users\xll\Desktop\littleduck.jpg');% figure;% imshow(pic);[m,n,k] = size(pic);% data = zeros(m*n,5);data(1:m*n,1:3) = double(reshape(pic,m*n,k));%
xTn@DtIJ'*י7َ@  I҄=ZZ&)KIhC~c;Ow21j]/"ϪHCs gW0EhMQ 4GctNE&.FP(@bzќAԍ0 )?"86A s-ʺ6tiiFS$R'S~%]J'NrOn BX9"$[v/ߑ uss¯SwV?2 %:5I0>ytJ=>{7H!`8U&xhءք FO[yԽ߄tۤfuEvPvoWCV<)\񊷂8{̲4Xv2k I+k_ϷJtH Hq{|z2Dm)?@9

谁能帮我解释一下这个matlab的语句?tic;close all;clear;clc;format compact;%%pic = imread('C:\Users\xll\Desktop\littleduck.jpg');% figure;% imshow(pic);[m,n,k] = size(pic);% data = zeros(m*n,5);data(1:m*n,1:3) = double(reshape(pic,m*n,k));%
谁能帮我解释一下这个matlab的语句?
tic;
close all;
clear;
clc;
format compact;
%%
pic = imread('C:\Users\xll\Desktop\littleduck.jpg');
% figure;
% imshow(pic);
[m,n,k] = size(pic);
% data = zeros(m*n,5);
data(1:m*n,1:3) = double(reshape(pic,m*n,k));
% for i = 1:n
% data((i*m-m+1):i*m,k+1) = (1:m)';
% data((i*m-m+1):i*m,k+2) = i*ones(1,m);
% end
options = [2 200 1e-5 0];
cluster_n = 3;
[center,U,obj_fcn] = fcm(data,cluster_n,options);
cluster = cell(1,cluster_n);
cluster_pic = cell(1,cluster_n);
pic = cell(1,cluster_n);
for i = 1:cluster_n
cluster{i} = find( U(i,:)==max(U));
cluster{i} = cluster{i}';
cluster_pic{i} = data(1:m*n,1:3);
temp = data(1:m*n,1:3);
temp(cluster{i},:) = 0;
cluster_pic{i} = cluster_pic{i}-temp;
pic{i} = reshape(cluster_pic{i},m,n,k);
figure;
imshow(uint8(pic{i}));
end
%%
toc;

谁能帮我解释一下这个matlab的语句?tic;close all;clear;clc;format compact;%%pic = imread('C:\Users\xll\Desktop\littleduck.jpg');% figure;% imshow(pic);[m,n,k] = size(pic);% data = zeros(m*n,5);data(1:m*n,1:3) = double(reshape(pic,m*n,k));%
tic是打开一个计时器,最后一行的toc关闭计时器,第一行和最后一行就是对这段程序计时用的.然后是清除变量(在运行这段程序之前你最好保存好先前的变量,否则会被删除掉),imread()读入地址上的图片()到pic,其实图片就是一个三维矩阵,size(pic)求取图片矩阵的大小.reshape()对pic矩阵进行变型(改变维数),并保存成double类型数据.然后使用fcm()处理data,具体怎么处理你这里没有给出,请你查看fcm函数吧.