Skip to content

Instantly share code, notes, and snippets.

View symisc's full-sized avatar

PixLab | Symisc Systems symisc

View GitHub Profile
@symisc
symisc / id_card_scan.py
Last active November 3, 2019 04:15
Scan a government issued ID card via the PixLab docscan API endoint. Extract the user face and process all fields - https://pixlab.io/cmd?id=docscan
import requests
import json
# Given a government issued ID card from Malaysia, Singapore, etc., extract the user face and parse all fields.
#
# PixLab recommend that you connect your AWS S3 bucket via your dashboard at https://pixlab.io/dashboard
# so that any cropped face or MRZ crop is stored automatically on your S3 bucket rather than the PixLab one.
# This feature should give you full control over your analyzed media files.
#
# https://pixlab.io/cmd?id=docscan for additional information.
@symisc
symisc / detect_nsfw_content.py
Last active February 21, 2020 00:38
Detect not suitable for work (i.e. nudity & adult) content in a given image or video frame and apply a blur filter if the NSFW score is high enough - https://pixlab.io/cmd?id=nsfw
import requests
import json
# Target Image: Change to any link (Possibly adult) you want or switch to POST if you want to upload your image directly, refer to the sample set for more info.
img = 'https://i.redd.it/oetdn9wc13by.jpg'
# Your PixLab API key that you can obtain from https://pixlab.io/dashboard
key = 'PIXLAB_API_KEY'
# Censor an image according to its NSFW score
req = requests.get('https://api.pixlab.io/nsfw',params={'img':img,'key':key})
@symisc
symisc / id_card_scan.php
Last active November 3, 2019 04:15
Scan a government issued ID card via the PixLab docscan API endoint. Extract the user face and process all fields - https://pixlab.io/cmd?id=docscan
<?php
/*
* Usage sample of the ID card scnner from PixLab.
*/
/*
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
* https://github.com/symisc/pixlab-php
*/
require_once "pixlab.php";
# Given a government issued ID card from Malaysia, Singapore, etc., extract the user face and parse all fields.
@symisc
symisc / id_card_scan_india.py
Last active February 11, 2021 09:53
Scan a government issued ID card from India/Malaysia/Singapore and others via the PixLab docscan API endpoint. Extract the user face and process all fields - https://pixlab.io/cmd?id=docscan
import requests
import json
# Given a government issued ID card from India (Aadhaar), Malaysia, Singapore, etc., extract the user face and parse all fields.
#
# PixLab recommend that you connect your AWS S3 bucket via your dashboard at https://pixlab.io/dashboard
# so that any cropped face or MRZ crop is stored automatically on your S3 bucket rather than the PixLab one.
# This feature should give you full control over your analyzed media files.
#
# https://pixlab.io/cmd?id=docscan for additional information.
@symisc
symisc / id_card_scan_india.php
Last active October 14, 2021 01:07
Scan Indian Aadhar) ID card via the PixLab docscan API endpoint. Extract the user face and process all fields - https://pixlab.io/cmd?id=docscan
<?php
/*
* Usage sample of the ID card scanner API endpoint from PixLab - https://pixlab.io/cmd?id=docscan.
*/
/*
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
* https://github.com/symisc/pixlab-php
*/
require_once "pixlab.php";
# Given a government issued ID card from India, Malaysia, Singapore, etc., extract the user face and parse all fields.
import requests
import json
# Given a government issued ID card from India (Aadhaar), Malaysia, Singapore, etc., extract the user face and parse all fields.
#
# PixLab recommend that you connect your AWS S3 bucket via your dashboard at https://pixlab.io/dashboard
# so that any cropped face or MRZ crop is stored automatically on your S3 bucket rather than the PixLab one.
# This feature should give you full control over your analyzed media files.
#
# https://pixlab.io/cmd?id=docscan for additional information.
@symisc
symisc / auto_blur_faces.py
Last active May 27, 2021 00:54
Apply a blur filter automatically for each detected face using the PixLab Rest API (Python Sample)
import requests
import json
imgUrl = 'https://pixlab.io/images/m3.jpg' # Target picture we want to blur any face on
# Detect all human faces in a given image via /facedetect first and blur all of them later via /mogrify.
# https://pixlab.io/cmd?id=facedetect & https://pixlab.io/cmd?id=mogrify for additional information.
req = requests.get('https://api.pixlab.io/facedetect',params={
'img': imgUrl,
@symisc
symisc / auto_blur_faces.php
Last active August 21, 2024 17:48
Apply a blur filter automatically for each detected face using the PixLab Rest API (PHP Sample)
<?php
/*
* PixLab PHP Client which is just a single class PHP file without any dependency that you can get from Github
* https://github.com/symisc/pixlab-php
*/
require_once "pixlab.php";
# Detect all human faces in a given image via `facedetect` and blur all of them via `mogrify`.
# https://pixlab.io/cmd?id=facedetect & https://pixlab.io/cmd?id=mogrify for additional information.
@symisc
symisc / ascii_art.c
Created February 9, 2021 02:32
Introduction to the ASCII Art C/C++ Interfaces - https://pixlab.io/art
/*
* Compile this file together with the ASCII Art source code (https://pixlab.io/art - https://github.com/symisc/ascii_art)
* to generate the executable. For example:
*
* gcc -W -Wall -O6 ascii_art.c sample.c -o ascii -D ART_ENABLE_STB_IMAGE
* ./ascii test.png
*
* ART_ENABLE_STB_IMAGE directive must be defined in order to load images from disk.
* Otherwise you have to rely on an external library such as OpenCV to load the target images.
*
@symisc
symisc / pixlab_random_pixelgenerate.py
Created February 11, 2021 00:44
Dynamically generates a set of random pixels of desired width & height using PixLab /pixelgenerate API endpoint - https://pixlab.io/cmd?id=pixelgenerate
import requests
import json
# Generates a set of random pixels of desired Width & Height. This endpoint is similar to /newimage except that the image contents is filled with random pixels. This is very useful for generating background (negative) samples for feeding Machine Learning training algorithms
req = requests.get('https://api.pixlab.io/pixelgenerate',params={
'key':'PIXLAB_API_KEY', # https://pixlab.io/dashboard to get your API Key
"width":300,
"height":300
})
reply = req.json()