Answers for "crop gray image python opencv"

3

python image to grayscale

from PIL import Image
img = Image.open("image.jpg")
img.convert("L").save("result.jpg")
Posted by: Guest on March-18-2021
-1

detect grayscale image in python opencv

import cv2
file = "myFile.jpj"


image = cv2.imread(file)
if image.any() != None:
  if(len(image.shape)<2):
        print ('grayscale')
  elif len(image.shape)==3:
        print ('Colored')
else:
  print("cannot find image")
Posted by: Guest on August-26-2021

Python Answers by Framework

Browse Popular Code Answers by Language