Ask Your Question

How to get areas of objects after watershed segmentation?

asked 2019-08-12 01:52:06 -0500

savailonei gravatar image

updated 2019-08-12 03:24:19 -0500

I have a result of watershed algorithm as follows: watershed.png

How would I find all the separate areas of blobs I have in this result?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-08-20 08:47:54 -0500

updated 2019-08-20 08:48:25 -0500

Have a look at the coin segmentation example using watershed. If you calculate the distance transforms, than threshold it strictly and then look for separate blobs you have what you need..

edit flag offensive delete link more


Thank you for your answer. I need to filter the blobs based on areas resulting from watershed. How would I get those areas?

savailonei gravatar imagesavailonei ( 2019-08-21 02:49:55 -0500 )edit

You are retrieving the watershed regions as markers. These are basically points that have a specific ID. You can add all the points to a vector<Point>, then call convexHull which will return a contour and on top of that you can apply the function contourArea which can then be used to sort or filter your regions.

StevenPuttemans gravatar imageStevenPuttemans ( 2019-08-21 04:30:43 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-08-12 01:52:06 -0500

Seen: 16 times

Last updated: Aug 12