diff options
author | jwansek <eddie.atten.ea29@gmail.com> | 2020-08-25 03:27:52 +0100 |
---|---|---|
committer | jwansek <eddie.atten.ea29@gmail.com> | 2020-08-25 03:27:52 +0100 |
commit | a1eca9b3526593d29b03300000e3b597a62e37b3 (patch) | |
tree | b5e15c2fb79602fbcfe58a4f8d6982fc0a497858 | |
parent | 728f9f3b0a35d1dd66f15ef5f159d5bc8d4b85e2 (diff) | |
download | yaoi-communism-a1eca9b3526593d29b03300000e3b597a62e37b3.tar.gz yaoi-communism-a1eca9b3526593d29b03300000e3b597a62e37b3.zip |
added facial recognision
-rw-r--r-- | eecd4b76e33c1bd5268af4d2548e069710471556.jpg | bin | 0 -> 301353 bytes | |||
-rw-r--r-- | get_images.py | 30 | ||||
-rw-r--r-- | sample_2d721fcdd0bea00c0c9462ba5cf8e52b7839d3b4.jpg | bin | 0 -> 97010 bytes | |||
-rw-r--r-- | sample_d1aa0bd33d0188e9fd84d63995d3b1244840f14b.jpg | bin | 0 -> 140678 bytes |
4 files changed, 25 insertions, 5 deletions
diff --git a/eecd4b76e33c1bd5268af4d2548e069710471556.jpg b/eecd4b76e33c1bd5268af4d2548e069710471556.jpg Binary files differnew file mode 100644 index 0000000..50bfb9c --- /dev/null +++ b/eecd4b76e33c1bd5268af4d2548e069710471556.jpg diff --git a/get_images.py b/get_images.py index 08a17e3..b4fef24 100644 --- a/get_images.py +++ b/get_images.py @@ -83,14 +83,34 @@ class DownloadedImage: def __exit__(self, type, value, traceback): os.remove(self.filename) -if __name__ == "__main__": - # print(get_image(get_random_searchtag())) +def main(): + try: + simg = get_image(get_random_searchtag()) + except ConnectionError: + main() - simg = get_image(get_random_searchtag()) with DownloadedImage(simg.imurl) as impath: img = cv2.imread(impath) - cv2.imshow("img, ", img) - cv2.waitkey(0) + cascade = cascade = cv2.CascadeClassifier(os.path.join("lbpcascade_animeface", "lbpcascade_animeface.xml")) + gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) + gray = cv2.equalizeHist(gray) + + faces = cascade.detectMultiScale(gray, + # detector options + scaleFactor = 1.1, + minNeighbors = 5, + minSize = (24, 24)) + for (x, y, w, h) in faces: + cv2.rectangle(img, (x, y), (x + w, y + h), (0, 0, 255), 2) + + cv2.imshow("Press <q> to exit", img) + cv2.waitKey(0) + +if __name__ == "__main__": + main() + + + diff --git a/sample_2d721fcdd0bea00c0c9462ba5cf8e52b7839d3b4.jpg b/sample_2d721fcdd0bea00c0c9462ba5cf8e52b7839d3b4.jpg Binary files differnew file mode 100644 index 0000000..ff5aab9 --- /dev/null +++ b/sample_2d721fcdd0bea00c0c9462ba5cf8e52b7839d3b4.jpg diff --git a/sample_d1aa0bd33d0188e9fd84d63995d3b1244840f14b.jpg b/sample_d1aa0bd33d0188e9fd84d63995d3b1244840f14b.jpg Binary files differnew file mode 100644 index 0000000..d885808 --- /dev/null +++ b/sample_d1aa0bd33d0188e9fd84d63995d3b1244840f14b.jpg |