java 计算图像中的对象数量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2952165/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Count the number of objects in an Image
提问by unj2
I am investigating the possibility of image processing to identify certain objects and also count them in an image.
我正在研究图像处理以识别某些对象并在图像中计算它们的可能性。
I will be given a picture and I need to identify the number of boxes present in that image.
我将得到一张图片,我需要确定该图片中存在的框数。
Does anybody have any experience with any Machine Vision/ Image Processing libraries like ImageJ, Fiji, JAI, jMagick ,Java Vision Toolkit? Which do you think is best suited for the job? What do you guys suggest? If the APIs can be used from Java, it would be better. Thank you.
有没有人对任何机器视觉/图像处理库(如 ImageJ、Fiji、JAI、jMagick、Java Vision Toolkit)有任何经验?你认为哪个最适合这份工作?你们有什么建议?如果 API 可以从 Java 中使用,那就更好了。谢谢你。
Edit: I am dealing with warehouse brown boxes. Yes I am talking about regular photos. The source is usually a mobile phone picture.
编辑:我正在处理仓库棕色盒子。是的,我说的是普通照片。来源通常是手机图片。
Edit2: I am sorry the answer got autoselected. : (
编辑 2:我很抱歉自动选择了答案。:(
回答by Tansir1
I have never used the libraries you listed but I have used OpenCV.
我从未使用过您列出的库,但我使用过 OpenCV。
OpenCV is a well supported and proven computer vision library. It has built in features to count the number of primitive shapes in an image. It is written in C++ but you could create a small wrapper to be invoked via JNI.
OpenCV 是一个支持良好且经过验证的计算机视觉库。它内置了计算图像中原始形状数量的功能。它是用 C++ 编写的,但您可以创建一个小包装器以通过 JNI 调用。
RoboRealm is another proven computer vision system used by robotic hobbyists. It is a closed source commercial product that uses a socket based control API.
RoboRealm 是机器人爱好者使用的另一个经过验证的计算机视觉系统。它是一种使用基于套接字的控制 API 的闭源商业产品。
http://opencv.willowgarage.com/wiki/FullOpenCVWiki
http://opencv.willowgarage.com/wiki/FullOpenCVWiki
回答by George Profenza
If you must stick to Java, you can still use OpenCV.
如果你必须坚持使用 Java,你仍然可以使用OpenCV。
- If it's just boxes you can use Hough Transformsto detect them.
- You can use OpenSURFto detect phones based on source images you feed to it.
- Don't think this would be feasible in your case: HAAR Cascades. You could create a custom HAAR clasifier, but the training process can be quite time consuming.
- 如果它只是盒子,您可以使用霍夫变换来检测它们。
- 您可以使用OpenSURF根据提供给它的源图像检测手机。
- 不要认为这在您的情况下是可行的:HAAR Cascades。您可以创建自定义 HAAR 分类器,但训练过程可能非常耗时。
HTH, George
HTH,乔治
回答by Adrian Grigore
If you are not talking about real time image processing, you could write an API to Amazon Mechanical Turk.
如果您不是在谈论实时图像处理,您可以为Amazon Mechanical Turk编写 API 。
回答by mdma
In Java, there are several projects that extend the Java Advanced Imaging API to provide computer vision:
在 Java 中,有几个项目扩展了 Java Advanced Imaging API 以提供计算机视觉:
- JavaVis
- image processing in java + IPJ - computer vision extensions for JAI
- Java Vision Toolkit- JVT (EDIT: opps, this is mentioned in the question.)
- 可视化
- java + IPJ 中的图像处理 - JAI 的计算机视觉扩展
- Java Vision Toolkit- JVT(编辑:opps,问题中提到了这一点。)
There is a paperfor JavaVis which introduces the library, compares and constrasts with these other two libraries mentioned.
JavaVis有一篇论文介绍了该库,并与提到的其他两个库进行了比较和对比。
JavaVis has these features:
JavaVis 有以下特点:
- handles 2D and 3D images (3D being most relevant in this case)
- Has a GUI for inspecting potential results
- Matlab image export
- 处理 2D 和 3D 图像(在这种情况下 3D 最相关)
- 具有用于检查潜在结果的 GUI
- Matlab 图像导出
Also for java is NeatVision. Unlike the others, documentation is clearly visible for this project.
同样适用于 Java 的是NeatVision。与其他项目不同,该项目的文档清晰可见。
None of these projects are going to give you a simple turnkey solution. You will need to understand how computer vision works, and create a sequence of processing steps on the photos to help get the best results from the vision algorithms. To that end, JavaVis maybe most useful, since it is aimed towards teaching computer vision.
这些项目都不会为您提供简单的交钥匙解决方案。您需要了解计算机视觉的工作原理,并在照片上创建一系列处理步骤,以帮助从视觉算法中获得最佳结果。为此,JavaVis 可能最有用,因为它旨在教授计算机视觉。
回答by Ivan
Are you willing to develop your own code for that? There are several techniques that can be applied and tuned to your specific problem, but I never used a packaged library, always developed my own code. I can provide references for that if you're interested.
你愿意为此开发自己的代码吗?有几种技术可以应用于和调整您的特定问题,但我从未使用过打包库,总是开发自己的代码。如果你有兴趣,我可以提供参考。

