Deprecating is_rgb()

This commit is contained in:
Ankit Agrawal
2013-04-24 05:13:34 +05:30
parent 73e73c4bfb
commit 2992ca7ade
2 changed files with 5 additions and 18 deletions
+2 -13
View File
@@ -52,7 +52,7 @@ __all__ = ['convert_colorspace', 'rgb2hsv', 'hsv2rgb', 'rgb2xyz', 'xyz2rgb',
'rgb_from_gdx', 'gdx_from_rgb', 'rgb_from_hax', 'hax_from_rgb',
'rgb_from_bro', 'bro_from_rgb', 'rgb_from_bpx', 'bpx_from_rgb',
'rgb_from_ahx', 'ahx_from_rgb', 'rgb_from_hpx', 'hpx_from_rgb',
'is_rgb', 'is_gray'
'is_gray'
]
__docformat__ = "restructuredtext en"
@@ -62,17 +62,6 @@ from scipy import linalg
from ..util import dtype
def is_rgb(image):
"""Test whether the image is RGB or RGBA.
Parameters
----------
image : ndarray
Input image.
"""
return (image.ndim == 3 and image.shape[2] in (3, 4))
def is_gray(image):
"""Test whether the image is gray (i.e. has only one color band).
@@ -652,7 +641,7 @@ def gray2rgb(image):
If the input is not 2-dimensional.
"""
if is_rgb(image):
if (image.ndim == 3 and image.shape[2] in (3, 4)):
return image
elif is_gray(image):
return np.dstack((image, image, image))
+3 -5
View File
@@ -29,7 +29,7 @@ from skimage.color import (
rgb2grey, gray2rgb,
xyz2lab, lab2xyz,
lab2rgb, rgb2lab,
is_rgb, is_gray
is_gray
)
from skimage import data_dir, data
@@ -255,16 +255,14 @@ def test_gray2rgb_rgb():
assert_equal(x, y)
def test_is_rgb():
def test_is_gray():
color = data.lena()
gray = data.camera()
assert is_rgb(color)
assert not is_gray(color)
assert is_gray(gray)
assert not is_gray(color)
if __name__ == "__main__":
run_module_suite()