No algorithm description given
Notice: This algorithm has recently had a major upgrade. Table of Contents Introduction I/O Examples credits Algorithm Console Introduction This algorithm creates a thumbnail of the object of interest in an image, whether it's a person or a iphone, using both opencv face recognition as well as deepLearning's new Saliency Detector Salnet . The default method takes an average of the centroid of the biggest face (if any detected) and the centroid of saliency in the image.the alternate method tries to find a face in the image, and if it fails to find any it reverts to the centroid of saliency. Note: we've added JSON input functionality in version 2.2.0 I/O Json input variant Input { "image":String, "imageBytes":Byte[], "outputUrl":String, "width":int, "height":int, "method":String } image - (required) - an input image as either a url, data connector uri (data://, s3://, etc) or a base 64 encoded string. image or imageBytes must be defined imageBytes - (required) - an input image as an array of bytes. image or imageBytes must be defined outputUrl - (required) - the output data connector path to where you want to save the thumbnail to, unlike other methods, the outputUrl must be defined in the JSON input variant width - (optional) - the desired thumbnail width. defaults to 188 height - (optional) - the desired thumbnail height. defaults to 265 method - (optional) - the requested functionality of the algorithm, if set to avgCentroid it uses the average centroid algorithm, if set to fallback it uses the face/saliency fallback algorithm. defaults to avgCentroid . Simple input variant Input input: String/Byte[] input - (required) - input can either be a url/uri to the source image to thumbnail, or a byte array of the image itself. It should contain a persons face but if not we'll create a thumbnail around the center of the image, image format agnostic. Output output: Byte[] output - the output is always a binary array for the simple input variant. URL input variant Input [ inputUrl: String, outputUrl: String, thumbnailWidth: Int, thumbnailHeight: Int, method: String ] inputUrl - (required) - a url/uri to the source image to thumbnail, it can either be accessable via http/https or through a algorithmia data connector, is image format agnostic. outputUrl - (optional) - the output directory, can accept any algorithmia data connector path if not provided the output file is returned as binary. thumbnailWidth - (optional) - the desired thumbnail width. defaults to 188 . thumbnailHeight - (optional) - the desired thumbnail height. defaults to 264. method - (optional) - the requested functionality of the algorithm, if set to avgCentroid it uses the average centroid algorithm, if set to fallback it uses the face/saliency fallback algorithm. defaults to avgCentroid . Output output: String/Byte[] output - the output file path specified by the input parameter outputUrl , if outputUrl is not provided it is output as a byte array. Binary input variant Input [ input: Byte[], outputUrl: String, thumbnailWidth: Int, thumbnailHeight: Int, method: String ] input - (required) - the source image as a byte array, is image format agnostic (it'll handle any image type). outputUrl - (optional) - the output directory, can accept any algorithmia data connector path if not provided the output file is returned as binary. thumbnailWidth - (optional) - the requested thumbnail width, if not provided this defaults to 188 . thumbnailHeight - (optional) - the requested thumbnail height, if not provided this deafults to 264 . method - (optional) - the requested functionality of the algorithm, if set to avgCentroid it uses the average centroid algorithm, if set to fallback it uses the face/saliency fallback algorithm. defaults to avgCentroid . Output output: String/Byte[] output - the output file path specified by the input parameter outputUrl , if outputUrl is not provided it is output as a byte array. Examples Simple Example Input "data://opencv/temp_zeryx/1.png" Output [Binary Array] array - url variant example Input [ "data://opencv/temp_zeryx/1.png", "data://.algo/temp/1.png", 200, 200, true ] Output "data://.algo/temp/1.png" json variant example Input { "image":"data://opencv/temp_zeryx/5.png", "outputUrl":"data://.algo/temp/5_mapped.png", "height":100, "width":50 } Output "data://.algo/temp/5_mapped.png" Credits This algorithm utilizes opencv 's java library, as well as DeepLearning's Salnet .
Cost Breakdown
2 cr
royalty per call
1 cr
usage per second
avg duration
This algorithm has permission to call other algorithms which may incur separate royalty and usage costs.
Cost Calculator
API call duration (sec)
×
API calls
=
For additional details on how pricing works, see
Algorithmia pricing.
1. Type your input
2. See the result
Running algorithm...
3. Use this algorithm
curl -X POST -d '{{input | formatInput:"curl"}}' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY' https://api.algorithmia.com/v1/algo/opencv/SmartThumbnail/2.2.1
View cURL Docs
algo auth
# Enter API Key: YOUR_API_KEY
algo run algo://opencv/SmartThumbnail/2.2.1 -d '{{input | formatInput:"cli"}}'
View CLI Docs
import (
algorithmia "github.com/algorithmiaio/algorithmia-go"
)
input := {{input | formatInput:"go"}}
var client = algorithmia.NewClient("YOUR_API_KEY", "")
algo, _ := client.Algo("algo://opencv/SmartThumbnail/2.2.1")
resp, _ := algo.Pipe(input)
response := resp.(*algorithmia.AlgoResponse)
fmt.Println(response.Result)
View Go Docs
import com.algorithmia.*;
import com.algorithmia.algo.*;
String input = "{{input | formatInput:"java"}}";
AlgorithmiaClient client = Algorithmia.client("YOUR_API_KEY");
Algorithm algo = client.algo("algo://opencv/SmartThumbnail/2.2.1");
AlgoResponse result = algo.pipeJson(input);
System.out.println(result.asJsonString());
View Java Docs
import com.algorithmia._
import com.algorithmia.algo._
val input = {{input | formatInput:"scala"}}
val client = Algorithmia.client("YOUR_API_KEY")
val algo = client.algo("algo://opencv/SmartThumbnail/2.2.1")
val result = algo.pipeJson(input)
System.out.println(result.asJsonString)
View Scala Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
.algo("algo://opencv/SmartThumbnail/2.2.1")
.pipe(input)
.then(function(output) {
console.log(output);
});
View Javascript Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
.algo("algo://opencv/SmartThumbnail/2.2.1")
.pipe(input)
.then(function(response) {
console.log(response.get());
});
View NodeJS Docs
import Algorithmia
input = {{input | formatInput:"python"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('opencv/SmartThumbnail/2.2.1')
print algo.pipe(input)
View Python Docs
library(algorithmia)
input <- {{input | formatInput:"r"}}
client <- getAlgorithmiaClient("YOUR_API_KEY")
algo <- client$algo("opencv/SmartThumbnail/2.2.1")
result <- algo$pipe(input)$result
print(result)
View R Docs
require 'algorithmia'
input = {{input | formatInput:"ruby"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('opencv/SmartThumbnail/2.2.1')
puts algo.pipe(input).result
View Ruby Docs
use algorithmia::*;
let input = {{input | formatInput:"rust"}};
let client = Algorithmia::client("YOUR_API_KEY");
let algo = client.algo("opencv/SmartThumbnail/2.2.1");
let response = algo.pipe(input);
View Rust Docs
import Algorithmia
let input = "{{input | formatInput:"swift"}}";
let client = Algorithmia.client(simpleKey: "YOUR_API_KEY")
let algo = client.algo(algoUri: "opencv/SmartThumbnail/2.2.1") { resp, error in
print(resp)
}
View Swift Docs