Anasse
Anasse

Reputation: 21

Separate Background and make the edges smooth with EmguCv

im not familiar with EmguCv, i have a Dicomfile which i want to make the background black (0 value) and then make the edges smooth to have a nice shape.

I put the raw bytes in a bytes array, and applied Image.ThresholdBinary() as you see in code below. This is the image i wanna to modify its background and egdes. Thank you in advance. enter image description here

var threshold = iimg.ThresholdBinaryInv(new Gray(20), new Gray(100));

Upvotes: 0

Views: 173

Answers (1)

JonasH
JonasH

Reputation: 36341

A fairly simple method would be to apply a blur to the thresholded image, and then apply another threshold. That should give you a smoothed edge. It might also be possible to apply the blur to the original image instead depending on what effect you are after. While this will give you a smoother edge, there is no guarantee it will follow the desired contour any better.

You might be able to use level sets. My very rudimentary understanding of the method is that you should be able to configure it to balance feature following and smoothness. But I do not think this is implemented in OpenCV, and I would have no idea how to use it if it where.

Upvotes: 1

Related Questions