Color Detection Programming

Today we’re going to use NodeJS to write a program that can detect colors from an image. User uploads an image, NodeJS will process the image on the Server side and response with a list of color RGB values. It will return predictions about the dominant colors in an image. We test with a US flag PNG image using NodeJS And the response from server is: Swatch { _rgb: [220, 4, 4], _population: 324, _hsl: [0, 0.9642857142857144, 0.4392156862745098] }, LightVibrant: Swatch { _rgb: [228, 70,…

Continue reading »

Calculating Bounding box for a face on an image

This time we’re using the Bounding box returned by Clarifai’s Face Model API . Google Vision and Amazon Face Detection Rekognition APIs are returning different type of data (x,y,width, height). Amazon Rekognition: left = image.width*BoundingBox.Left top = image.height*BoundingBox.Top   Based on the description Face Detection Model’s response on this page https://www.clarifai.com/models/face-detection-image-recognition-model/a403429f2ddf4b49b307e318f00e528b#documentation, we’ll calculate the top-left corner and bottom-right corner. given original image size 500 width x 333 height, the top-left coordinate of the image is (0.0, 0.0), and the bottom-right of the image is (1.0,…

Continue reading »

Face Detection Programming

Face Detector API and its docs are ready for deployment on github (master and dev-binh branches). The API is written in NodeJS. It’s been tested. Clients must pass a Base64 of a photo URL encoded. This API will return how many faces on a photos and bounding boxes of face areas. FaceDetector-rest Express Nodejs App Dependencies ========== “express”: “~4.14.1” “clarify”: “^2.2.0” “body-parser”: “~1.16.0” “jade”: “~1.11.0” ENVIRONMENT Variables Settings in .env CLARIFAI_API_KEY=ADD-YOUR-CLARIFAI-API-KEY-HERE (see Instruction below *) PORT = 8081 (or default 8080 if not set in…

Continue reading »