圆柱坐标系插图。线积分
来源:互联网 发布:xlsb文件怎么打开 mac 编辑:程序博客网 时间:2024/06/09 17:37
// shear.cpp : Defines the entry point for the console application.
//
#include <cv.h>
#include <highgui.h>
int casting(int x0, int r){ // x0 -r,r
float bk = (float)r*(asin((float)x0/(float)r)) + 3.14 / 2.0 * (float)r;
return (int)bk;
}
int casting1(int d, int r){
float bk = (float)r*sin((float)d/(float)r - 3.14 / 2.0) + (float)r;
return (int)bk;
}
// 圆内线积分可以求原图中横坐标
int casting2(float angle, float r, float widths, int x0){
angle = 2 * 3.14 * (angle / 360);
float x_fin,x_start;
x_fin = r * cos(angle - widths / 3.14 / r * (3.14/2));
x_start = r * cos(angle + widths / 3.14 / r * (3.14/2));
if (angle + widths / 3.14 / r * (3.14/2)<=3.14){
return r*asin((float)x0/r) - r*asin((float)x_start/r);
}
else if (angle - widths / 3.14 / r * (3.14/2)<=3.14){
float befval = r*asin((float)x_start/r) - r*asin(-1.0);
//printf("/nbef=%f/n",befval);
return r*asin((float)x0/r) - r*asin(-1.0) + befval;
}
else {
return r*asin((float)x_fin/r) - r*asin((float)x0/r);
}
}
int main()
{
int a;
int w = casting2(180,5,3.14*5,0);
printf("%d",w);
int theta;
for (theta = 0;theta <=180;theta+=10) {
IplImage* src = cvLoadImage("c://fruit.bmp");
int r = src->width;
IplImage* dst = cvCreateImage(cvSize(2*r, src->height),src->depth,src->nChannels);
for (int i=0;i<dst->width;i++) for (int j=0;j<dst->height;j++) for (int z=0;z<dst->nChannels;z++)
dst->imageData[j*dst->widthStep+i*dst->nChannels+z] = 255;
for (int i= - (dst->width/2);i< dst->width/2 ;i++) {
//int wth = casting(i ,dst->width);
int wth = casting2(theta,r,src->width,i);
printf("%d ",wth);
for (int j=0;j<dst->height;j++) for (int z=0;z<dst->nChannels;z++){
//if (wth<0) wth = -wth;
if (wth<src->width&&wth>=0) dst->imageData[j*dst->widthStep+(i+dst->width/2)*dst->nChannels+z] = src->imageData[j*src->widthStep+wth*src->nChannels+z];
}
}
printf("theta:%d",theta);
cvNamedWindow("ab");
cvShowImage("ab",dst);
cvWaitKey(0);
}
return 0;
}
- 圆柱坐标系插图。线积分
- 插图
- 圆柱
- 拉普拉斯算子从笛卡尔坐标系到圆柱坐标系下的推导过程
- 关于插图
- 插图类
- LaTeX:插图
- Latex 插图
- ctex 插图
- [LaTex]插图
- latex插图
- 博客插图
- 坐标系
- 坐标系
- 坐标系
- 坐标系
- 坐标系
- 坐标系
- 网络安装linux
- 图灵2011.01书讯
- Excel VBA工程密码破解程序
- IE里加入FireBug
- iPad菜单日渐走热美国
- 圆柱坐标系插图。线积分
- 苹果市值超中国石油 排名全球第二
- zimbra 垃圾邮件过滤
- [转]从随机播放算法看 iPod 的细节之美
- Step by Step-构建自己的ORM系列-开篇
- 关于Shell 脚本中的"[: too many arguments"错误
- 数据库设计经验谈
- Step by Step-构建自己的ORM系列-数据访问层
- Step by Step-构建自己的ORM系列-配置管理层