Prometheus
Prometheus

Reputation: 563

Matlab Connected Components that touch the Margin

I am writing a matlab script in order to extract lungs from CT images. In order to remove the background from the image, I need to detect the components that touch the margins of the image and then remove it. How can I perform so once I've found the connected components in the image ?

An example is the image below.

enter image description here

I would like to keep only the inner white part of the image.

Upvotes: 1

Views: 263

Answers (1)

Dima
Dima

Reputation: 39389

Use the imclearborder function.

Upvotes: 1

Related Questions