Skip to content

Instantly share code, notes, and snippets.

View symisc's full-sized avatar

PixLab | Symisc Systems symisc

View GitHub Profile
<?php
//////////////////////////////////
// Reddit "hot" story algorithm //
//////////////////////////////////
function hot($ups, $downs, $date)
{
if (is_string($date)) $date = strtotime($date);
$s = $ups - $downs;
@symisc
symisc / snapchat_flower_crown_effect.py
Last active August 5, 2017 00:39
Produce the famous Snapchat flower crown effect with the help of the PixLab API (https://pixlab.io/start)
import requests
import json
# Detect all human faces & extract their facial landmarks via `facelandmarks`.
# Once done, mimic the famous Snapchat flower crown filter.
# Only three commands are actually needed in order to mimic the Snapchat filters:
# face landmarks: https://pixlab.io/cmd?id=facelandmarks
# smart resize: https://pixlab.io/cmd?id=smartresize
# merge: https://pixlab.io/cmd?id=merge
# Optionally: blur, grayscale, drawtext, oilpaint, etc. for cool background effects.
@symisc
symisc / optical_character_recognition.php
Created October 3, 2017 01:19
Given an input image with human readable characters. Detect input language & extract text content from there using PixLab OCR (https://pixlab.io/cmd?id=ocr)
<?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";
# Given an image with human readable characters. Detect input language & extract text content from there.
# https://pixlab.io/#/cmd?id=ocr for additional information.
@symisc
symisc / image_colorization.py
Created October 23, 2017 04:01
Grayscale image colorization using deep learning models via the PixLab /colorize API endpoint. https://pixlab.io/cmd?id=colorize
import requests
import json
# Colorize this 1933 picture of this little girl via: https://pixlab.io/cmd?id=colorize
req = requests.get('https://api.pixlab.io/colorize',params={'img':'https://i.redd.it/7z1q27vaa9tz.png','key':'My_PixLab_Key'})
reply = req.json()
if reply['status'] != 200:
print (reply['error'])
else:
print ("Link to the colorized picture: "+ reply['link'])
@symisc
symisc / sod_realnet_train_model.c
Last active March 20, 2018 01:35
Train a Realnet Model on your CPU using the SOD Embedded API - https://sod.pixlab.io
/*
* Programming introduction with the SOD Embedded RealNets Model Training API.
* Training must be enabled via the compile-time directive SOD_ENABLE_NET_TRAIN.
*
* Copyright (C) PixLab | Symisc Systems, https://sod.pixlab.io
*/
/*
* Compile this file together with the SOD embedded source code to generate
* the executable. For example:
*
@symisc
symisc / sod_canny_edge_detection.c
Created March 26, 2018 02:45
Canny Edge Detection via the SOD Embedded Image Processing API - https://sod.pixlab.io
/*
* Programming introduction with the SOD Embedded Image Processing API.
* Copyright (C) PixLab | Symisc Systems, https://sod.pixlab.io
*/
/*
* Compile this file together with the SOD embedded source code to generate
* the executable. For example:
*
* gcc sod.c canny_edge_detection.c -lm -Ofast -march=native -Wall -std=c99 -o sod_img_proc
*
@symisc
symisc / sod_hilditch_thin.c
Created March 26, 2018 15:13
Perform Hilditch thinning on an input image - https://sod.pixlab.io
/*
* Programming introduction with the SOD Embedded Image Processing API.
* Copyright (C) PixLab | Symisc Systems, https://sod.pixlab.io
*/
/*
* Compile this file together with the SOD embedded source code to generate
* the executable. For example:
*
* gcc sod.c hilditch_thin.c -lm -Ofast -march=native -Wall -std=c99 -o sod_img_proc
*
@symisc
symisc / sod_dilate_image.c
Created March 28, 2018 00:38
Perform dilation on an input binary image - https://sod.pixlab.io
/*
* Programming introduction with the SOD Embedded Image Processing API.
* Copyright (C) PixLab | Symisc Systems, https://sod.pixlab.io
*/
/*
* Compile this file together with the SOD embedded source code to generate
* the executable. For example:
*
* gcc sod.c dilate_image.c -lm -Ofast -march=native -Wall -std=c99 -o sod_img_proc
*
@symisc
symisc / sod_blob_detection.c
Last active March 28, 2018 00:57
Perform connected component labeling on an input binary image which is useful for finding blobs (i.e. bloc of texts) - https://sod.pixlab.io
/*
* Programming introduction with the SOD Embedded Image Processing API.
* Copyright (C) PixLab | Symisc Systems, https://sod.pixlab.io
*/
/*
* Compile this file together with the SOD embedded source code to generate
* the executable. For example:
*
* gcc sod.c blob_detection.c -lm -Ofast -march=native -Wall -std=c99 -o sod_img_proc
*
@symisc
symisc / sod_erode_image.c
Created March 28, 2018 01:06
Erode an input binary image - https://sod.pixlab.io
/*
* Programming introduction with the SOD Embedded Image Processing API.
* Copyright (C) PixLab | Symisc Systems, https://sod.pixlab.io
*/
/*
* Compile this file together with the SOD embedded source code to generate
* the executable. For example:
*
* gcc sod.c erode_image.c -lm -Ofast -march=native -Wall -std=c99 -o sod_img_proc
*