Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 기사시험
- pytorch
- Apple
- Anaconda
- NCS
- Python
- 큐넷
- 실기시험
- qnet
- torch
- 정보처리기사
- DEEPLEARNING
- Logitech
- 파이썬
- 국가자격증
- 자격증
- python3
- 파이토치
- 2020정보처리기사
- keyboards
- 정보처리기사 실기
- 코딩
- 정보처리
- 실기
- 딥러닝
- ubuntu
- 로지텍
- 기사 실기
- coding
- 우분투
Archives
- Today
- Total
dhwiii's notepad | 딥 러닝, 코덱 일기장
(Python) MS Azure Face cognition API를 사용한 파이썬 얼굴인식 예제 본문
■ Working Draft/◎ Coding
(Python) MS Azure Face cognition API를 사용한 파이썬 얼굴인식 예제
dhwiii 2020. 6. 9. 16:38import cognitive_face as CF
KEY = 'PERSONAL_KEY'
# Replace with a valid subscription key (keeping the quotes in place).
CF.Key.set(KEY)
BASE_URL = 'https://koreacentral.api.cognitive.microsoft.com/face/v1.0'
# Replace with your regional Base URL
CF.BaseUrl.set(BASE_URL)
# You can use this example JPG or replace the URL below with your own URL to a JPEG image.
img_url = 'PERSONAL_IMG'
#img_url have to load web or Cloud file (not using local file)
#img_url = 'myimage.jpg'
faces = CF.face.detect(img_url, True , False, "age,gender,emotion")
for i in faces:
print(i)
print()
# draw face rect on image
import requests
from io import BytesIO
from PIL import Image, ImageDraw
#Convert width height to a point in a rectangle
def getRectangle(faceDictionary):
rect = faceDictionary['faceRectangle']
left = rect['left']
top = rect['top']
bottom = left + rect['height']
right = top + rect['width']
return ((left, top), (bottom, right))
#Download the image from the url
response = requests.get(img_url)
img = Image.open(BytesIO(response.content))
#For each face returned use the face rectangle and draw a red box.
draw = ImageDraw.Draw(img)
for face in faces:
draw.rectangle(getRectangle(face), outline='red')
#Display the image in the users default image browser.
img.show()
(수정중)
MS Azure Face cognition API 를 사용한 얼굴인식 예제입니다.
결과값은 json 으로 반환됩니다.
출처 : oceancoding.blogspot.com/2019/01/ms-azure-face.html
'■ Working Draft > ◎ Coding' 카테고리의 다른 글
[Python] Jupyter notebook에서 줄번호 (Line Number) 보이게 하는 방법 (0) | 2020.08.04 |
---|---|
(Python 코딩) OpenCV를 이용한 얼굴인식 예제 (0) | 2020.02.27 |