Ask Your Question
0

Measurements

asked 2013-03-13 09:41:15 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Hello, I need to get the width and length of precious stones of various sizes equal to this image, and its colors, which method should I use? If anyone has any examples, preferably in java. Thanks!

image description

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-03-13 12:11:08 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

You can do a simple threshold of this image to get a binary image. Push that image through a blob analysis program (cvBlobsLib) and for each blob identified, get the bounding box dimensions. The only problem I see is with the two overlapping stones in top left corner. What I suggested works well in C++; not familiar with Java.

In order to add something to this post, blob detection can also be done by using Hough Circle Transform. This tutorial will help you implementing it.

http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html#hough-circle

Or the simple blob feature detector is also an option to use as mentioned above: http://docs.opencv.org/modules/features2d/doc/common_interfaces_of_feature_detectors.html?highlight=blob#SimpleBlobDetector%20:%20public%20FeatureDetector

edit flag offensive delete link more

Comments

Ok, very thanks! But the Hough Circle wouldn't work for the others formats, basically I have to use the blobDetection, but this is hard to find any example for java, because I'll analyze a real time video and I have to detect these stones and get your measurements.

DuFF MackBrother gravatar imageDuFF MackBrother ( 2013-03-13 12:58:52 -0600 )edit
2

If you want to work in C/C++, I'll suggest downloading cvBlobsLib and follow the tutorial. You should be able to take care of your problem from the tutorial itself.

unxnut gravatar imageunxnut ( 2013-03-13 13:17:15 -0600 )edit
0

answered 2013-03-13 15:12:59 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Found this information on the website of Sherman Emami (http://www.shervinemami.info/index.html), might help you out. It discusses many openCV applications, including blob detection. Check out his site for more, credit go completely to him, just did a google search on the topic.


Blob Detection Libraries:

There are 3 blob detection libraries for OpenCV with almost the same name, and they are all decent but not perfect, so you could look at them all and choose one:

If you look in the cvBlobsLib FAQ, it shows how to use the "cvThreshold()" to threshold an image easily and detect blobs and filter them.

Some comments about it on this forum thread. There is also the OpenCV function "cvFindContours()" that gives you the contour (outline) and blob area but not other statistics.

NOTE: If you don't just want to detect where blobs are but follow the blob movement (such as getting the velocity of many blobs moving around), then OpenCV comes with a sample program "blobtrack.cpp" that is for Blob Tracking.

How to use a Blob Detection Library in Your Code: If you don't know how to add cvBlobsLib or cvBlob to your project, then I will quickly explain. To use any C or C++ library (such as cvBlob or cvBlobsLib or even OpenCV) in your own project, you typically need to include the header files (.h) and link to the library file (.lib). If you don't have the .lib files then you need to compile that library (such as using CMake to compile cvBlob) to give you the correct .lib files. Then you need to add the header files to be "included" into your project, and the lib files to be "linked" into your project, using whatever steps are required for your compiler.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-13 09:41:15 -0600

Seen: 904 times

Last updated: Mar 13 '13