how to identify a 3d matrix?
이전 댓글 표시
by using the function:
MAT=imread('image.jpg');
sometimes (if the image isn't in grayscale) i get output of 3D matrix (RGB) is there any function or a technic i can use?
채택된 답변
추가 답변 (1개)
Geoff Hayes
2014년 7월 1일
Try ndims which returns the number of dimensions
if ndims(MAT)==3
% matrix is three dimensional
end
댓글 수: 2
the cyclist
2014년 7월 1일
I didn't know about this command, which is a cleaner version of what I did more manually. Note that it suffers from the same weakness about not being able to discriminate between objects of dimension 1 and 2.
Geoff Hayes
2014년 7월 1일
편집: Geoff Hayes
2014년 7월 1일
That's true. You could use isvector to discriminate between objections of dimension 1 and 2.
I suppose even ismatrix could be used to determine if the object has at most two dimensions (and so ~ismatrix(MAT) would be true for a 3D image).
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!