[PYTHON] How to use imutils

What is imutils?

For what kind of person

Someone who does face detection. It's good that it doesn't look like hard coding. For example, if you don't use imutils

python


point_idxs = [
     1,  # right ear 
     3,  # right cheak1 
     4,  # right cheak2 
     33,  # nose top 
     12,  # left cheak1
     13,  # left cheak2 
     15,  # left ear 
     28,  # nose line 
 ] 
warp_points = [0, 2, 4, 6] 

What was supposed to be

python


from imutil import face_util
(lStart, lEnd) = face_utils.FACIAL_LANDMARKS_IDXS["left_eye"]
(rStart, rEnd) = face_utils.FACIAL_LANDMARKS_IDXS["right_eye"]
(mStart, mEnd) = face_utils.FACIAL_LANDMARKS_IDXS["mouth"]

Can be done

python


shape = predictor(gray, rects[0])
shape = face_utils.shape_to_np(shape)

Can be done.

python


frame = imutils.resize(frame, width=450)

However, it has the disadvantage of increasing the number of extra libraries.

Recommended Posts

How to use imutils
How to use xml.etree.ElementTree
How to use Python-shell
How to use tf.data
How to use virtualenv
How to use Seaboan
How to use image-match
How to use Pandas 2
How to use Virtualenv
How to use pytest_report_header
How to use Bio.Phylo
How to use SymPy
How to use x-means
How to use WikiExtractor.py
How to use IPython
How to use virtualenv
How to use Matplotlib
How to use iptables
How to use numpy
How to use TokyoTechFes2015
How to use venv
How to use dictionary {}
How to use Pyenv
How to use python-kabusapi
How to use return
How to use dotenv
How to use pyenv-virtualenv
How to use Go.mod
How to use import
How to use Qt Designer
How to use search sorted
[gensim] How to use Doc2Vec
python3: How to use bottle (2)
Understand how to use django-filter
[Python] How to use list 1
How to use FastAPI ③ OpenAPI
How to use IPython Notebook
How to use Pandas Rolling
[Note] How to use virtualenv
Python: How to use pydub
[Python] How to use checkio
How to use Django's GeoIp2
[Python] How to use input ()
How to use Jupyter Notebook
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Google Colaboratory
How to use Python bytes
How to use cron (personal memo)
Python: How to use async with
How to use the zip function
How to use the optparse module
How to use SWIG from waf
Summary of how to use pandas.DataFrame.loc
How to use classes in Theano
[Python] How to use Pandas Series
How to use Dataiku on Windows
Notes on how to use pywinauto
How to use virtualenv with PowerShell
How to use Python's logging module