%%%%  Skewing

clc;
clear all;
close all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); Image=imread('4.jpg'); Image=double(Image);
theta=pi/9; % 控制倾斜的角度
[row, col, layer]=size(Image); % % % % % Horizontal Skewing
% % row_new=row;
% % col_new=floor(row*tan(theta))+1+col;
% % Image_new=zeros(row_new, col_new,3);
% % Trans=(row-1)*tan(theta);
% % for i=1:row
% % Dis=(row-i)*tan(theta);
% % for j=1:col_new
% % y0=i;
% % % x0=j+Dis-Trans; %%%%% Left skew
% % x0=j-Dis; %%%%% Right skew
% % if(x0>1 && x0<col)
% % % Image_new(i,j)=0;
% % x1=floor(x0);
% % p=x0-x1;
% % Image_new(i,j,:)=(1-p)*Image(y0,x1,:)+p*Image(y0,x1+1,:);
% % end
% % end
% % end % % % % % Vertical Skewing
col_new=col;
row_new=floor(col*tan(theta))+1+row;
Image_new=zeros(row_new, col_new,3);
Trans=(col-1)*tan(theta);
for j=1:col_new
Dis=j*tan(theta);
for i=1:row_new
% y0=i+Dis-Trans; %%%%% Left skew
y0=i-Dis; %%%%% Right skew
x0=j;
if(y0>1 && y0<row)
% Image_new(i,j)=0;
y1=floor(y0);
p=y0-y1;
Image_new(i,j, : )=(1-p)*Image(y1,x0, : )+p*Image(y1+1,x0,:);
end
end
end imshow(Image_new/255);

原图

水平 skew  theta=pi/6

垂直 skew theta=pi/9

最新文章

  1. TCP ,UDP概念和TCP三次握手连接 的知识点总结
  2. 【Beta】Scrum03
  3. C# 会可能需要的扩展
  4. Activiti开启SQL Log
  5. 【WP 8.1开发】推送通知测试服务端程序
  6. AngularJS结合RequireJS做文件合并压缩的那些坑
  7. BZOJ 1014: [JSOI2008]火星人prefix
  8. Python函数中的参数(一)
  9. [codeforces 235]A. LCM Challenge
  10. Selenium中expected_conditions下text_to_be_present_in_element_value方法的使用
  11. C#UDP(接收和发送源码)源码完整
  12. SQL server 2008 建立新用户
  13. PDF合并
  14. 【python】由一个小例子看出python的灵活性,IF ELSE一例
  15. Hibernate项目里配置环境时,jar包配置不当会对测试结果产生影响。
  16. 【.Net Framework 体积大?】不安装.net framework 也能运行!?开篇叙述-1
  17. SpringMVC基础学习(一)&mdash;初识SpringMVC
  18. CSS3下的渐变文字效果实现
  19. PHP和mysql英文
  20. html 之 position 绝对定位与相对定位(待补充)

热门文章

  1. Unity3D核心技术详解
  2. github pages + Hexo + 域名绑定搭建个人博客
  3. 插件占坑,四大组件动态注册前奏(三) 系统BroadCast的注册发送流程
  4. java操作properties配置文件
  5. matlab中的sub2ind函数
  6. Dynamics CRM 修改数据导出到EXCEL的最大条数
  7. listview下拉刷新上拉加载扩展(一)
  8. Android的资源类型和存储方式简介-android学习之旅(五十二)
  9. Web Service进阶(四)WebService注解
  10. python 内存数据库与远程服务