资源简介

本资源基于MATLAB代码以及贝叶斯抠图的原理,可以通过鼠标点选前景区域和背景区域,然后由计算机处理自动生成trimap图像,并且自动抠图至所需要的新背景图层。

资源截图

代码片段和文件信息

function varargout = app(varargin)
% APP M-file for app.fig
%      APP by itself creates a new APP or raises the existing
%      singleton*.
%
%      H = APP returns the handle to a new APP or the handle to
%      the existing singleton*.
%
%      APP(‘CALLBACK‘hobjecteventDatahandles...) calls the local
%      function named CALLBACK in APP.M with the given input arguments.
%
%      APP(‘Property‘‘Value‘...) creates a new APP or raises the
%      existing singleton*.  Starting from the left property value pairs are
%      applied to the GUI before app_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to app_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE‘s Tools menu.  Choose “GUI allows only one
%      instance to run (singleton)“.
%
% See also: GUIDE GUIDATA GUIHANDLES

% Edit the above text to modify the response to help app

% Last Modified by GUIDE v2.5 17-Feb-2009 13:58:39

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name‘       mfilename ...
                   ‘gui_Singleton‘  gui_Singleton ...
                   ‘gui_OpeningFcn‘ @app_OpeningFcn ...
                   ‘gui_OutputFcn‘  @app_OutputFcn ...
                   ‘gui_LayoutFcn‘  []  ...
                   ‘gui_Callback‘   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State varargin{:});
else
    gui_mainfcn(gui_State varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before app is made visible.
function app_OpeningFcn(hobject eventdata handles varargin)
% This function has no output args see OutputFcn.
% hobject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to app (see VARARGIN)

% Choose default command line output for app
handles.output = hobject;

% Update handles structure
guidata(hobject handles);

% UIWAIT makes app wait for user response (see UIRESUME)
% uiwait(handles.figure1);

init(handles);

% --- Outputs from this function are returned to the command line.
function varargout = app_OutputFcn(hobject eventdata handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hobject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;

% --- Initialization function
function init(handles)

global appdata;
appdata.simg=[];
appdata.timg=[];
appdata.trimap=[];
appdata.matte=[];
appdata.result=[];

% clear axes
imshow([]‘Parent‘handles.source

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-06-02 10:54  贝叶斯抠图\
     文件       66896  2009-02-17 14:01  贝叶斯抠图\app.fig
     文件        9112  2009-03-01 00:47  贝叶斯抠图\app.m
     文件        4314  2010-10-17 12:20  贝叶斯抠图\bayesmat.m
     文件        1290  2010-10-17 15:50  贝叶斯抠图\cluster_OrachardBouman.asv
     文件        1290  2009-03-01 00:40  贝叶斯抠图\cluster_OrachardBouman.m
     文件         676  2019-05-28 15:21  贝叶斯抠图\getTrimap.m
     文件        1076  2009-02-28 15:42  贝叶斯抠图\getTrimap1.m
     目录           0  2019-06-02 10:54  贝叶斯抠图\images\
     目录           0  2019-06-02 10:54  贝叶斯抠图\images\bag\
     文件      707917  2008-10-13 14:24  贝叶斯抠图\images\bag\plasticbag.png
     文件        3641  2008-10-13 16:11  贝叶斯抠图\images\bag\trimap.png
     目录           0  2019-06-02 10:54  贝叶斯抠图\images\bear\
     文件       28965  2009-02-28 19:16  贝叶斯抠图\images\bear\background.jpg
     文件       35194  2009-02-16 15:27  贝叶斯抠图\images\bear\input.jpg
     文件       11776  2009-03-01 15:17  贝叶斯抠图\images\bear\Thumbs.db
     文件       13495  2009-02-28 17:35  贝叶斯抠图\images\bear\trimap.png
     目录           0  2012-09-20 15:36  贝叶斯抠图\images\bear\新建文件夹\
     目录           0  2019-06-02 10:54  贝叶斯抠图\images\dog\
     文件      295387  2009-02-28 18:02  贝叶斯抠图\images\dog\background.png
     文件       34833  2009-02-16 15:25  贝叶斯抠图\images\dog\input.jpg
     文件       12288  2009-03-01 15:24  贝叶斯抠图\images\dog\Thumbs.db
     文件       21108  2009-02-28 17:51  贝叶斯抠图\images\dog\trimap.png
     目录           0  2019-06-02 10:54  贝叶斯抠图\images\gandalf\
     文件      221812  2009-02-28 14:10  贝叶斯抠图\images\gandalf\background-small.png
     文件       35619  2009-02-28 14:03  贝叶斯抠图\images\gandalf\background.jpg
     文件      214290  2009-02-28 14:08  贝叶斯抠图\images\gandalf\input-small.png
     文件        1930  2010-10-17 16:35  贝叶斯抠图\images\gandalf\mytrimap.png
     文件       14848  2009-03-17 01:02  贝叶斯抠图\images\gandalf\Thumbs.db
     文件        8458  2009-02-28 15:13  贝叶斯抠图\images\gandalf\trimap.png
     目录           0  2019-06-02 10:54  贝叶斯抠图\images\knockout\
............此处省略30个文件信息

评论

共有 条评论