Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heatmap not drawn on assigning different point strength to different points #6

Open
anujshah1003 opened this issue Jul 4, 2018 · 1 comment

Comments

@anujshah1003
Copy link

No description provided.

@anujshah1003
Copy link
Author

anujshah1003 commented Jul 4, 2018

I itried assigning different point strength to different points but the heatmap is not being drawn in that case. Below is my code:

class PILGreyHeatmapper(GreyHeatMapper):

def __init__(self, point_diameter, point_strength):
    super().__init__(point_diameter, point_strength)
def heatmap(self, width, height, points,point_strength_type):
    heat = Image.new('L', (width, height), color=255)
    dot = (Image.open(_asset_file('450pxdot.png')).copy()
                .resize((self.point_diameter, self.point_diameter), resample=Image.ANTIALIAS))
    if point_strength_type =='fixed':
        dot = _img_to_opacity(dot, self.point_strength)
        for x, y in points:
            x, y = int(x - self.point_diameter/2), int(y - self.point_diameter/2)
            heat.paste(dot, (x, y), dot)
    elif point_strength_type=='variable':
        for i in range(len(points)):
            print ('point strength: ',self.point_strength[i] )
            dot = _img_to_opacity(dot, self.point_strength[i])
            x,y = points[i][0],points[i][1]
            x, y = int(x - self.point_diameter/2), int(y - self.point_diameter/2)
            heat.paste(dot, (x, y), dot)
    return heat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant