Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Extracting foreground with otsu thresholding

I am trying to extract region of interest in the following image with otsu thresholding.

image description

img = cv2.imread("IM_00024.TIF", 0) 
ret, imgf = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU) 
cv2.imwrite('imgobsu.png', imgf)

image description

Based on my understanding of THRESH_BINARY option , my region of interest will be the white section of the obsu image. How can i apply the segmented obsu image to the original image so that i can segment it in such as way that i obtain both the foreground and the background

Extracting foreground with otsu thresholding

I am trying to extract region of interest in the following image with otsu thresholding.

image description

img = cv2.imread("IM_00024.TIF", 0) 
ret, imgf = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU) 
cv2.imwrite('imgobsu.png', imgf)

image description

Based on my understanding of THRESH_BINARY option , my region of interest will be the white section of the obsu image. How can i apply the segmented obsu image to the original image so that i can segment it in such as way that i obtain both the foreground and the background

Extracting foreground with otsu thresholding

I am trying to extract region of interest in the following image with otsu thresholding.

image description

image description
 img = cv2.imread("IM_00024.TIF", 0)
 ret, imgf = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
 cv2.imwrite('imgobsu.png', imgf)
imgf)

image description

Based on my understanding of THRESH_BINARY option , my region of interest will be the white section of the obsu image. How can i apply the segmented obsu image to the original image so that i can segment it in such as way that i obtain both the foreground and the background

Extracting foreground with otsu thresholding

I am trying to extract region of interest in the following image with otsu thresholding.

image descriptiontiff image

img = cv2.imread("IM_00024.TIF", 0)
 ret, imgf = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
 cv2.imwrite('imgobsu.png', imgf)

imgf)

image description

Based on my understanding of THRESH_BINARY option , my region of interest will be the white section of the obsu image. How can i apply the segmented obsu image to the original image so that i can segment it in such as way that i obtain both the foreground and the background

Extracting foreground with otsu thresholding

I am trying to extract region of interest in the following image with otsu thresholding.

tiff image

img = cv2.imread("IM_00024.TIF", 0) 
ret, imgf = cv2.threshold(img, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU) 
cv2.imwrite('imgobsu.png', imgf)

image description

Based on my understanding of THRESH_BINARY option , my region of interest will be the white section of the obsu image. How can i apply the segmented obsu image to the original image so that i can segment it in such as way that i obtain both the foreground and the background

Edit 1:

In my attempt to create a mask that contain everything except the brain(i.e the background mask) , i found the largest contour and then i fill it with black.

_, contours, _ = cv2.findContours(otsu_mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
largest_contour = max(contours, key=cv2.contourArea)
cv2.drawContours(otsu_mask, largest_contour, -1, 0, 200)

image description

However part of the brain is still not properly segmented.How can i improve the algorithm