Measurements
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!
asked 2013-03-13 09:41:15 -0600
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!
answered 2013-03-13 12:11:08 -0600
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
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.
answered 2013-03-13 15:12:59 -0600
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.
"cvBlob": http://code.google.com/p/cvblob/ - There is a blob-detection example in the cvBlob FAQ.
"Bloblib" by Dave Grossman (also referred to as "Blob Analysis Package"): http://www.shervinemami.info/files/BlobAnalysisPackage_DG.zip.
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.
Asked: 2013-03-13 09:41:15 -0600
Seen: 1,005 times
Last updated: Mar 13 '13
What's the best way to segment different coloured blobs?
Should add color profile embedder in next version
Percentage of color in a frame of video
color blob detection and distinguishing
How to find the two most dominant colors in an image?
locate the circle in the image..