For loop in image translation?
古いコメントを表示
Hi all,
So I have this 2D image and I'm trying to build a for-loop to shift it by values from 1:n in the x-direction and 1:m in the y-direction, and then store the images (potentially) in a cell array. Here goes what I managed to scrape with what little Matlab knowledge I have:
img= imread('cameraman.tif');
imgg= cell(256, 256, n);
for i= 1:z
for j= 1:n
for k= 1:m
imgg(j, k, i)= [imtranslate(img, [j, k]), i];
end
end
end
I get an error message saying:
Error using horzcat
Dimensions of matrices being concatenated are not consistent.
Any help as to how to handle the indezing in this problem would be greatly appreciated
回答 (1 件)
KALYAN ACHARJYA
2019 年 11 月 12 日
編集済み: KALYAN ACHARJYA
2019 年 11 月 12 日
If you want to store in the cell array, may be this one: 3D cell array, due to multiple undefined variables, hence I can't check the code.
imgg{j,k,i}=....
カテゴリ
ヘルプ センター および File Exchange で Image Filtering and Enhancement についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!