用matlab的guide实现对人像的美颜功能,数字图像处理技术。
设计内容及要求:
人脸皮肤的光滑程度很大程度影响人的容貌,很多时候,我们希望拍出
来的照片能更漂亮一些。请设计一美颜软件,实现如下功能:
1、 拍摄一幅彩色人像,对该彩色图像设计一可变模板大小的平滑滤波
器,对人像图像进行滤波处理;
2、 针对面部斑点设计滤波器进行消除
3、 设计亮度调整函数,调整该图像亮度;
4、 调整该图像饱和度,使图像色彩鲜艳程度改变
5、 设计 GUI 界面
设计内容及要求:
人脸皮肤的光滑程度很大程度影响人的容貌,很多时候,我们希望拍出
来的照片能更漂亮一些。请设计一美颜软件,实现如下功能:
1、 拍摄一幅彩色人像,对该彩色图像设计一可变模板大小的平滑滤波
器,对人像图像进行滤波处理;
2、 针对面部斑点设计滤波器进行消除
3、 设计亮度调整函数,调整该图像亮度;
4、 调整该图像饱和度,使图像色彩鲜艳程度改变
5、 设计 GUI 界面
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2444 2019-07-09 16:41 gray2rgb.m
文件 718 2019-07-07 22:35 hsitorgb.m
文件 24274 2019-07-10 00:36 meiyan.fig
文件 19398 2019-07-15 14:55 meiyan.m
文件 879 2019-07-08 01:25 meiyan1.m
文件 647 2019-07-09 17:21 pinghua.m
文件 727 2019-07-10 00:31 qiuhe.m
文件 363 2019-07-05 00:39 rgbtohsi.m
文件 136312 2019-07-04 10:41 标准测试图.jpg
文件 43247 2019-07-04 10:42 标准测试图2.jpg
文件 20932 2019-07-04 11:01 痣1.jpg
文件 219465 2019-07-04 11:06 痣2.png
文件 246932 2019-07-04 10:53 皱纹1.jpeg
文件 49703 2019-07-04 10:55 皱纹2.jpg
文件 217346 2019-07-04 11:07 皱纹3.jpg
文件 91148 2019-07-04 10:51 粗糙1.jpeg
文件 10141 2019-07-04 11:10 粗糙2.jpg
文件 20760 2019-07-04 10:49 雀斑1.jpg
文件 23810 2019-07-04 11:09 雀斑2.jpg
function R=gray2rgb(img1img2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This Program converts a gray image ro RGB image based on the colors of the destination image. The better the destination image match with the source gray image the better the coloring will be. The program takes some time as the searching time is high. You can decrease the searching time by taking only samples from the used color image but quality may decrease. U can use jittered sampling for improving running speed. %
% You can use also use the attahed test images Use the following combinations for better result nature1.jpg(as img1) and nature2.jpg(as img2) or test1.jpg(as img1) and test2.jpg (as img2) %
% Usage: gray2rgb(‘nature1.jpg‘‘nature2.jpg‘); %
% Authors : Jeny Rajan Chandrashekar P.S %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% img1 - Source Image (gray image)
% img2 - Selected color image for coloring the gray image.
tic
clc;
warning off;
imt=imread(img1);
ims=imread(img2);
[sx sy sz]=size(imt);
[tx ty tz]=size(ims);
if sz~=1
imt=rgb2gray(imt);
end
if tz~=3
disp (‘img2 must be a color image (not indexed)‘);
else
imt(::2)=imt(::1);
imt(::3)=imt(::1);
% Converting to ycbcr color space
nspace1=rgb2ycbcr(ims);
nspace2= rgb2ycbcr(imt);
ms=double(nspace1(::1));
mt=double(nspace2(::1));
m1=max(max(ms));
m2=min(min(ms));
m3=max(max(mt));
m4=min(min(mt));
d1=m1-m2;
d2=m3-m4;
% Normalization
dx1=ms;
dx2=mt;
dx1=(dx1*255)/(255-d1);
dx2=(dx2*255)/(255-d2);
[mxmymz]=size(dx2);
%Luminance Comparison
disp(‘Please wait..................‘);
for i=1:mx
for j=1:my
iy=dx2(ij);
tmp=abs(dx1-iy);
ck=min(min(tmp));
[rc] = find(tmp==ck);
ck=isempty(r);
if (ck~=1)
nimage(ij2)=nspace1(r(1)c(1)2);
nimage(ij3)=nspace1(r(1)c(1)3);
nimage(ij1)=nspace2(ij1);
end
end
end
rslt=ycbcr2rgb(nimage)
figureimshow(uint8(imt));
figureimshow(uint8(rslt));
R=uint8(rslt);
toc
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2444 2019-07-09 16:41 gray2rgb.m
文件 718 2019-07-07 22:35 hsitorgb.m
文件 24274 2019-07-10 00:36 meiyan.fig
文件 19398 2019-07-15 14:55 meiyan.m
文件 879 2019-07-08 01:25 meiyan1.m
文件 647 2019-07-09 17:21 pinghua.m
文件 727 2019-07-10 00:31 qiuhe.m
文件 363 2019-07-05 00:39 rgbtohsi.m
文件 136312 2019-07-04 10:41 标准测试图.jpg
文件 43247 2019-07-04 10:42 标准测试图2.jpg
文件 20932 2019-07-04 11:01 痣1.jpg
文件 219465 2019-07-04 11:06 痣2.png
文件 246932 2019-07-04 10:53 皱纹1.jpeg
文件 49703 2019-07-04 10:55 皱纹2.jpg
文件 217346 2019-07-04 11:07 皱纹3.jpg
文件 91148 2019-07-04 10:51 粗糙1.jpeg
文件 10141 2019-07-04 11:10 粗糙2.jpg
文件 20760 2019-07-04 10:49 雀斑1.jpg
文件 23810 2019-07-04 11:09 雀斑2.jpg
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)