Ask To Apps
  • Home
  • WordPress
  • Elasticsearch
  • PHP
  • Linux
  • Website Peformance

Tag : face-detection

Detect face from image using python script with OpenCV

16/08/2015 Article

Using OpenCV and python script we could able detect face from image. Here is sample code for it, but some times there is false detection due to image not clear. Here are some factors can affects face detection …

  1. Face in the image not clear.
  2. High definition colored image.
  3. Very big sized.
  4. Image having design similar to human eyes.

Prerequisites

  1. OpenCV latest version.
  2.  haarcascade_frontalface_default.xml – You can find it opencv lib.
import numpy as np
import cv2
import os
import sys

# load the image and convert

image = cv2.imread(sys.argv[1])
haarcascade =haarcascade_frontalface_default.xml

# convert the image to grayscale, load the face cascade detector,
# and detect faces in the image
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
detector = cv2.CascadeClassifier(haarcascade)
rects = detector.detectMultiScale(image, scaleFactor=1.1, minNeighbors=7,
minSize=(10, 10), flags=cv2.cv.CV_HAAR_SCALE_IMAGE)

# construct <a href="http://www.callingallcakes.org/">cartier love necklace</a> a list of bounding boxes from the detection
rects = [(int(x), int(y), int(x + w), int(y + h)) for (x, y, w, h) in rects]

# update the data <a href="http://www.uwst.org/bracelet-replica-car">cartier bracelets</a> dictionary with <a href="http://www.cartierlovebracelet.co/">cartier bracelet
</a> the faces detected
print len(rects)

Categories: Other

Tags: face, face detection, opencv, python

About Author:

Appa

Recent Posts

  • Install and configure logstash-forwarder
  • Redirect request on php script through squid proxy
  • Alerting for Elasticsearch : Log watcher in elasticsearch using ES Watcher
  • Detect face from image using python script with OpenCV
  • Change mysql root password on centos
  • Search part of word in elasticsearch using nGram – auto-complete search
  • Connect VPN on centos linux using command line
  • Custom river plugin in elasticsearch
  • Backup elasticsearch with snapshot and restore api
  • PHP code to exact keywords from text.

Tags

apache Apache Lucene cache Distributed Elastic Index Elasticsearch elasticsearch performance Git Clone Git Hub Git Hub Configuration Git Hub Installation grep Import Install MySQL JSON over HTTP Linux Linux Command Linux Commands Linux search local file lsyncd md5sum Multile Domain Multisite MySQL Open Source optimization performance php performance real time search remote file Remote Git Hub remote sync RESTful Scale Schema Free Search Engine Search Index Search keyword static cache Sub Domain sync Very fast Wordpress Wordpress multisite

Copyright Ask To Apps 2022 | Proudly powered by WordPress

facebook twitter google linkedin Email Rss