Guest User

Untitled

a guest
Dec 11th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. # PIL Image object which holds a transparent background png image.
  2. pil_img = Image.open(ioFile).convert('RGBA')
  3. pil_img.show()
  4.  
  5. # I use numpy to convert the pil_image into a numpy array
  6. numpy_image = np.array(pil_img)
  7.  
  8. # I convert to a openCV2 image, notice the COLOR_RGB2BGR which means that
  9. # the color is converted from RGBA to BGR format
  10. opencvImage = cv2.cvtColor(numpy_image, cv2.COLOR_RGBA2BGR)
  11. showImage(opencvImage)
Add Comment
Please, Sign In to add comment