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

原图

效果图

最新文章

  1. Zabbix监控nginx-rtmp status(json版)
  2. redhat自定义安装必选
  3. IndexedDB参考资料网址
  4. fallacies of distributed computing
  5. C#设计模式(9)——装饰者模式(Decorator Pattern)
  6. nyoj 68 三点顺序
  7. 有关ZxMiddleTier构想
  8. c/c++编译原理
  9. AppiumLibrary实用函数介绍
  10. javamail发送邮件(转)
  11. java整合flex
  12. openstack临时存储后端
  13. POJ 2255 Tree Recovery 二叉树恢复
  14. WPF 实现验证码功能
  15. ①【javascript设计到的技术点】
  16. Kali无法启动、无法安装
  17. Atomic in Redis
  18. 百度地图api在Html中显示,在jsp页面中不显示解决方法
  19. 记 Java 各版本新特性
  20. 彻底解决COM端口被占用(在使用中)问题的办法

热门文章

  1. RFS+AutoItLibrary测试Web对话框
  2. vim 查找与替换
  3. 使用OpenGL进行Mandelbrot集的可视化
  4. rtems 4.11 IRQ (arm,beagle)
  5. 下一代Apache Hadoop MapReduce框架的架构
  6. php解码“&amp;#”编码的中文用函数html_entity_decode()
  7. 史上最浅显易懂的Git教程2 github
  8. hdu2473 Junk-Mail Filter 并查集+删除节点+路径压缩
  9. JVM内存布局及GC知识回顾
  10. oracle 存储过程(1)