1

I need to classify bolt, nut, and washer from the image,

but I don't know how to detect those objects from the image.

enter image description here

(This is the part of the image)

I copied every color (used java.awt.Color) value from the image to 2D array,

but I have no idea what I have to do with this.

If I want to classify them, program have to recognize which part is not a background at least.

Does java has library for this?

Konorika
  • 69
  • 2
  • 9
  • Neural net could be a topic you can research if you want to classify images. It does however require data called training sets to train it on. – Adam Nov 14 '17 at 15:36

3 Answers3

1

The way to do it in Java is use the OpenCV library which has a Java native interface. Please refer to the link below in order to learn how to use OpenCV and Java together:

http://opencv-java-tutorials.readthedocs.io/en/latest/

Of course know how to use Java and OpenCV is not enough to solve your needs. So, you should to learn about image processing topics as well. See this motivating presentation:

https://pt.slideshare.net/luigidr/introduction-to-open-cv-28728435

Be aware that you must be ready to learn lots of things as image segmentation, color spaces, structural analysis and so on. Have a fun!

Duloren
  • 2,395
  • 1
  • 25
  • 36
0

Have you try openCV. Here is the face detection exemple your problem is a bit similar. May be it will help

Novy
  • 1,436
  • 1
  • 14
  • 26
0

To see that there is an object in the image, you will want to determine where the edge of that object is. If you look at the image, you'll notice that there is a big difference in the color of the background compared to the color of the edge of each object.

You can have your program read in the color data, as you have done, and whenever it notices that the color has changed by a significant enough amount, the program will highlight this point. This would be done by applying a sobel filter to the color data.

Doing this should highlight the edges of the object. From here, you can try to analyze the size of the area enclosed or the features of these edges to determine the object that is highlighted.

Here is a link to a question asked about applying a sobel filter that has some good answers.

While libraries such as OpenCV do have sobel filtering and image detection, it does not take too much code to implement the sobel filter yourself. I believe it would be a more simple solution as well. Installing and learning OpenCV will likely take more time than just applying your own sobel filter.

Alex DeCamillo
  • 345
  • 4
  • 18