github에서 heatmappy 설치

이카루스·2024년 1월 18일

코드공부

목록 보기
5/8

heatmappy란?


이렇게 이미지, 동영상 위에 히트맵을 시각화할 수 있습니다.

설치 문제

근데 pip install heatmappy을 사용하면 pip으로도 설치가 가능하다곤 하지만,... 어떠한 오류 때문인지 설치가 안되더라구요

git clone 사용해서 설치하기

 git clone "https://github.com/LumenResearch/heatmappy.git"

이것을 터미널에 입력하면

이렇게 파일이 만들어 집니다. 파일 주소는 어떤 환경에서 진행하는지에 따라 달라지니 파일명을 검색에 쳐서 찾아보는 방법이 빠를 수 있습니다.

그 다음,

이렇게 코드를 실행시켜 터미널에서 해당 파일에 들어가서

python setup.py install

을 실행하면 사용할 수 있습니다.

examples code

from heatmappy import Heatmapper

from PIL import Image

example_points = [(100, 20), (120, 25), (200, 50), (60, 300), (170, 250)]

# 히트맵 그리기
heatmapper = Heatmapper(
    point_diameter=150,  # the size of each point to be drawn
    point_strength=1,  # the strength, between 0 and 1, of each point to be drawn
    opacity=0.6,  # the opacity of the heatmap layer
    colours='default',  # 'default' or 'reveal'
                        # OR a matplotlib LinearSegmentedColorMap object 
                        # OR the path to a horizontal scale image
    grey_heatmapper='PIL'  # The object responsible for drawing the points
                           # Pillow used by default, 'PySide' option available if installed
)
example_img_path = 'cat.jpg'
example_img = Image.open(example_img_path)
profile
The ones who are crazy enough to think that they can change the world are the ones who do."(steven Jobs, 2015). 세상을 바꾸는 '미친' 아이디어를 찾아내 세상을 바꾸고자 하는 AI 연구자입니다.

0개의 댓글