0
黒い画像に白い点を描くサンプルコードを書いた。私は一度に一点を描くことができました。私は入力としてポイントのセットを与え、黒い画像上に白い画像スポットを描画したいと思います。誰かがどのように進むべきか私に示唆することができますか?黒い画像に点を描く
from PIL import Image,ImageDraw
import time
class ImageHandler(object):
"""
with the aspect of no distortion and looking from the same view
"""
reso_width = 0
reso_height = 0
radius = 10
def __init__(self,width,height,spotlight_radius= 10):
self.reso_width = width
self.reso_height = height
self.radius = spotlight_radius
def get_image_spotlight(self,set_points): #function for drawing spot light
image,draw = self.get_black_image()
for (x,y) in set_points:
draw.ellipse((x-self.radius,y-self.radius,x+self.radius,y+self.radius),fill = 'white')
image.show("titel")
return image
def get_black_image(self): #function for drawing black image
image = Image.new('RGBA',(self.reso_width,self.reso_height),"black")#(ImageHandler.reso_width,ImageHandler.reso_height),"black")
draw = ImageDraw.Draw((image))
return image,draw
hi = ImageHandler(1000,1000)
a = []
hi.get_image_spotlight((a))
for i in range(0,100):
a = [(500,500)]
hi.get_image_spotlight((a))
time.sleep(1000)
探しているものを達成するためにmatlabplotを使うことができます。[Documentation](https://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter) –