Sir i am getting error :function isgray has been removed. Please suggest me which version of matlab i should use.

5 ビュー (過去 30 日間)
amol
amol 2014 年 9 月 26 日
回答済み: DGM 2021 年 10 月 10 日
Error description Error using isgray (line 7) Function ISGRAY has been removed.
Error in fpr (line 50) if (any(namefile~=0) && (~isgray(img)))

回答 (3 件)

Youssef  Khmou
Youssef Khmou 2014 年 9 月 26 日
I think this function test an image of it is gray scale image, try to use an alternative way, using always logical answer, The grayscale image is 2D while others are higher, so replace the function with :
NN=length(size(image));
C=NN<=2;

Image Analyst
Image Analyst 2014 年 9 月 26 日
You can check if it's a 2D gray scale image or a 3D color image by looking at either of these ways:
numDims = ndims(yourImage);
numDims = 2 for gray and 3 for RGB.
Or
[rows, colors, numberOfColorChannels] = size(yourImage);
numberOfColorChannels = 1 for gray, and 3 for RGB.
  3 件のコメント
Walter Roberson
Walter Roberson 2021 年 10 月 10 日
There are different conventions for black and white images:
islogical(yourImage) || ...
(isfloat(yourImage) && all(ismember(yourImage(:), [0 1]))) || ...
(isinteger(yourImage) && all(ismember(yourImage(:), [intmin(class(yourImage)), intmax(class(yourImage))])))
but sometimes an image is considered to be black and white if it is either all one gray intensity or else exactly two gray intensities -- for example, a double precision image image that had values 0. and 255. might be considered black and white (such an image would probably have been produced by someone using double(yourImage) instead of im2double(yourImage)) )
Steven Lord
Steven Lord 2021 年 10 月 10 日
FYI Steve Eddins discussed some of the ambiguity issues Walter Roberson described in a blog post from 2007.

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


DGM
DGM 2021 年 10 月 10 日
As Steven notes, there are potential ambiguities with trying to do this. In my opnion, isgray() and isind() make some questionable assumptions. In order to meaningfully use isgray() you need to be aware of what it considers to be "gray". By the same token, if you adopt any other method, you need to accept the assumptions it implies.
I added ismono() to MIMT years ago because I disagreed with the assumptions made by isgray(). From the synopsis for ismono:
% ISMONO(INPICT,{TOL})
% Returns a logical value, true when INPICT is an I/IA logical or
% numeric array, or when INPICT is an RGB/RGBA image and all three color
% channels are identical to within a given tolerance. 4-D arrays of
% mono images return true only if all frames are mono images.
%
% IP Toolbox functions ISGRAY() and ISIND() provide similar functionality
% but will return false for any multi-channel or multi-frame array.
%
% ISMONO() does not discriminate between grey or indexed images
% or assume value ranges by class. ISMONO() will return true for a single-channel
% uint8 grey image (0-255) temporarily cast as double, whereas ISGRAY()/ISIND()
% will assume that it is an indexed image.
%
% INPICT is a 1, 2, 3, or 4 channel image array of any logical or numeric class.
% TOL is the tolerance used for checking RGB/RGBA images. (default 1E-12)
% This is the maximum allowable mean pixel difference.
% Using an excessively tight tolerance will tend to cause false negatives
% due to rounding error in desaturated images.
Speaking of assumed conventions, ismono() might work great -- so long as you don't expect that a multiframe image should be stacked on dim3 instead of dim4.
MIMT is available on the File Exchange.
...

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by