0

I have this code:

    bPlane = myImage[:,:,0] - 0.5*(myImage[:,:,2]) - 0.5*(myImage[:,:,1]);
    purple = bPlane > 20
    purple2 = morphology.remove_small_objects(BW_2, 400);

where myImage is a BGR.

How can I convert "purple2" to a grayscale image in Python 3.6?

Joh
  • 1
  • 1

1 Answers1

0

If your image is an array (arr) at first, a possible solution would be:

import numpy as np
from PIL import Image

arr = np.random.rand(100,100)

im = Image.fromarray(arr)

gray = im.convert('L') # Converting to grayscale