2

我试图弄清楚如何使用 Java 中的 OpenCV 来校正收据的给定图像的角度(用数码相机拍摄,所以它可能不够直)。该计划是(也许)改进 ABBYY FineReaders 自动文本识别结果。不幸的是,我没有在文档方面取得进展——它是针对 C++ 的,我真的遇到了麻烦......我不知道要使用哪些函数等等......有 OpenCV 经验的人可以给我一些关于如何进行的提示?帮助将不胜感激。

4

1 回答 1

0

在 opencv 中使用warpaffin函数非常容易。您只需要设置图像的旋转位置,然后创建旋转矩阵并使用上述函数将其应用于图像。这是如何制作的示例代码:

   cv::Point Rotation_anchor = cv::Point( Desired_X_Position, Desired_Y_Position );
   double angle = Angle_Val;
   double scale = 1;    
   /// Get the rotation matrix with the specifications above
   cv::Mat rotation_matrix = cv::getRotationMatrix2D( Rotation_anchor, angle, scale );   
   /// Rotate the warped image
   cv::warpAffine( Input_Image, Output_Image, rotation_matrix, Input_Image.size() );
于 2014-04-09T15:00:54.340 回答