ユーザーブロマガは2021年10月7日(予定)をもちましてサービスを終了します

  • JCがDDC EDIDとかいろいろする枠

    2020-03-15 21:23
  • 広告
  • opencvにゃす

    2019-02-12 02:20







    (gray, 1.3, 5)
    (gray, 5.3, 1)











    (gray, 1.3, 5)
    (gray, 1.3, 1)









    (gray, 1.3, 5)
    (gray, 1.3, 1)









    (gray, 1.3, 5)
    (gray, 1.3, 1)









    (gray, 1.3, 5)
    (gray, 1.3, 1)




    import numpy as np
    import cv2

    face_cascade = cv2.CascadeClassifier('F:\\Tools\\Anaconda3\\Lib\\site-packages\\cv2\\data\\haarcascade_frontalface_default.xml')
    eye_cascade = cv2.CascadeClassifier('F:\\Tools\\Anaconda3\\Lib\\site-packages\\cv2\\data\\haarcascade_eye.xml')

    img = cv2.imread('The_Avengers-Age_of_Ultron-San_Diego_Comic-Con-July_26-2014-001.jpg')
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    faces = face_cascade.detectMultiScale(gray, 1.3, 1)
    for (x,y,w,h) in faces:
    img = cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
    roi_gray = gray[y:y+h, x:x+w]
    roi_color = img[y:y+h, x:x+w]
    eyes = eye_cascade.detectMultiScale(roi_gray)
    for (ex,ey,ew,eh) in eyes:
    cv2.rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2)

    cv2.imshow('img',img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()


    ------------------------------------------------------------------------------

    import numpy as np
    import cv2
    import sys

    args = sys.argv

    face_cascade = cv2.CascadeClassifier('F:\\Tools\\Anaconda3\\Lib\\site-packages\\cv2\\data\\haarcascade_frontalface_default.xml')

    img = cv2.imread(args[1])
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    faces = face_cascade.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=2, minSize=(30, 30))
    for (x,y,w,h) in faces:
    img = cv2.rectangle(img,(int(x+w*0.1),int(y+h*0.25)),(int(x+(w-w*0.1)),int(y+(h-h*0.55))),(0,0,0), -1)

    cv2.imshow('img',img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()


    ------------------------------------------------------------------------------








  • LDAPまとめ

    2018-11-05 07:16