Actionscript 3:getColorBoundsRect
我有一个问题。我有一个带有 2 个红色圆圈的 BitmapData。我想找到矩形区域或每个圆。如果我使用 [B]getColorBoundsRect[/B] 我会得到 2 个圆圈包围的最小区域。
我怎样才能做到这一点并获得圆圈的单独面积? 下面是我为了更好地解释我的问题而创建的图表:
http://img831.imageshack.us/img831/3360/sampleja.png
以前有人问过这个问题,但不太明白 所提供的解决方案如何解决问题。 http://www.kirupa.com/forum/showthread。 php?324586-Question-to-getColorBoundsRect
希望这里有人能给我一些启发。谢谢一百万。
I have a question. I have a BitmapData with 2 red circles. I want to find the rectangle area or each circle. If i use [B]getColorBoundsRect[/B] I get the smallest area enclosed by the 2 circles.
How can i go about this and get individual area of the circles?
below is a diagram i created to better explain my question:
http://img831.imageshack.us/img831/3360/sampleja.png
previously this question was asked before but don't quite understand
how the provided solution solved the problem.
http://www.kirupa.com/forum/showthread.php?324586-Question-to-getColorBoundsRect
hope someone here can shed some light for me. Thanks a million.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一个非常巧妙的技巧可以做到这一点。首先,您需要确保位图数据中仅获得两种颜色(阈值即可解决问题)。之后,您可以将 getColorBounds 与 floodFill 查找图像中的所有斑点。伪代码将是这样的:
There's a very neat trick to do it. First you need to make sure you get only two colors in your BitmapData (threshold will do the trick). After that, you can use getColorBounds together with floodFill to find all blobs in the image. The pseudo-code would be something like this: