Unable to perform assignment because the size of the left side is 56-by-37 and the size of the right side is 37-by-56. Error in myMeanShiftSegmentation (line 21) subsampled(:, :, i) = I1;

1 view (last 30 days)
getting above error when trying to run mean shift segmentation algorithm
original = imread(inpImg);
channelCount = size(original ,3);
num_rows_original = size(original, 1);
num_cols_original = size (original, 2);
subsampled = zeros(floor(num_cols_original/5)+1, floor(num_rows_original/5)+1, channelCount);
subsampled = uint8(subsampled);
for i = 1:channelCount
original1 = original(:, :, i);
original1 = double(original1);
gfilter = fspecial('gaussian', 5, 1);
I1 = conv2(original1, gfilter, 'same');
I1 = uint8(I1);
I1 = I1(1:5:end, 1:5:end);
subsampled(:, :, i) = I1;
end;

Answers (1)

madhan ravi
madhan ravi on 5 Dec 2018
Edited: madhan ravi on 5 Dec 2018
Use a cell array to store the values :
P.S- I have no experience with mean shikft algorithm
subsampled=cell(1,n);
for i=1:n
subsampled{i}=I1;
end

Categories

Find more on Stateflow in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!