本文介绍了找到被黑色区域包围的图像的宽度:Matlab的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图像image1,它被黑色区域包围.

I have an image image1, it is surrounded by black region.

我想获取非黑色区域的宽度,即仅黑色区域内的图像.

I want to get width of the region which is not black i.e. the image inside the Black region only.

该怎么做?

推荐答案

如果它是全黑的,则可以计算至少包含一个非零元素的列数:

If it's completely black, you can just count the number of column which have at least one non-zero element:

sum(any(image1))

这篇关于找到被黑色区域包围的图像的宽度:Matlab的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 00:13