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