matlab实现油画浮雕伪色彩底片单线条效果程序ppt课件.ppt

上传人:牧羊曲112 文档编号:1376784 上传时间:2022-11-16 格式:PPT 页数:11 大小:824KB
返回 下载 相关 举报
matlab实现油画浮雕伪色彩底片单线条效果程序ppt课件.ppt_第1页
第1页 / 共11页
matlab实现油画浮雕伪色彩底片单线条效果程序ppt课件.ppt_第2页
第2页 / 共11页
matlab实现油画浮雕伪色彩底片单线条效果程序ppt课件.ppt_第3页
第3页 / 共11页
matlab实现油画浮雕伪色彩底片单线条效果程序ppt课件.ppt_第4页
第4页 / 共11页
matlab实现油画浮雕伪色彩底片单线条效果程序ppt课件.ppt_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《matlab实现油画浮雕伪色彩底片单线条效果程序ppt课件.ppt》由会员分享,可在线阅读,更多相关《matlab实现油画浮雕伪色彩底片单线条效果程序ppt课件.ppt(11页珍藏版)》请在三一办公上搜索。

1、,图像特殊效果处理程序,李志鹏 09自动化200992140116,此程序使用matlab制作,能对图像 进行浮雕、底片、伪色彩、油画、单线条等特殊效果的处理。 通过此程序可以进一步的掌握用matlab来处理有关图像的问题。 以下是各种效果的具体介绍。,浮雕效果%改为灰度图像f0=rgb2gray(handles.pic);%加入高斯噪声f1=imnoise (f0,speckle,0.01); %加入密度0.01的高斯乘性噪声f1=im2double(f1); %给定均值滤波窗口h3=1/9.*1 1 1; 1 1 1; 1 1 1 ;%采用H3对F2进行卷积滤波f4=conv2(f1,h3

2、,same);%进行sobel滤波h2=fspecial(sobel); g3=filter2(h2,f1,same); K=mat2gray(g3); figure(5),imshow(K);title(浮雕效果);,底片效果我们所见到各种色彩都是由红、绿、蓝 3种颜色按区别比例混合而成这就是我们所说 3基色它们颜色值(RGB值)是 0255 所以我们只需去图像上各个点RGB值然后用255减去这个值并将这个值重新赋值给各个点就会达到我们想要底片效果了。y=255-handles.pic; %转化为反色图像figure,imshow(y);title(底片效果); %显示反色图像,伪色彩效果所

3、谓伪色彩处理,就是将图像中的灰度级经由线性或非线性变换成不同的彩色。handles.pic=rgb2gray(handles.pic); 读入源图像M,N=size(handles.pic); 读取图像的大小for i=1:M; for j=1:N; if handles.pic(i,j)32 转化为蓝色 B(i,j,:,:,:)=0,0,1; elseif handles.pic(i,j)64 转化为绿色 B(i,j,:,:,:)=0,1,0; elseif handles.pic(i,j)96 转化为淡蓝色 B(i,j,:,:,:)=0.4,0.9,1; elseif handles.pi

4、c(i,j)128 转化为紫色 B(i,j,:,:,:)=1,0,1; elseif handles.pic(i,j)160 转化为红色,B(i,j,:,:,:)=1,0,0; elseif handles.pic(i,j)192 转化为橙色 B(i,j,:,:,:)=1,0.8,0; elseif handles.pic(i,j)224 转化为黄色 B(i,j,:,:,:)=1,1,0; elseif handles.pic(i,j)255 转化为淡黄色 B(i,j,:,:,:)=1,0.8,0; end endendfigure,imshow(B);title(伪色彩效果);,油画效果fu

5、nction I_painted=OilPaint(I_rgb, radius, intensity_level)filename pathname=uigetfile(*.jpg;*.bmp;*.*,读入文件);pathfile=pathname filename;handles.pic=imread(pathfile);intensity_level = 180;radius = 5;s1=size(handles.pic);width=s1(1);height=s1(2);I_painted=uint8(zeros(width,height);I=rgb2gray(handles.pic

6、);% down-sampling the intensity imageI= floor(I* (intensity_level/255); ticfor x = 1:width for y = 1:height,clear intensity_counter R G B max_instance index intensity_counter=uint8(zeros(1,intensity_level+1); R=uint8(zeros(1,intensity_level+1); G=uint8(zeros(1,intensity_level+1); B=uint8(zeros(1,int

7、ensity_level+1); for i = (x-radius):(x+radius) for j = (y-radius):(y+radius) if i0 end end end,% finding the maximum occuring intensity in downsampled image max_instance index = max(intensity_counter); I_painted(x, y, 1)= R(index); I_painted(x, y, 2)= G(index); I_painted(x, y, 3)= B(index); endendtocfigureimshow(I_painted,);title(油画效果);,单线条效果handles.pic=rgb2gray(handles.pic);bw=edge(handles.pic,canny);%数字图像轮廓提取se = strel(line,3,0);%创建直线长度3角度为0形态学元素bwd=imdilate(bw,se);%对图像实施膨胀操作figure,imshow(bwd);title(单线条效果);,谢谢观看,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号