Can be done as follow:
from scipy.misc import imread, imsave, imresize
image = imread(f_name)
if(len(image.shape)<3):
print 'gray'
elif len(image.shape)==3:
print 'Color(RGB)'
else:
print 'others'
Related Contents:
- Visibility of global variables in imported modules
- Peak detection in a 2D array
- How to get the location of all text present in an image using OpenCV?
- Using strides for an efficient moving average filter
- Python OpenCV skew correction for OCR
- How to de-skew a text image and retrieve the new bounding box of that image Python OpenCV?
- Alternative to dict comprehension prior to Python 2.7
- How to define a threshold value to detect only green colour objects in an image with Python OpenCV?
- How can I quantify difference between two images?
- Python OpenCV Color Tracking
- Python try…except comma vs ‘as’ in except
- Get class that defined method
- Pipe subprocess standard output to a variable [duplicate]
- Convert image from PIL to openCV format
- dlib installation on Windows 10
- Implement MATLAB’s im2col ‘sliding’ in Python
- Convolve2d just by using Numpy
- OpenCV – Apply mask to a color image
- How to isolate everything inside of a contour, scale it, and test the similarity to an image?
- Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6
- Representing and solving a maze given an image
- How can I improve my paw detection?
- How to resize an image with OpenCV2.0 and Python2.6
- How to straighten a rotated rectangle area of an image using OpenCV in Python?
- How can I efficiently process a numpy array in blocks similar to Matlab’s blkproc (blockproc) function
- Adding borders to an image using python
- Convolving image with kernel in Fourier domain
- Any gotchas using unicode_literals in Python 2.6?
- Detect and visualize differences between two images with OpenCV Python
- How do I remove the background from this kind of image?
- Finding connected components in a pixel-array
- Remove whitespaces in XML string
- PyTorch NotImplementedError in forward
- PIL Convert PNG or GIF with Transparency to JPG without
- Segmenting License Plate Characters
- pyodbc insert into sql
- How to get the cells of a sudoku grid with OpenCV?
- Detecting lines and shapes in OpenCV using Python
- create an image with border of certain width in python
- Automatic contrast and brightness adjustment of a color photo of a sheet of paper with OpenCV
- Extract time from datetime and determine if time (not date) falls within range?
- Equivalent of copyTo in Python OpenCV bindings?
- Most efficient way to calculate radial profile
- cv2.imshow command doesn’t work properly in opencv-python
- Get Image size WITHOUT loading image into memory
- How to convert a set to a list in python?
- module’ object has no attribute ‘drawMatches’ opencv python
- Remove spurious small islands of noise in an image – Python OpenCV
- Pytorch RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0
- Python – Find dominant/most common color in an image