# HG changeset patch # User carandraug # Date 1323060119 0 # Node ID 9135e5461550ffbe31d318804e34a4ce640ab799 # Parent 7d8494a6d8a6af29b7ab7ad9258b310e68883193 isgray isbw isrgb: return false is argument is empty matrix diff --git a/inst/isbw.m b/inst/isbw.m --- a/inst/isbw.m +++ b/inst/isbw.m @@ -37,7 +37,7 @@ endif ## an image cannot be a sparse matrix - if (!ismatrix (BW) || issparse (BW)) + if (!ismatrix (BW) || issparse (BW) || isempty (BW)) bool = false; elseif (strcmpi (logic, "logical")) ## this is the matlab compatible way (before they removed the function) diff --git a/inst/isgray.m b/inst/isgray.m --- a/inst/isgray.m +++ b/inst/isgray.m @@ -38,7 +38,7 @@ endif bool = false; - if (ismatrix (img) && ndims (img) == 2 && !issparse (img)) + if (ismatrix (img) && ndims (img) == 2 && !issparse (img) && !isempty (img)) switch (class (img)) case "double" ## to speed this up, we can look at a sample of the image first diff --git a/inst/isrgb.m b/inst/isrgb.m --- a/inst/isrgb.m +++ b/inst/isrgb.m @@ -39,7 +39,7 @@ endif bool = false; - if (ismatrix (img) && ndims (img) == 3 && size (img, 3) == 3 && !issparse (img)) + if (ismatrix (img) && ndims (img) == 3 && size (img, 3) == 3 && !issparse (img) && !isempty (img)) switch (class (img)) case "double" ## to speed this up, we can look at a sample of the image first