| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
10年前发布

内容感知图像裁剪:smartcrop.js

Smartcrop.js实现了一种算法来进行更好的进行截图。

Example
Image: https://www.flickr.com/photos/endogamia/5682480447/ by N. Feans

示例

算法概览

Smartcrop.js works using fairly dumb image processing. In short:

  1. Find edges using laplace
  2. Find regions with a color like skin
  3. Find regions high in saturation
  4. Generate a set of candidate crops using a sliding window
  5. Rank them using a importance function to focus the detail in the center and avoid it in the edges.
  6. Output the candidate crop with the highest rank

Simple Example

SmartCrop.crop(image, {width: 100, height: 100}, function(result){console.log(result);});  // {topCrop: {x: 300, y: 200, height: 200, width: 200}}

Download/ Installation

npm install smartcroporbower install smartcropor just download smartcrop.js from the git repo.

CLI / Node.js

The smartcrop-cli offers command line interface to smartcrop.js. It is based on node.js and node-canvas. You can also view it as an example on how to use smartcrop.js from a node.js app.

Module Formats

Supported:

  • common js
  • amd
  • global export / window

项目主页:http://www.open-open.com/lib/view/home/1444827996232

 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1444827996232.html
图形/图像处理 smartcrop.js