解读图像的水平和垂直总结 [英] Interpretation of Horizontal and Vertical Summations of an Image

查看:262
本文介绍了解读图像的水平和垂直总结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个二进制文件,在图像的不同部分有一些文字,如底部,顶部,中间,右中间等等。



原始图片





我计算了图像的水平和垂直总和并绘制了它们:

  plot(sum(edgedImage1) ,1))

  plot(sum(edgedImage1,2))



有人可以向我解释这些情节告诉我的内容关于原始图像的结构我上面解释过?
此外,这些图怎么能帮我提取那些我只是手工绘制红色的区域?

解决方案

没有什么比这更复杂了关于总和操作。简单地说, sum(edgedImage1,1)计算图像中每列的所有行的总和,这就是您正在绘制的内容。实际上,您计算每列所有行的所有非零值(即白色像素)的总和。图中的水平轴表示您正在观察的行的总和。类似地, sum(edgedImage,2)计算图像每一行的所有列的总和,这就是您正在绘制的内容。



因为你的文字以横向方式显示,所以 sum(edgeImage,1)不会特别有用。非常有用的是 sum(edgedImage,2)操作。对于图像中空白的行,图像每行的水平列总和应该是非常小的值,而对于图像中包含文本或笔划的行,总和应该非常大。我所谈论的一个很好的例子就是你的形象的底部。如果在第600行和第700行之间进行协商,则会看到绘图中出现巨大的峰值,因为这些行之间存在大量文本。



使用此结果,确定图像中包含文本或笔划的区域的粗略方法是查找超过某个阈值的所有行。结合从刚执行的求和操作中查找模式或峰值,您可以非常轻松地定位和分离每个文本区域。



如果您决定确定多少,您可能希望平滑 sum(edgedImage,2)提供的曲线有文字的blob。平滑此信号后,您将清楚地看到有5种模式对应5行文字。


I have a binary which has some text on different parts of the image like at the bottom, top, center, right middle center, etc.

Original Image

The areas I would like to focus on are the manually drawn regions shown in red.

I calculated the horizontal and vertical summations of the image and plotted them:

plot(sum(edgedImage1,1))

plot(sum(edgedImage1,2))

Can somebody give me explanation of what these plots are telling me about the original image with regards to the structure of which I explained above? Moreover, how could these plots help me extracting those regions I just manually drew in red?

解决方案

There's nothing sophisticated about the sum operation. Simply put, sum(edgedImage1,1) computes the sum of all rows for each column in the image and that is what you are plotting. Effectively, you are computing the sum of all non-zero values (i.e. white pixels) over all rows for each column. The horizontal axis in the plot denotes what row's sum you are observing. Similarly, sum(edgedImage,2) computes the sum of all columns for each row of the image and that is what you are plotting.

Because your text is displayed in a horizontal fashion, sum(edgeImage,1) won't be particularly useful. What is very useful is the sum(edgedImage,2) operation. For lines in your image that are blank, the horizontal sum of columns for each row of your image should be a very small value whereas for lines in your image that contain text or strokes, the sum should be quite large. A good example of what I'm talking about is seen towards the bottom of your image. If you consult between rows 600 and 700, you see a huge spike in your plot as there is a lot of text that is surrounded between those rows.

Using this result, a crude way to determine what areas in your image that contain text or strokes in your case would be to find all rows that surpass some threshold. Combined with finding modes or peaks from the sum operation that was just performed, you can very easily localize and separate out each region of text.

You may want to smooth the curve provided by sum(edgedImage,2) if you decide to determine how many blobs of text there are. Once you smooth out this signal, you will clearly see that there are 5 modes corresponding to 5 lines of text.

这篇关于解读图像的水平和垂直总结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆