clc;
clear all;
close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); I=imread('4.jpg');
I=double(I);
Image=I/255; [height, width, depth]=size(Image); % set the parameters
radius = 150; % control the radius of the inner circle
high = 200; % control the distance between the inner circle and outer circle
angle = 0;
spreadAngle=pi;
centerX = 0.5; % set the center of the circle, proportion of the image size
centerY = 1.0; icenterX=width*centerX;
icenterY=height*centerY; Image_new=Image*0; for i=1:height
for j=1:width dx=j-icenterX;
dy=i-icenterY; theta=atan2(-dy, -dx)+angle;
r=sqrt(dy*dy+dx*dx); theta=mod(theta, 2*pi); x=width * theta/(spreadAngle+0.00001);
y=height * (1-(r-radius)/(high+0.00001)); % % 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(i,j,:)=(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 滤镜— —扇形warp的更多相关文章

  1. Python: PS 滤镜--扇形变换

    本文用 Python 实现 PS 滤镜中的一种几何变换特效,称为扇形变换,将图像扭曲成一个扇形,具体的算法原理和效果图可以参考以前的博客: http://blog.csdn.net/matrix_sp ...

  2. OpenCV——PS 滤镜, 浮雕效果

    具体的算法原理可以参考: PS 滤镜, 浮雕效果 // define head function #ifndef PS_ALGORITHM_H_INCLUDED #define PS_ALGORITH ...

  3. OpenCV——PS 滤镜, 曝光过度

    算法原理可以参考: PS 滤镜,曝光过度 #ifndef PS_ALGORITHM_H_INCLUDED #define PS_ALGORITHM_H_INCLUDED #include <io ...

  4. Python: PS 滤镜--水波特效

    本文用 Python 实现 PS 滤镜中的 水波特效 import numpy as np from skimage import img_as_float import matplotlib.pyp ...

  5. Python: PS 滤镜--旋涡特效

    本文用Python 实现 PS 滤镜的旋涡特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/42215 ...

  6. Python: PS 滤镜--USM 锐化

    本文用 Python 实现 PS 滤镜中的 USM 锐化效果,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/detail ...

  7. Python: PS 滤镜--素描

    本文用 Python 实现 PS 滤镜中的素描特效,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/386 ...

  8. Python: PS 滤镜--表面模糊

    本文用 Python 实现 PS 滤镜中的表面模糊,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/528 ...

  9. Python: PS 滤镜--旋转模糊

    本文用 Python 实现 PS 滤镜中的旋转模糊,具体的算法原理和效果可以参考之前的博客: http://blog.csdn.net/matrix_space/article/details/392 ...

随机推荐

  1. Java 实现对Sql语句解析

    原文地址:http://www.cnblogs.com/zcftech/archive/2013/06/10/3131286.html 最近要实现一个简易的数据库系统,除了要考虑如何高效的存储和访问数 ...

  2. 使用java+TestNG进行接口回归测试

    TestNG是一个开源自动化测试框架,“NG”表示下一代(Next Generation的首字母). TestNG类似于JUnit(特别是JUnit 4),但它不是JUnit框架的扩展,相较于Juni ...

  3. CPI

    CPI (Consumer Price Index 物价指数) 是政府用来衡量通货膨胀的其中一个数据.通俗的讲,CPI就是市场上的货物价格增长百分比.一般市场经济国家认为CPI在2-3%属于可接受范围 ...

  4. C - The C Answer (2nd Edition) - Exercise 1-1

    /* Run the "hello, world" program on your system. Experiment with leaving out parts of the ...

  5. java timer 指定某时间点执行

    package com.northeasttycoon.service; import java.util.Calendar;import java.util.Timer;import java.ut ...

  6. 再看GS线程

    再看GS线程 void GameServer::ProcessThreadTry() { ; packet rcvPkt; rcvPkt.data = * ]; //该事件工厂主要创建了两个定时器1. ...

  7. 源码编译mysql 5.5+ 安装过程全记录

    前言:从mysql 5.5版本开始,mysql源码安装开始使用cmake了,编译安装跟以前的版本有点不一样了. 一,安装步骤: 1.安装前准备工作 a.下载mysql源代码包,到mysql下载页面选择 ...

  8. python中装饰器你真的理解吗?

    def w1(func): print('装饰器1....') def w1_in(): print('w1_in.....') func() return w1_in def w2(func): p ...

  9. cakephp 基本的环境

    这里是在 window下的环境搭建,我假设php,apache,mysql,的基本环境都ok,如果没有的话,偷个懒,用集成环境吧,我用的wampserver.1:去官网(http://cakephp. ...

  10. serve-index用法、实现原理(源码解读)

    本文主要讲解serve-index的用法和实现原理(源代码分析). 一 说明 serve-index的功能是将文件夹中文件列表显示到浏览器中. serve-index是一个NodeJS模块,可以通过N ...