All Projects → BritishMuseumDH → britishMuseumFacesDetection

BritishMuseumDH / britishMuseumFacesDetection

Licence: MIT license
A python example for using OpenCV to identify faces within @BritishMuseum images.

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to britishMuseumFacesDetection

SEPA
Get notifications about changes in your SPARQL endpoint.
Stars: ✭ 21 (-68.18%)
Mutual labels:  rdf, sparql-query
jekyll-rdf
📃 A Jekyll plugin to include RDF data in your static site or build a complete site for your RDF graph
Stars: ✭ 46 (-30.3%)
Mutual labels:  rdf, sparql-query
OLGA
an Ontology SDK
Stars: ✭ 36 (-45.45%)
Mutual labels:  rdf, sparql-query
unfurl
Extract rich metadata from URLs
Stars: ✭ 41 (-37.88%)
Mutual labels:  rdf
carml
A pretty sweet RML engine, for RDF.
Stars: ✭ 74 (+12.12%)
Mutual labels:  rdf
python-opencv-gpu-video
GPU accelerated video processing on OpenCV with Python.
Stars: ✭ 62 (-6.06%)
Mutual labels:  opencv-python
camera calibration
Code and resources for camera calibration using arUco markers and opencv
Stars: ✭ 38 (-42.42%)
Mutual labels:  opencv-python
triplestore
Nifty library to manage, query and store RDF triples. Make RDF great again!
Stars: ✭ 101 (+53.03%)
Mutual labels:  rdf
I40KG
Contains the development for the Industry 4.0 standards knowledge graph (I40KG). Its current collaborative development is driven by VoCol - http://vocol.iais.fraunhofer.de/sto/
Stars: ✭ 50 (-24.24%)
Mutual labels:  rdf
ontology-visualization
A simple ontology and RDF visualization tool.
Stars: ✭ 102 (+54.55%)
Mutual labels:  rdf
StructuredLight
Creating a 3D reconstruction of an object using multiple images
Stars: ✭ 42 (-36.36%)
Mutual labels:  opencv-python
Counting-people-video
Counting the number of people in a video.
Stars: ✭ 60 (-9.09%)
Mutual labels:  opencv-python
mobi
Mobi is a decentralized, federated, and distributed graph data platform for teams and communities to publish and discover data, data models, and analytics that are instantly consumable.
Stars: ✭ 41 (-37.88%)
Mutual labels:  rdf
herokuobjectdetection
This is the code for Medium tutorial
Stars: ✭ 17 (-74.24%)
Mutual labels:  opencv-python
Feature-Detection-and-Matching
Feature Detection and Matching with SIFT, SURF, KAZE, BRIEF, ORB, BRISK, AKAZE and FREAK through the Brute Force and FLANN algorithms using Python and OpenCV
Stars: ✭ 95 (+43.94%)
Mutual labels:  opencv-python
Archived-SANSA-Query
SANSA Query Layer
Stars: ✭ 31 (-53.03%)
Mutual labels:  rdf
rdfshape-api
API for validating and transforming RDF, ShEx, SHACL and more.
Stars: ✭ 31 (-53.03%)
Mutual labels:  rdf
Face-Detection-and-Tracking
Face Detection and tracking using CamShift, Kalman Filter, Optical Flow
Stars: ✭ 30 (-54.55%)
Mutual labels:  opencv-python
openCVtutorials
OpenCV Tutorials
Stars: ✭ 12 (-81.82%)
Mutual labels:  opencv-python
MobyCAIRO
Computer-assisted image straightening and cropping
Stars: ✭ 16 (-75.76%)
Mutual labels:  opencv-python

DOI

A demonstration script for facial detection

This repository holds a sample terminal script for interacting with the British Museum's RDF endpoint to retrieve images and then using OpenCV, recognise faces within the images. These are then cropped and stored in a directory on your machine.

This is a very simple example and pulls busts (100 of them) from the British Museum collection and uses them to create image montages. Within the folder are all the files pulled from the example script.

This example script uses a very simple SPARQL query to retrieve 100 British Museum records of busts, where an image exists. The query is now stored in the SPARQL directory as a text file. Take note of the format with curly braces doubled up.

PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX crm: <http://erlangen-crm.org/current/>
PREFIX fts: <http://www.ontotext.com/owlim/fts#>
PREFIX bmo: <http://collection.britishmuseum.org/id/ontology/>
SELECT DISTINCT ?image
WHERE {
  ?object bmo:PX_object_type ?object_type .
  ?object_type skos:prefLabel "bust" .
  ?object bmo:PX_has_main_representation ?image .
} LIMIT 100

An example detected face can be shown below:

Original image

Detected face

There are also two montages created at the end of this script:

All images originally pulled from RDF:

All faces identified within the original images:

To use

Clone this folder to your computer:

$ git clone https://github.com/BritishMuseumDH/britishMuseumFacesDetection.git

Change to the directory:

$ cd britishMuseumFacesDetection

Install the requirements (I recommend doing this in a virtual environment):

$ pip install -r requirements.txt

Now run the script (for example):

$ python britishMuseumFaces.py -p . -d bmimages -f facesDetected -r bmimagesResized -m montages -s 200 -o 'bmImages' -t 'default' -q "bust"

There are several arguments that you use for this script:

Mandatory:

  • Path: -p or --path
  • Download directory: -d or --directory
  • Faces directory: -f or --faces
  • Resize directory: -r or --resized
  • Montages directory: -m or --montages

Optional

  • Size of cropped image: -s or --size (default 300)
  • Output file: -o or --output (default bmImages)
  • SPARQL template to use: -t or --template (default.txt is used)
  • The query to use: -q or --query (default "bust")
  • The endpoint to use: -e or --endpoint (default http://collection.britishmuseum.org/sparql)

This should run and output any error messages to your terminal. Within the script, progress is printed into your terminal window. You should see the following messages when running for the first time:

  • Your sparql query reads as: {query string}
  • Image {filename} downloaded Multiple times
  • Image path written to file Multiple times
  • {filename} resized Multiple times
  • Detecting faces in {filename} Multiple times
  • Found {number of} faces within the image Multiple times
  • Written cropped face {filename} Multiple times
  • Written highlighted face {filename} Multiple times
  • The time taken to process face detection was: --- {x} seconds ---
  • {Total number of } faces were identified in total
  • The dimensions of the montage are {XbyY}
  • Now creating image montage of all retrieved images
  • Now resizing image montage of all retrieved images
  • Now creating image montage of all faces detected in images
  • Now resizing image montage of all faces detected in images
  • Facial detection complete

License

MIT for script. CC-BY-NC-SA for all image content, copyright the Trustees of the British Museum.

Authors

  • Daniel Pett, The British Museum @portableant
  • Harrison Pim, The British Museum @harrisonpim
  • Ben O'Steen, The British Library @benosteen
  • Richard Wareham, Cambridge University @rjw57
  • Matthew Vincent, Rekrei @neshmi

To do

  • PEP 8
  • Face matching
  • Use of apis as well as SPARQL
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].