背景:需要在image中提取圆孔圆心的位置,用到opencv中的hugh检测的方法,提取的效果还不错。但是只是初步的版本,没有增加更多的鲁棒性判断。
#include
#include
#include
#include
int main(int argc, char** argv)
{
// read a image
std::string file_name = "/home/liuzhiyang/image.png";
cv::Mat input_image = cv::imread(file_name, cv::IMREAD_COLOR);
if (input_image.empty())
{
std::cout << "Error to open image file !" << std::endl;
return 0;
}
// cv::imshow("origin image", input_image);
// undistort image
cv::Mat undistort_image;
float fx = 1.0757955405501191e+03, fy = 1.0762345733674481e+03;
float cx = 9.6249394948422218e+02, cy = 6.1957628038839391e+02;
float k1 = -1.1995613777994101e-01, k2 = 8.6245969435724004e-02,