根据角度或者弧度将坐标点投影

弧度:theta = angle * 3.1415926 / 180;

//对梯度图像遍历,得到每一个像素点对应的梯度幅角
double theta = angle * 3.1415926 / 180; //得到弧度
std::vector<Point2d> pos(2);
pos[0] = Point2d(cos(-theta),sin(-theta));
pos[1] = Point2d(-sin(-theta),cos(-theta));
//遍历梯度图像,将灰度值在某一阈值的点筛选,然后投影
std::vector<Point> points;
for(int y = 0; y < srcImage.cols; ++y){
	for(int x = 0; x < srcImage.rows; ++x){
		int pixel = srcImage.at<uchar>(y,x);
		int angle = Theta.at<int>(y,x);
		if (pixel <= 255 && pixel >= 200){
			//px,py分别为投影后坐标
			int px = y * pos[0].y + x * pos[0].x;
			int py = y * pos[1].y + x * pos[1].x;
			points.push_back(Point(py,px));
		}
	}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值