clc;
clear all;
close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread('4.jpg');
I=double(I);
Image=I/255; xScale = 20;
yScale = 20;
amount = 1;
turbulence =0.25; Image_new=Image; [height, width, depth]=size(Image); Index=1:256;
sin_T=-yScale*sin(2*pi*(Index-1)/256*turbulence);
cos_T=xScale*cos(2*pi*(Index-1)/256*turbulence); [ind, g1, g2, g3]=init_arr(); for ii=1:height % % [ind, g1, g2, g3]=init_arr(); for jj=1:width dis=min(max( floor(127*(1+Noise2(jj/xScale, ii/yScale, ind, g2))), 1), 256); x=jj+sin_T(dis);
y=ii+cos_T(dis); % % if (x<=1) x=1; end
% % if (x>=width) x=width-1; end;
% % if (y>=height) y=height-1; end;
% % if (y<1) y=1; end;
% % if (x<=1) continue; end
if (x>=width) continue; end;
if (y>=height) continue; end;
if (y<1) continue; end; x1=floor(x);
y1=floor(y);
p=x-x1;
q=y-y1; Image_new(ii,jj,:)=(1-p)*(1-q)*Image(y1,x1,:)+p*(1-q)*Image(y1,x1+1,:)...
+q*(1-p)*Image(y1+1,x1,:)+p*q*Image(y1+1,x1+1,:);
end
end imshow(Image_new)
imwrite(Image_new, 'out.jpg');

参考来源:http://www.jhlabs.com/index.html

原图:

效果图:

PS 滤镜— —Marble 效果的更多相关文章

  1. Python: PS 滤镜--万花筒效果

    本文用 Python 实现 PS 的一种滤镜效果,称为万花筒.也是对图像做各种扭曲变换,最后图像呈现的效果就像从万花筒中看到的一样: 图像的效果可以参考之前的博客: http://blog.csdn. ...

  2. PS 滤镜— —挤压效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  3. PS 滤镜— — 万花筒效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  4. PS 滤镜— —水波效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  5. PS 滤镜— — sparkle 效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  6. PS 滤镜— —球面化效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  7. PS滤镜— —波浪效果

    clc; clear all; close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread ...

  8. OpenCV——PS滤镜 水波效果

    // define head function #ifndef PS_ALGORITHM_H_INCLUDED #define PS_ALGORITHM_H_INCLUDED #include < ...

  9. Python: PS 滤镜特效 -- Marble Filter

    本文用 Python 实现 PS 滤镜特效,Marble Filter, 这种滤镜使图像产生不规则的扭曲,看起来像某种玻璃条纹, 具体的代码如下: import numpy as np import ...

随机推荐

  1. php序列化与反序列化

    php序列化简单来说就是 把复杂的数据类型压缩到一个字符串中php对象转换成字符串,反序列化就是把变量转换成对象 一般来说  当把这些序列化的数据放在URL中在页面之间会传递时,需要对这些数据调用ur ...

  2. android中实现毛笔效果(View 中画图)

    近期有一个项目设计一个APP实现通过触摸屏实现毛笔写字效果.传统的绘画板程序直接通过Path的moveTo和LineTo便可实现简单的线条绘画程序.然而要达到毛笔的笔锋效果则须要更为具体点的设计.我的 ...

  3. Android使用JUnit进行单元测试

    前言:为什么要进行单元测试?单元测试能快速是开发者,找到代码中的问题所在,因为是单元测试,所以代码只执行响应的测试单元,执行快解决问题的效率高,同时提高代码的质量. Android中的单元测试可简单分 ...

  4. solr原理

    1.solr原理: 我本人的理解:solr是为解决高性能的全文索引而出现的,它将用户输入的关键字进行智能分解,分解成一个个词,过滤掉一些多余的停词及空格等,比如,“在”.“里面”.“也”.“的”.“它 ...

  5. 关于ES6的let,const与var之间的三生三世

    首先需要明确的是let.const.var都是用来定义变量的 在ES6之前,我们一般都用var来定义变量,例如 : function test(){ var i=1; console.log(i); ...

  6. 【转】AC神组合数取模大全

    貌似少了几张图片,不过没有图片也没什么关系的感觉. 最后的究极篇也想出来了,但是貌似找不到题目,好尴尬.. 这个表示的是从n个元素中选取m个元素的方案数. (PS.组合数求模似乎只用在信息学竞赛和 A ...

  7. UIApplicationDelegate 各方法回调时机

    本篇文章主要介绍一些UIApplicationDelegate中几个常用的回调方法的调用时机.以帮助你判断哪些方法倒底放到哪个回调中去实现. 1. – (void)applicationDidFini ...

  8. effect request

    from bs4 import BeautifulSoup import os filepath = 'D:\\pymine\\clean\\spider_map\\baidu_map_html_fi ...

  9. Python锁

    # coding:utf-8 import threading import time def test_xc(): f = open("test.txt","a&quo ...

  10. linux c编程:系统数据文件和信息

    linux系统相关的文件信息包含在/etc/passwd文件和/etc/group中.每次登录linux系统以及每次执行ls -l命令时都要使用口令文件.这些字段都包含在<pwd.h>中定 ...