Reputation: 333
I come from cell biology world so please excuse my lack of knowledge beforehand.
I primarily use ImageJ for image processing in which we fit a 2D-Gaussian to detect clusters/blobs/puncta. See image below, for example.
I am trying to implement a similar pipeline in python and came across opencv
. I'm using simple blob detector and it works well for nicely isolated clusters and not so well where multiple clusters are clustered together. Below, left image is raw image and right is after tresholding.
My detector is contouring a "multi-cluster" cluster as a single cluster. Is there a way to segment these multi-cluster clusters more intelligently? Ideally, I'd like to use the same 2D-Gaussian, but am open to anything at this point?
Upvotes: 1
Views: 657
Reputation: 4171
Try contour detection and see if it works.
contours, hierarchy = cv2.findContours(image, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
out = image.copy()
out = cv2.cvtColor(image, cv2.COLOR_GRAY2RGB)
for c in contours:
cv2.polylines(out,[c],True,(255,0,0),1)
Upvotes: 1