弧度: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));
}
}
}