Ask Your Question

Sagi's profile - activity

2020-10-22 03:34:43 -0600 received badge  Popular Question (source)
2020-04-29 02:46:52 -0600 received badge  Enthusiast
2020-04-16 11:43:23 -0600 marked best answer How to create a Binary Mask for medical images

Hello,

I'm try to create binary mask for medical images, im new to OpenCV and any advice will help on how, or if it possible, to do so with OpenCV. Below is the type of pictures I try to create mask for:

image description

I need to color the vocal cords area in white(Marked with triangle) and the rest in black, so it will look something like that:

image description

i tried to find the contours using that code:

import cv2
import numpy as np
img = cv2.imread("LPR.png", cv2.IMREAD_GRAYSCALE)
_, threshold = cv2.threshold(img, 50, 255, cv2. THRESH_BINARY_INV)
_, contours, _ = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
for cnt in contours:
    cv2.drawContours(img, [cnt], 0, (0))
cv2.imshow("LPR", img)
cv2.imshow("Threshold", threshold)
cv2.waitKey(0)

this is the result: image description

i tried to clean the rest of the image using some adaptiveThreshold but the result was worse. i also try to detect the triangle shape that created by the Vocal cords, also without success.

Does anyone have any suggestions on how I can get the desired result or what method I can use?

Any advice will help, Thanks.

The original image for example:

image description

2020-04-16 11:43:23 -0600 received badge  Scholar (source)
2020-04-07 03:11:29 -0600 commented answer How to create a Binary Mask for medical images

@supra56 Thank you very much for your help! It works great on the image!! What part of the code can I change to make it

2020-04-06 07:27:35 -0600 commented question How to create a Binary Mask for medical images

@supra56 I added the original image, Thank you.

2020-04-06 07:24:19 -0600 edited question How to create a Binary Mask for medical images

How to create a Binary Mask for medical images Hello, I'm try to create binary mask for medical images, im new to Open

2020-04-06 07:24:06 -0600 received badge  Editor (source)
2020-04-06 07:24:06 -0600 edited question How to create a Binary Mask for medical images

How to create a Binary Mask for medical images Hello, I'm try to create binary mask for medical images, im new to Open

2020-04-05 09:10:27 -0600 asked a question How to create a Binary Mask for medical images

How to create a Binary Mask for medical images Hello, I'm try to create binary mask for medical images, im new to Open