{ "info": { "author": "Picovico (originally authored by wave++)", "author_email": "info@picovico.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Build Tools" ], "description": "facedetect: a simple face detector for batch processing\n=======================================================\n\n`facedetect` is a simple face detector for batch processing. It answers the\nbasic question: \"Is there a face in this image?\" and gives back either an exit\ncode or the coordinates of each detected face in the standard output.\n\nThe aim is to provide a basic command-line interface that's consistent and easy\nto use with software such as ImageMagick_, while progressively improving the\ndetection algorithm over time.\n\n`facedetect` is used in software such as fgallery_ to improve the thumbnail\ncutting region, so that faces are always centered.\n\nInstalling from PyPi\n--------------------\n \n $ pip install facedetect-py\n\n\nBasic Usage\n-----------\n\nBy default `facedetect` outputs the rectangles of all the detected faces::\n\n ./bin/facedetect path/to/input.jpg\n 289 139 56 56\n 295 283 55 55\n\n Output : \n X, Y, Width Height\n X1, Y1, Width1, Height1\n ...\n\nThe output values are the X Y coordinates **(from the top-left corner)**,\nfollowed by width and height. For debugging, you can examine the face positions\ndirectly overlaid on the source image using the ``-o`` flag::\n\n ./bin/facedetect -o outfile.jpg path/to/input.jpg\n\nTo simply check if an image contains a face, use the ``-q`` switch and check\nthe exit status::\n\n ./bin/facedetect -q path/to/input.jpg\n echo $?\n\nAn exit status of **0 indicates the presence of at least one face**. An exit status\nof 2 means that no face could be detected (1 is reserved for failures).\n\nThe ``--center`` flag also exists for scripting convenience, and simply outputs\nthe X Y coordinates of face centers::\n\n ./bin/facedetect --center path/to/image.jpg\n 317 167\n 322 310\n\nThe ``--biggest`` flag only outputs the biggest face in the image, while\n``--best`` will attempt to select the face in focus and/or in the center of the\nframe.\n\n.. figure:: doc/biggest-best.jpg\n :align: center\n\n Comparison between ``--best`` (top) and ``--biggest`` (bottom). The\n chosen face is highlighted in yellow.\n\nUnless DOF or motion blur is used effectively by the photographer to separate\nthe subject, ``--biggest`` would in most cases select the same face as\n``--best``, while being significantly faster to compute.\n\n\nExamples\n--------\n\nSorting images with and without faces\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThe following example sorts pictures into two different \"landscape\"\nand \"people\" directories using the exit code::\n\n for file in path/to/pictures/*.jpg; do\n name=$(basename \"$file\")\n if ./bin/facedetect -q \"$file\"; then\n mv \"$file\" \"path/to/people/$name\"\n else\n mv \"$file\" \"path/to/landscape/$name\"\n fi\n done\n\nBlurring faces within an image\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThe following example uses the coordinates from `facedetect` to pixelate the\nfaces in all the source images using `mogrify` (from ImageMagick_)::\n\n for file in path/to/pictures/*.jpg; do\n name=$(basename \"$file\")\n out=\"path/to/blurred/$name\"\n cp \"$file\" \"$out\"\n ./bin/facedetect \"$file\" | while read x y w h; do\n mogrify -gravity NorthWest -region \"${w}x${h}+${x}+${y}\" \\\n\t-scale '10%' -scale '1000%' \"$out\"\n done\n done\n\nHere ``mogrify`` is called for each output line of `facedetect` (which is\nsub-optimal), modifying the file in-place.\n\nExtracting all faces to separate images\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nThe following example uses ``convert`` from ImageMagick_ to extract each\nface in each source image ``img.jpg`` to a separated image ``img_N.jpg``::\n\n for file in path/to/pictures/*.jpg; do\n name=$(basename \"$file\")\n i=0\n ./bin/facedetect \"$file\" | while read x y w h; do\n convert \"$file\" -crop ${w}x${h}+${x}+${y} \"path/to/faces/${name%.*}_${i}.${name##*.}\"\n i=$(($i+1))\n done\n done\n\n\nSearching for a face\n--------------------\n\n`facedetect` has some na\u00efve support to search for a specific face as supplied\nwith the ``-s`` file argument. The file provided must be an image containing\npreferably a *single* face. `facedetect` will then compare all faces against\nit, and output only the matches which are above the requested similarity\nthreshold (30% by default).\n\nWhen face search is used with ``-q`` (query), and exit status of 0 is only\nemitted if there is at least one face matching the requested template.\n\nThe similarity threshold can be controlled with ``--search-threshold``, which\nis a value between -100 and 100, with greater values resulting in greater\nsimilarity. The current matching algorithm is based on simple MSSIM which is\nfar from perfect (see `Development status and ideas`_).\n\n\nDependencies\n------------\n\nThe following software is currently required for `facedetect`:\n\n- Python 3 or Python 2.7\n- Python OpenCV >= 2.4 (``python3-opencv`` or ``python-opencv``)\n- OpenCV data files (``opencv-data`` if available, or ``libopencv-dev``)\n\nOn Debian/Ubuntu, you can install all the required dependencies with::\n\n sudo apt-get install python3-opencv opencv-data\n\nand then install `facedetect` with::\n\n sudo cp ./bin/facedetect /usr/local/bin\n\nor create a softlink ::\n sudo ln -s \"$(pwd)/bin/facedetect\" /usr/local/bin\n\n\nDevelopment status and ideas (Follows the original explanation by wavexx)\n-------------------------------------------------------------------------\n\nCurrently `facedetect` is not much beyond a simple wrapper over the Haar\nCascade classifier of OpenCV and the ``frontalface_alt2`` profile, which\nprovided the best results in terms of accuracy/detection rate for the general,\nreal life photos at my disposal.\n\nIn terms of speed, the LBP classifier was faster. But while the general theory\nstates that it should also be more accurate, the ``lbp_frontalface`` profile\ndidn't provide comparable results, suggesting that additional training is\nnecessary. If some training dataset is found though, creating an LBP profile\nwould probably be a better solution especially for the processing speed.\n\n``haar_profileface`` had too many false positives in my tests to be usable.\nUsing it in combination with ``haar_eye`` (and other face parts) though, to\nreduce the false positive rates and/or rank the regions, might be a very good\nsolution instead.\n\nBoth LBP and Haar don't play too well with rotated faces. This is particularly\nevident with \"artistic\" portraits shot at an angle. Pre-rotating the image\nusing the information from a Hough transform might boost the detection rate in\nmany cases, and should be relatively straightforward to implement.\n\nFace matching has the interface that user's expect (\"find me *this* face\"), but\ndoesn't work as it should. Faces are currently compared using pairwise MSSIM,\nwhich is a far cry from proper face segmentation. MSSIM will only find faces\nthat have comparable orientation, expression and lighting conditions. HAAR\nfeatures do not provide the positioning accuracy required to perform even the\nsimplest face segmentation operations, such as inter-eye distance.\nInterestingly, computing a score using 1:1 SIFT feature matches performed even\nworse than plain MSSIM (not enough granularity in most scenarios). Building a\nGUI on top of facedetect to train SVM models (which can then be fed back to\n``-s``) seems a better way to go given the far greater accuracy, but somehow\ndeviates from the original intention of unsupervised search.\n\n\nAuthors and Copyright\n---------------------\n\nThe original `facedetect` can be found at https://www.thregr.org/~wavexx/software/facedetect/\n\n| `facedetect` is distributed under GPLv2+ (see COPYING) WITHOUT ANY WARRANTY.\n| Copyright(c) 2013-2017 by wave++ \"Yuri D'Elia\" .\n\nfacedetect's GIT repository is publicly accessible at::\n\n git://src.thregr.org/facedetect (by wavexx)\n\nor at https://github.com/wavexx/facedetect (by wavexx) \nand at https://github.com/picovico/facedetect-py (by picovico)\n\n\n.. _ImageMagick: http://www.imagemagick.org\n.. _fgallery: https://www.thregr.org/~wavexx/software/fgallery/\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/picovico/facedetect-py", "keywords": "facedetect wave++ picovico slideshow-maker video-maker sdk", "license": "GPLv2+", "maintainer": "", "maintainer_email": "", "name": "facedetectpy", "package_url": "https://pypi.org/project/facedetectpy/", "platform": "", "project_url": "https://pypi.org/project/facedetectpy/", "project_urls": { "Homepage": "https://github.com/picovico/facedetect-py" }, "release_url": "https://pypi.org/project/facedetectpy/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "Facedetect Library for Python (Originally by wave++ \"Yuri D'Elia\" )", "version": "1.0.5" }, "last_serial": 3184369, "releases": { "1.0.3": [ { "comment_text": "", "digests": { "md5": "01bbe25eaad0ad886ac53dd4f94160b7", "sha256": "e0bce3eb195c59fd43135107bd1cd5966181d5af8a1cc5401aa033fb7be8aed4" }, "downloads": -1, "filename": "facedetectpy-1.0.3-py2-none-any.whl", "has_sig": false, "md5_digest": "01bbe25eaad0ad886ac53dd4f94160b7", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13543, "upload_time": "2017-09-18T17:51:33", "url": "https://files.pythonhosted.org/packages/79/84/7f902c21712f9810b2fcddbf8dd0070ca16c9b581f779ae9f761c8b80d61/facedetectpy-1.0.3-py2-none-any.whl" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "7889a3043abcee1e8cfba88f90aeb741", "sha256": "e1e1b7705b3969a96040919952fafeea508407503994b403bb7c5f9d26a92597" }, "downloads": -1, "filename": "facedetectpy-1.0.4-py2-none-any.whl", "has_sig": false, "md5_digest": "7889a3043abcee1e8cfba88f90aeb741", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13901, "upload_time": "2017-09-19T04:51:06", "url": "https://files.pythonhosted.org/packages/b8/4c/537b2a1859d8ce05bb8e914092c45c535852b7ca816667b8206e0201fb75/facedetectpy-1.0.4-py2-none-any.whl" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "8aa940a740af8eb903301b219a5d0f3d", "sha256": "f346e5721a08a3ac608c3220b84e998cdc3306d01b2445695bcda7729d10fdcd" }, "downloads": -1, "filename": "facedetectpy-1.0.5-py2-none-any.whl", "has_sig": false, "md5_digest": "8aa940a740af8eb903301b219a5d0f3d", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13966, "upload_time": "2017-09-19T04:59:41", "url": "https://files.pythonhosted.org/packages/86/20/7c5f6366e92634d648b67e1781144f551e76b636fa8fef1e2de6c8aa166e/facedetectpy-1.0.5-py2-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8aa940a740af8eb903301b219a5d0f3d", "sha256": "f346e5721a08a3ac608c3220b84e998cdc3306d01b2445695bcda7729d10fdcd" }, "downloads": -1, "filename": "facedetectpy-1.0.5-py2-none-any.whl", "has_sig": false, "md5_digest": "8aa940a740af8eb903301b219a5d0f3d", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 13966, "upload_time": "2017-09-19T04:59:41", "url": "https://files.pythonhosted.org/packages/86/20/7c5f6366e92634d648b67e1781144f551e76b636fa8fef1e2de6c8aa166e/facedetectpy-1.0.5-py2-none-any.whl" } ] }