如何检测(并纠正)图像中的偏斜? [英] How can I detect (and correct) skew in images?
问题描述
我有大量的扫描图像,它们都有些偏斜,周围有白色区域。
I have a large collection of scanned images, and they are all somewhat skewed, with a white area around them.
因此,这些图像具有矩形的颜色,周围是大的白色区域。问题是这些颜色的矩形与图像边界不平行。
So, these images have rectangles of colors, surrounded by a large white area. The problem is that these rectangles of color are not parallel to the image border.
我确信必须有一种方法可以通过编程方式检测这些颜色的矩形,以便我可以旋转图像(因此不会偏斜它),然后裁剪它,以便只留下有趣的部分。我想我不确定这个过程是什么,所以我无法在Google上搜索解决方案。
I'm sure there must be a way to programmatically detect these rectangles of color, so that I can rotate the image (thus un-skewing it) and then crop it so that just the interesting part is left. I guess I'm not really sure what this process is called, so I am having trouble searching for a solution on Google.
有没有人知道会有什么方法可以获得我开始了?我应该研究哪些图书馆?或者有助于算法的名称?
Does anyone know of an approach that would get me started? Any libraries out there that I should look into? Or the name of an algorithm that would help?
我打算在这个项目中使用Java,但我还没有真正开始,所以我对图书馆持开放态度任何语言的建议。
I am planning on using Java for this project, but I haven't really started yet, so I am open to library suggestions in any language.
推荐答案
- 边界检测
- 霍夫变换(如果图像上的所有矩形具有相同的偏斜)
- 矩形轮廓检测(连通分量轮廓,然后最小区域边界矩形)
这篇关于如何检测(并纠正)图像中的偏斜?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!