⛄一、获取代码方式

获取代码方式1: 完整代码已上传我的资源:【图像处理】基于matlab不同情绪状态下身体感觉的地形图【含Matlab源码 2425期】 点击上面蓝色字体,直接付费下载,即可。

获取代码方式2: 付费专栏Matlab图像处理(初级版)

备注: 点击上面蓝色字体付费专栏Matlab图像处理(初级版),扫描上面二维码,付费29.9元订阅海神之光博客付费专栏Matlab图像处理(初级版),凭支付凭证,私信博主,可免费获得1份本博客上传CSDN资源代码(有效期为订阅日起,三天内有效); 点击CSDN资源下载链接:1份本博客上传CSDN资源代码

⛄二、部分源代码

% let’s begin close all clear all

% get a list of subjects basepath=‘demo_subjects’; % folder where subjects are subjects=dir([basepath ‘/*’]);

% the base image used for painting (in our case only one sided since we % subtract values) base=uint8(imread(‘base.png’)); base2=base(10:531,33:203,:); % single image base labels={‘Neutral’ ‘Fear’ ‘Anger’ ‘Disgust’ ‘Sadness’ ‘Happiness’ ‘Surprise’ ‘Anxiety’ ‘Love’ ‘Depression’ ‘Contempt’ ‘Pride’ ‘Shame’ ‘Jealousy’ }; mask=imread(‘mask.png’);

% for each subject, load data for s=1:length(subjects) % skip dot and dotdot folders if(strcmp(subjects(s).name(1),‘.’)) continue; end

%% Data loading

% let's load the subject's answers into a variable a

data=load_subj([basepath '/' subjects(s).name],2);

NC=length(data); % number of conditions

%% Painting reconstruction

% 'data' now contains all mouse movements. What we need are the mouse

% locations while the button was pressed (i.e. during painting)

% Furthermore, the painting tool has a brush size. We recreate that

% using image filter

for n=1:NC;

T=length(data(n).paint(:,2)); % number of mouse locations

over=zeros(size(base,1),size(base,2)); % empty matrix to reconstruct painting

for t=1:T

y=ceil(data(n).paint(t,3)+1);

x=ceil(data(n).paint(t,2)+1);

if(x<=0) x=1; end

if(y<=0) y=1; end

if(x>=900) x=900; end % hardcoded for our experiment, you need to change it if you changed layout

if(y>=600) y=600; end % hardcoded for our experiment, you need to change it if you changed layout

over(y,x)=over(y,x)+1;

end

% Simulate brush size with a gaussian disk

h=fspecial('gaussian',[15 15],5);

over=imfilter(over,h);

% we subtract left part minus right part of painted area

% values are hard-coded to our web layout

over2=over(10:531,33:203,:)-over(10:531,696:866,:);

resmat(:,:,n)=over2;

end

⛄三、运行结果

⛄四、matlab版本及参考文献

1 matlab版本 2014a

2 参考文献 [1] 蔡利梅.MATLAB图像处理——理论、算法与实例分析[M].清华大学出版社,2020. [2]杨丹,赵海滨,龙哲.MATLAB图像处理实例详解[M].清华大学出版社,2013. [3]周品.MATLAB图像处理与图形用户界面设计[M].清华大学出版社,2013. [4]刘成龙.精通MATLAB图像处理[M].清华大学出版社,2015.

3 备注 简介此部分摘自互联网,仅供参考,若侵权,联系删除

精彩链接

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: