how to fix these errors in my matlab code?

1 回表示 (過去 30 日間)
Pawan Kumar PS
Pawan Kumar PS 2019 年 3 月 29 日
コメント済み: Walter Roberson 2019 年 3 月 29 日
i'm trying to stack 2d images to get 3d just like How can I plot several 2D image in a stack style in Matlab? but i get these errors.
and someone suggested to go with the below code
M = zeros(25, 50, 8);
for k = 1:8
img = imread(sprintf('%d-0000.jpg', k + 30));
img = imresize(img, [25 50]);
img = im2double(rgb2gray(img)); % Convert to double format
M(:, :, k) = img;
end
hf2 = figure ;
hs = slice(M,[],[],1:8) ;
shading interp
set(hs,'FaceAlpha',0.8);
this is the error i get error screenshot
please help me solve this errors. i am a beginner.
i have attached all the files i used for the code

採用された回答

Walter Roberson
Walter Roberson 2019 年 3 月 29 日
Some of your .jpg files are very rare grayscale JPEG. This makes approximately the 4th and 5th actual grayscale JPEG that I have ever encountered (outside of test images to prove that it can be done.)
Earlier today in https://www.mathworks.com/matlabcentral/answers/452018-i-am-making-a-project-on-fingerprint-verification-in-matlab-in-which-i-have-made-two-files-one-is-st#comment_686745 I posted some code that tries to deal with several of the different complications of images not having the expected number of dimensions or panes.
  4 件のコメント
Pawan Kumar PS
Pawan Kumar PS 2019 年 3 月 29 日
thanks a lot.
is it possible to view the output in black and white?
Walter Roberson
Walter Roberson 2019 年 3 月 29 日
You could try
colormap(gray(2))

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by