Smart Thumbnail

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. I/O 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 requested thumbnail width, if not provided this defaults to 188 . thumbnailHeight - (optional) - the requested 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]
 url variant example Input [ 
 "data://opencv/temp_zeryx/1.png",
 "data://.algo/temp/1.png",
 200,
 400,
 "avgCentroid"
 ]
 Output "data://.algo/temp/1.png"
 Credits This algorithm utilizes opencv 's java library, as well as DeepLearning's Salnet .

Tags
(no tags)

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
=
Estimated cost
per calls
for large volume discounts
For additional details on how pricing works, see Algorithmia pricing.

Internet access

This algorithm has Internet access. This is necessary for algorithms that rely on external services, however it also implies that this algorithm is able to send your input data outside of the Algorithmia platform.


Calls other algorithms

This algorithm has permission to call other algorithms. This allows an algorithm to compose sophisticated functionality using other algorithms as building blocks, however it also carries the potential of incurring additional royalty and usage costs from any algorithm that it calls.


To understand more about how algorithm permissions work, see the permissions documentation.

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.1.3
View cURL Docs
algo auth
# Enter API Key: YOUR_API_KEY
algo run algo://opencv/SmartThumbnail/2.1.3 -d '{{input | formatInput:"cli"}}'
View CLI 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.1.3");
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.1.3")
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.1.3")
           .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.1.3")
           .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.1.3')
print algo.pipe(input)
View Python Docs
library(algorithmia)

input <- {{input | formatInput:"r"}}
client <- getAlgorithmiaClient("YOUR_API_KEY")
algo <- client$algo("opencv/SmartThumbnail/2.1.3")
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.1.3')
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.1.3');
let response = algo.pipe(input);
View Rust Docs
Discussion
  • {{comment.username}}