2017-07-28 14:05:38 -0600 | received badge | ● Peer Pressure (source) |
2017-07-26 13:34:39 -0600 | commented question | Region Growing Segmentation Others have also asked such questions like "how can i segment an object with region growing" and you have also commented on that with a positive reply then why do you think this question is not a real one. |
2017-07-26 13:28:35 -0600 | commented question | Region Growing Segmentation The code is a bit long,that's why I have given the link. |
2017-07-26 13:01:25 -0600 | commented question | Region Growing Segmentation If you don't know the answer please let others try......and please don't close the question.It's my humble request. |
2017-07-26 12:46:33 -0600 | asked a question | Region Growing Segmentation This is the link... https://drive.google.com/open?id=0B1O... |
2017-07-26 12:38:26 -0600 | received badge | ● Editor (source) |
2017-07-26 08:34:33 -0600 | asked a question | Region growing image segmentation This is the code for region growing segmentation that deals only with grayscale images,i.e. it converts the colored image into grayscale first then performs segmentation....I want it to work for colored images. import cv2 import numpy as np import sys def get8n(x, y, shape): out = [] maxx = shape[1]-1 maxy = shape[0]-1 def region_growing(img, seed): list = [] outimg = np.zeros_like(img) list.append((seed[0], seed[1])) processed = [] while(len(list) > 0): pix = list[0] outimg[pix[0], pix[1]] = 255 for coord in get8n(pix[0], pix[1], img.shape): if img[coord[0], coord[1]] != 0: outimg[coord[0], coord[1]] = 255 if not coord in processed: list.append(coord) processed.append(coord) list.pop(0) #cv2.imshow("Progress",outimg) cv2.waitKey(1) return outimg def on_mouse(event, x, y, flags, params): if event == cv2.EVENT_LBUTTONDOWN: print 'Seed: ' + str(x) + ', ' + str(y), img[y,x] clicks.append((y,x)) clicks = [] im=raw_input("Enter the path of the image ")image = cv2.imread("coins.jpg",0) ret, img = cv2.threshold(image, 127, 255, cv2.THRESH_BINARY) cv2.namedWindow('Input') cv2.setMouseCallback('Input', on_mouse, 0, ) cv2.imshow('Input', img) cv2.waitKey() seed = clicks[-1] out = region_growing(img, seed) cv2.imshow('Region Growing', out) cv2.waitKey() cv2.destroyAllWindows() |