Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Watershed Segmentation

# SEGMENTATION
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread(r'C33P1thinF_IMG_20150619_114756a_cell_181.png')
b,g,r = cv2.split(img)
rgb_img = cv2.merge([r,g,b])
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(gray,0,255,cv2.THRESH_BINARY_INV+cv2.THRESH_OTSU)
plt.subplot(211),plt.imshow(closing, 'gray')
plt.title("morphologyEx:Closing:2x2"), plt.xticks([]), plt.yticks([])
plt.subplot(212),plt.imshow(sure_bg, 'gray')
plt.imsave(r'dilation.png',sure_bg)
plt.title("Dilation"), plt.xticks([]), plt.yticks([])
plt.tight_layout()
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: how to set default file directory for jupyter notebook 
Python :: length of list in python 
Python :: variable python 
Python :: try except in list comprehension 
Python :: polls/models.py 
Python :: Python RegEx Subn – re.subn() 
Python :: merge sorting algorithm 
Python :: pyhton serialize object 
Python :: python list copy 
Python :: all string methods in python 
Python :: python get the last in dictionary 
Python :: python image heatmap 
Python :: best jarvis code in python 
Python :: return more than one value python 
Python :: how to load a keras model with custom loss function 
Python :: np diag 
Python :: gui in python 
Python :: how to check a string in if statement python 
Python :: k-means clustering 
Python :: dataframe names pandas 
Python :: search object in array python 
Python :: print column name and index python 
Python :: commands.has_role discord.py 
Python :: spotify recommendations 
Python :: expected a list of items but got type int . django 
Python :: a string varible in python 
Python :: when to use python sets 
Python :: iif python 
Python :: installing python3.8 in rpi 
Python :: indexers in python 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =