When I tried to illustrate the feature clusters in the image as the color circles. After I imported two libraries: I imported these two related libraries:
from PIL import Image
from PIL import ImageDraw
I used the code like the following:
draw = ImageDraw.Draw(img1)
draw.ellipse((x-10, y-10, x+10, y+10), fill=(255,0,0,0))
The error I get is as the following:
File "assi_6.python", line 85, in main
draw = ImageDraw.Draw(img1)
File "/Users/qdai/anaconda/envs/vision/lib/python2.7/site-packages/PIL/ImageDraw.py", line 284, in Draw
return ImageDraw(im, mode)
File "/Users/qdai/anaconda/envs/vision/lib/python2.7/site-packages/PIL/ImageDraw.py", line 59, in __init__
im.load()
AttributeError: 'numpy.ndarray' object has no attribute ‘load’
Mentioning numpy.ndarray
in the error message gives a hint that the object img1
is not an image as PIL needs it for its methods.
Try to create/load img1
using PIL methods to avoid that error.