function K = curvature(f,diff_scheme)
% CURVATURE computes curvature
% Author: Chunming Li, all rights reserved.
% Email: li_chunming@hotmail.com
% URL: http://www.engr.uconn.edu/~cmli/
epsilon=1e-10;
if strcmp(diff_scheme, 'fcb')
[fx,fy]=gradient(f); % central difference
fx_f = Dx_forward(f); % forward difference
ax = fx_f./sqrt(fx_f.^2+ fy.^2+epsilon);
axx = Dx_backward(ax); % backward difference
fy_f = Dy_forward(f);
ay = fy_f./sqrt(fx.^2 + fy_f.^2 + epsilon);
ayy = Dy_backward(ay);
K = axx + ayy;
elseif strcmp(diff_scheme, 'fb') % forward difference followed by a backward difference
fx_f = Dx_forward(f);
fy_f = Dy_forward(f);
ax = fx_f./sqrt(fx_f.^2+ fy_f.^2+epsilon);
ay = fy_f./sqrt(fx_f.^2 + fy_f.^2 + epsilon);
axx = Dx_backward(ax);
ayy = Dy_backward(ay);
K = axx + ayy;
elseif strcmp(diff_scheme, 'bf') % forward difference followed by a backward difference
fx_f = Dx_backward(f);
fy_f = Dy_backward(f);
ax = fx_f./sqrt(fx_f.^2+ fy_f.^2+epsilon);
ay = fy_f./sqrt(fx_f.^2 + fy_f.^2 + epsilon);
axx = Dx_forward(ax);
ayy = Dy_forward(ay);
K = axx + ayy;
elseif strcmp(diff_scheme, 'cc') % central difference followed by a central difference
[fx, fy]= gradient(f); % central difference
ax = fx./sqrt(fx.^2+ fy.^2+epsilon);
ay = fy./sqrt(fx.^2 + fy.^2 + epsilon);
[axx, axy] = gradient(ax); % central difference
[ayx, ayy] = gradient(ay);
K = axx + ayy;
else
disp('Wrong difference scheme: CURVATURE.m');
return;
end
御道御小黑
- 粉丝: 77
- 资源: 1万+
最新资源
- Cisco Packet Tracer实用技巧及网络配置指南
- 国际象棋棋子检测8-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- jQuery信息提示插件
- 电动蝶阀远程自动化控制系统的构建与应用
- 基于python和协同过滤算法的电影推荐系统
- Hadoop复习资料题库.zip
- 国际象棋棋子检测3-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord数据集合集.rar
- Python毕业设计基于知识图谱的电影推荐系统源码(完整项目代码)
- 基于C++的简易图书管理系统(含exe可执行文件)
- 使用python爬取数据并采用Django搭建系统的前后台,使用Spark进行数据处理并进行电影推荐项目源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈