获取形状中的所有像素
我在图像中有 4 个形状,
我想在点列表中获取一个形状的像素,
这些形状具有相同的颜色
List<point> GetAllPixelInShape(point x)
{
//imp
}
,其中该形状的 x 点
i have 4 shapes in image
i want to get pixels of one shape in list of point
the shapes have same color
List<point> GetAllPixelInShape(point x)
{
//imp
}
where x point of this shape
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
长话短说,您可以从连接的组件/区域标记算法开始。
在 OpenCV 中,
您可以调用 findContours() 来识别轮廓,即连接区域的边界。
http://dasl.mem.drexel.edu/~noahKuntz/openCVTut7.html
OCR 是一项极其困难的任务,尤其是对于像阿拉伯语这样的文字。从头开始创建 OCR 算法需要大量工作和多种算法的协同工作。机器打印文本的 OCR 已经够难的了。在您拥有一两年的图像处理经验之前,我不建议您尝试实现读取笔迹的算法。如果您还没有阅读过有关 OCR 的教科书和学术论文,您可能会花费大量时间重复已经完成的工作。
如果您不熟悉轮廓追踪和/或斑点分析,那么使用 OpenCV 可能不是一个好的第一步。由于您心中有一个特定的目标,您可能首先在用户友好的 GUI 中尝试不同的算法,这将节省您的编码时间。
考虑下载 ImageJ,以便您可以了解算法的工作原理。有各种常见图像处理算法的插件。
http://rsbweb.nih.gov/ij/
Long story short, you could begin with a connected components / region labeling algorithm.
http://en.wikipedia.org/wiki/Connected-component_labeling
In OpenCV you can call findContours() to identify contours, which are the borders of your connected regions.
http://dasl.mem.drexel.edu/~noahKuntz/openCVTut7.html
OCR is an extremely difficult task, especially for a script like Arabic. Creating an OCR algorithm from scratch takes a lot of work and numerous algorithms working together. OCR for machine printed text is hard enough. Implementing an algorithm to read handwriting is not something I'd suggest trying until you have a year or two of image processing experience. If you haven't read textbooks and academic papers on OCR, you're likely to spend a lot of time reproducing work that has already been done.
If you're not familiar with contour tracing and/or blob analysis, then working with OpenCV may not be a good first step. Since you have a specific goal in mind, you might first try different algorithms in a user-friendly GUI that will save you coding time.
Consider downloading ImageJ so that you can see how the algorithms work. There are plugins for a variety of common image processing algorithms.
http://rsbweb.nih.gov/ij/
您提出的方法签名没有提供足够的信息来解决此问题。您的方法需要知道形状的边界、长度和宽度等,理想情况下是一组指示这些边界的点。
一旦有了这些,您就可以应用 这篇文章,特别是答案中指定的算法来解决您的问题。
Your proposed method signature doesn't provide enough information to solve this. Your method will need to know the bounds of your shape, how long and wide it is etc, ideally a set of points that indicate those bounds.
Once you have those, you could potentially apply the details of this article, in particular the algorithms specified in the answer to solve your problem.