我正在为有身体限制的儿童制作一本简单的着色书。 教师将能够在仅由封闭区域组成的程序中插入图片。 然后我需要分析图像并找到所有封闭区域(孩子能够着色的地方)。 我需要这样做,因为所有可以涂漆的区域会一个接一个地发光。 我想我可以通过填充来实现这一点,所以我需要在每个封闭区域内有一个点(X,Y坐标)。
I am working on a simple coloring book for children with physical limitations. Teachers will be able to insert a picture in the program composed of only closed areas. I then need to analyze the image and find all closed areas (the places the child will be able to color). I need to do this because all areas that can be painted will glow up one after the other. I think I can accomplish this with a floodfill so I need a point (X,Y coordinate) inside every closed area.
任何人都做过这样的事情? 一些提示或源代码可用吗?
Anyone ever did something like this? Some tips or source code available?
非常感谢!
推荐答案我对WPF本身没有多少经验,但我可能会使用这样的算法:
I don't have much experience with WPF per se, but I would probably use an algorithm like this:
首先,我假设图像是严格的单色。也就是说,只有纯黑色(线条)和纯白色(可着色区域)像素。
First, I am assuming the image is strictly monochrome. That is, there are only pure black (line) and pure white (colourable area) pixels.
现在,图像中的每个区域都有不同的颜色。
Now, every area in the image has a different colour.
更多推荐
WPF:查找图像中的所有封闭区域(C#甚至VB)
发布评论