I am trying to remove the pectoral muscle from a mammogram image. I did this by converting it to binary doing the the following:
img2=img<150;
imclearborder(img2); %since the pectoral muscle is usually at the border of the image
This removes the pectoral muscle from the image. But I now need to convert the resulting image without the pectoral muscle back to grayscale. Can anyone advise me on how to do this please?
original image
Img with pectoral muscle img with pectoral muscle removed
The first image shows a binary version of the mammogram with the pectoral muscle in the top left hand corner. The second image shows the binary image with the pectoral muscle removed. I need to convert this image back to grayscale.
I have tried multiplying the original image with the resulting binary image but I get this :
multiplied image
1 Answer 1
Try
img2 = img < 150;
img3 = imclearborder(img2);
Result = img3 - img2;
So your muscle is now negative value, you just have to threshold again
Result(Result > -1) = 1;
Result(Result < 0) = 0;
Or just by doing, it will be enough, because difference will be -1 and similar will be 0.
Result = Result + 1;
And you have a new mask. Finally, you can use it on your original image.
Final = uint8(Result).*img;
img.*img2?