Skip to content

基于人像区域的蒙版(mask)图层的人像抠出方法,即将人和背景进行分离--A portrait extraction method based on a mask layer of a portrait area, which separates the person from the background

Notifications You must be signed in to change notification settings

HEternally/avatar-splitting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

avatar-splitting

Demo

Demo

Document

Chinese English

Introduction

A portrait extraction method based on a mask layer of a portrait area, which separates the person from the background

Installation

  1. Can be downloaded directly from GitHub
  2. Javascript introduction
<script src="https://cdn.jsdelivr.net/npm/avatar-splitting@2.0.4/dist/avatar-splitting.min.js"></script>
  1. Installed via npm
npm install --save-dev avatar-splitting

import avatar from 'avatar-splitting'

Usage

  1. The original picture and the mask are the same
avatar({
    image:'http://mtapplet.meitudata.com/5d3594af6d16f939d0.jpg', //Required, original image or original image, mask composite image, can pass url, support relative path;
    exportType: 'base64', // Optional, export image mode, you can pass base64 / canvas
    success(res) {
        console.log(res);// Res may be base64 or canvas node
    },
    error(req) {
        // Req back error reason {code:0,msg:''}
        console.log(req);
    },
});
  1. Original image and mask two The original image can be uploaded on the Mito AI open platform to obtain the mask.
avatar({
    image:'https://oss.mtlab.meitu.com/mtopen/2QSdx418G5QLTEqCVAtbKrMGTWPcP8tY/MTU2Mzg3MjQwMA==/6fa1e1c5-27cc-4bc4-97de-64edf40a3996.jpg?1563875002917', //Required, original image or original image, mask composite image, can pass url, support relative path;
    maskImage: 'https://oss.mtlab.meitu.com/mtopen/2QSdx418G5QLTEqCVAtbKrMGTWPcP8tY/MTU2Mzg3MjQwMA==/c8c87d26-8d61-420c-aad0-31356af49aa1.jpg?1563875002794', // Optional, mask map, can pass url, support relative path;
    exportType: 'canvas',
    success(res) {
        console.log(res);// Res may be base64 or canvas node
    },
    error(req) {
        // Req back error reason {code:0,msg:''}
        console.log(req);
    },
});

Version

  • 2.0.3 -- Modify README.md
  • 2.0.1 -- Support dual image mode (the original image is separated from the mask)
  • 2.0.0 -- Official release
  • 1.0.0 -- Beta release

About

基于人像区域的蒙版(mask)图层的人像抠出方法,即将人和背景进行分离--A portrait extraction method based on a mask layer of a portrait area, which separates the person from the background

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages