# We Helped With This MATLAB Programming Assignment: Have A Similar One?

SOLVED
Category Programming MATLAB Graduate Solved Matlab Code Help

## Short Assignment Requirements

please make my program in correct order..and give explanations

## Assignment Code

``````

clc;
clear all;close all
ImageIN = 'lena.tif';
figure,imshow(ImageIN);
figure;
Fast_Dic_Training_and_Testing(ImageIN);

block_size=8;

if size(Img,3) == 3
Yl = double(rgb2gray(Img));
else
Yl = double(Img);
end

[blocks,idx] = my_im2col(Yl,[block_size,block_size],4);
param.errorFlag=0;
param.K=m;
param.numIteration=40;
param.InitializationMethod='DataElements';
param.TrueDictionary=0;
param.Method='KSVD';
param.L=L;
[Dic,output] = TrainDic_Fast(blocks,param);
savefile = [ImageIN '_BlockSize_8x8_DicNum_256.mat'];
save(savefile,'Dic');

ImageIN = 'lena.tif';
imshow(ImageIN);
I = im2double(I);
T = dctmtx(8);
B = blkproc(I,[8 8],'P1*x*P2',T,T');
mask = [1   1   1   1   0   0   0   0
1   1   1   0   0   0   0   0
1   1   0   0   0   0   0   0
1   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0];
I2 = blkproc(B2,[8 8],'P1*x*P2',T',T);
imshow(I),figure,imshow(I2)
[blocks,idx] = my_im2col(I,blkSize,slidingDis)
idxMat = zeros(size(I)-blkSize+1);
idxMat([[1:slidingDis:end-1],end],[[1:slidingDis:end-1],end]) = 1; % take blocks in distances of 'slidingDix', but always take the first and last one (in each row and column).
idx = find(idxMat);
[rows,cols] = ind2sub(size(idxMat),idx);
blocks = zeros(prod(blkSize),length(idx));
for i = 1:length(idx)
currBlock = I(rows(i):rows(i)+blkSize(1)-1,cols(i):cols(i)+blkSize(2)-1);
imshow(currBlock,[]);

drawnow
pause(0.1)
blocks(:,i) = currBlock(:);
end

``````

Customer Feedback

"Thanks for explanations after the assignment was already completed... Emily is such a nice tutor! "

Order #13073

Find Us On