Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible. Assuming that you have already segmented the image properly, you can fit a bounding rect to the analysed object and get its heght and width, which will be similar to the dimensions you have marked.

Another possibility is to find a pair of points in the segmented contour - one that has the least x coordinate and the other that has the highest x coordinate. Distance between these points if one of the dimensions you seek. Do the same for y coordinate and compare the distances to determine which is height and which is width.

Of course these two methods won't give you the exact results, but it seems to me that in this case it's not clear what an exact result is (I would say the width could be drawn in several other ways in this image unless I don't know something about the methodology) and every measurement is only an approximation and we are looking the one that is acceptable.

Yes, it is possible. Assuming that you have already segmented the image properly, you can fit a bounding rect to the analysed object and get its heght and width, which will be similar to the dimensions you have marked.marked. This docs will get you started:

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html

Another possibility is to find a pair of points in the segmented contour - one that has the least x coordinate and the other that has the highest x coordinate. Distance between these points if one of the dimensions you seek. Do the same for y coordinate and compare the distances to determine which is height and which is width.

Of course these two methods won't give you the exact results, but it seems to me that in this case it's not clear what an exact result is (I would say the width could be drawn in several other ways in this image unless I don't know something about the methodology) and every measurement is only an approximation and we are looking the one that is acceptable.

Yes, it is possible. Assuming that you have already segmented the image properly, you can fit a bounding rect to the analysed object and get its heght and width, which will be similar to the dimensions you have marked. This docs will get you started:

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html

Another possibility is to find a pair of points in the segmented contour - one that has the least x coordinate and the other that has the highest x coordinate. Distance between these points if one of the dimensions you seek. Do the same for y coordinate and compare the distances to determine which is height and which is width.

Of course these two methods won't give you the exact results, but it seems to me that in this case it's not clear what an exact result is (I would say the width could be drawn in several other ways in this image unless I don't know something about the methodology) and every measurement is only an approximation and we are looking the one that is acceptable.

Yes, it is possible. Assuming that you have already segmented the image properly, you can fit a bounding rect to the analysed object and get its heght and width, which will be similar to the dimensions you have marked. This docs will get you started:

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html

Another possibility is to find a pair of points in the segmented contour - one that has the least x coordinate and the other that has the highest x coordinate. Distance between these points if one of the dimensions you seek. Do the same for y coordinate and compare the distances to determine which is height and which is width.

Of course these two methods won't give you the exact results, but it seems to me that in this case it's not clear what an exact result is (I would say the width could be drawn in several other ways in this image unless I don't know something about the methodology) and every measurement is only an approximation and we are looking for the one that is acceptable.

Yes, it is possible. Assuming that you have already segmented the image properly, you can fit a bounding rect to the analysed object and get its heght and width, which will be similar to the dimensions you have marked. This docs will get you started:

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html

Another possibility is to find a pair of points in the segmented contour - one that has the least x coordinate and the other that has the highest x coordinate. Distance between these points if one of the dimensions you seek. Do the same for y coordinate and compare the distances to determine which is height and which is width.

You may also try fitting an ellipse to the segmented contour if all the objects are of a shape that is more or less oval. This may give better results:

http://docs.opencv.org/2.4/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=fitellipse#fitellipse

Of course these two methods won't give you the exact results, but it seems to me that in this case it's not clear what an exact result is (I would say the width could be drawn in several other ways in this image unless I don't know something about the methodology) and every measurement is only an approximation and we are looking for the one that is acceptable.

Yes, it is possible. Assuming that you have already segmented the image properly, you can fit a bounding rect to the analysed object and get its heght and width, which will be similar to the dimensions you have marked. This docs will get you started:

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html

http://docs.opencv.org/2.4/doc/tutorials/imgproc/shapedescriptors/bounding_rects_circles/bounding_rects_circles.html

Another possibility is to find a pair of points in the segmented contour - one that has the least x coordinate and the other that has the highest x coordinate. Distance between these points if one of the dimensions you seek. Do the same for y coordinate and compare the distances to determine which is height and which is width.

You may also try fitting an ellipse to the segmented contour if all the objects are of a shape that is more or less oval. This may give better results:results as it's going to account for possible tilt:

http://docs.opencv.org/2.4/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=fitellipse#fitellipse

Of course these methods won't give you the exact results, but it seems to me that in this case it's not clear what an exact result is (I would say the width could be drawn in several other ways in this image unless I don't know something about the methodology) and every measurement is only an approximation and we are looking for the one that is acceptable.