CNN Model Body
This commit is contained in:
@ -0,0 +1,21 @@
|
||||
from PIL import ImageDraw
|
||||
from PIL import Image
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
def are_homotopic(map_array, trajectory, other_trajectory):
|
||||
|
||||
polyline = trajectory.vertices.copy()
|
||||
polyline.extend(reversed(other_trajectory.vertices))
|
||||
|
||||
height, width = map_array.shape
|
||||
|
||||
img = Image.new('L', (height, width), 0)
|
||||
ImageDraw.Draw(img).polygon(polyline, outline=1, fill=1)
|
||||
|
||||
a = (np.array(img) * map_array).sum()
|
||||
if a >= 1:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
Reference in New Issue
Block a user