Image processing loop after loop
显示 更早的评论
first post ever, and im kinda desperate ...
So there is my code, and i know i can do it by a simple function. But its not the point of the task i have ;(
And my question is how to show an image here correctly. cause disp(array) works perfectly, it shows whole array in matlab window with values from 1 to 255, lovely. But when i want to show it as an image (with imshow after mat2gray) its either black for Imagemy2(n,k)=0; or white for anything else i want to put there. Thank you for your help :)
ImageBasic = imread('rentgen.jpg');
Imagemy = imresize(ImageBasic,[40 40]);
array = zeros(40,40);
Imagemy2= mat2gray(array);
K = 40;
N = 40;
for k=1:K
for n=1:N
Imagemy2(k,n)=Imagemy(k,n);
end
end
disp(Imagemy2);
figure(2);
subplot(121)
imshow(Imagemy);
subplot(122)
imshow(Imagemy2);
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!