0
$\begingroup$

I'm trying to extract a single region from the image in matlab. The light region looks well connected and distinct from surrounding.

enter image description here

However, I applied a hard threshold B = A(A>1e-3) and it produced

enter image description here

The edge of the extracted shape is not smoothing at all and there are lots of isolated pixels.

$\endgroup$
1
$\begingroup$

For an image as simple as this, it might work to just perform opening or closing on the image to smooth out the edges before thresholding. Opening will remove any small, disconnected parts of the object, leading to an undersegmented image (smaller than the actual size). Closing will fill in any small holes in the object, leading to an oversegmented image (larger than the actual object size).

However, I think your image here is clean enough that thresholding should still work. Try a smaller value for the thresold, or use a MATLAB function like imbinarize to threshold it for you.

ex. thresholded_image = imbinarize(image, 'global');

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.