image-segmentation

Count number of cells in the image

别来无恙 提交于 2020-01-12 08:24:09
问题 I need code for counting the number of cells in the image and only the cells that are in pink color should be counted .I have used thresholding and watershed method. import cv2 from skimage.feature import peak_local_max from skimage.morphology import watershed from scipy import ndimage import numpy as np import imutils image = cv2.imread("cellorigin.jpg") gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1] cv2.imshow(

Filling holes in objects that touch the border of an image

不羁的心 提交于 2020-01-12 04:58:08
问题 I'm trying to fill holes in the below image. When I use SciPy's binary_fill_holes(), I am generally successful, with the exception of objects that touch the image's border. Are there any existing Python functions that can fill holes in objects that touch the border? I tried adding a white border around the image, but that just resulted in the entire image being filled. 回答1: This assumes that there is more background than other stuff. It basically does a connected component analysis on the

Draw line and Cut off Circuler area

删除回忆录丶 提交于 2020-01-11 11:54:42
问题 I have got the below Image after running the below code. file='grayscale.png'; I=imread(file); bw = im2bw(I); bw = bwareaopen(bw,870); imwrite(bw,'noiseReduced.png') subplot(2,3,1),imshow(bw); [~, threshold] = edge(bw, 'sobel'); fudgeFactor = .5; im = edge(bw,'sobel', threshold * fudgeFactor); subplot(2,3,2), imshow(im), title('binary gradient mask'); se = strel('disk',5); closedim = imclose(im,se); subplot(2,3,3), imshow(closedim), title('Connected Cirlces'); cc = bwconncomp(closedim); S =

How to implement multi-class semantic segmentation?

Deadly 提交于 2020-01-10 10:24:56
问题 I'm able to train a U-net with labeled images that have a binary classification. But I'm having a hard time figuring out how to configure the final layers in Keras/Theano for multi-class classification (4 classes). I have 634 images and corresponding 634 masks that are unit8 and 64 x 64 pixels. My masks, instead of being black (0) and white (1), have color labeled objects in 3 categories plus background as follows: black (0), background red (1), object class 1 green (2), object class 2 yellow

How to implement multi-class semantic segmentation?

谁说胖子不能爱 提交于 2020-01-10 10:23:43
问题 I'm able to train a U-net with labeled images that have a binary classification. But I'm having a hard time figuring out how to configure the final layers in Keras/Theano for multi-class classification (4 classes). I have 634 images and corresponding 634 masks that are unit8 and 64 x 64 pixels. My masks, instead of being black (0) and white (1), have color labeled objects in 3 categories plus background as follows: black (0), background red (1), object class 1 green (2), object class 2 yellow

Maximum likelihood pixel classification in python opencv

这一生的挚爱 提交于 2020-01-07 08:40:29
问题 I would like to perform pixel classification on RGB images based on input training samples of given number of classes. So I have e.g. 4 classes containing pixels (r,g,b) thus the goal is to segment the image into four phases. I found that python opencv2 has the Expectation maximization algorithm which could do the job. But unfortunately I did not find any tutorial or material which can explain me (since I am beginner) how to work with the algorithm. Could you please propose any kind of

tensorflow, image segmentation convnet InvalidArgumentError: Input to reshape is a tensor with 28800000 values, but the requested shape has 57600

陌路散爱 提交于 2020-01-06 06:47:15
问题 I am trying to segment images from the BRATS challenge. I am using U-net in a combination of these two repositories: https://github.com/zsdonghao/u-net-brain-tumor https://github.com/jakeret/tf_unet When I try to output the prediction statistics a mismatch shape error come up: InvalidArgumentError: Input to reshape is a tensor with 28800000 values, but the requested shape has 57600 [[Node: Reshape_2 = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]

tensorflow, image segmentation convnet InvalidArgumentError: Input to reshape is a tensor with 28800000 values, but the requested shape has 57600

笑着哭i 提交于 2020-01-06 06:46:07
问题 I am trying to segment images from the BRATS challenge. I am using U-net in a combination of these two repositories: https://github.com/zsdonghao/u-net-brain-tumor https://github.com/jakeret/tf_unet When I try to output the prediction statistics a mismatch shape error come up: InvalidArgumentError: Input to reshape is a tensor with 28800000 values, but the requested shape has 57600 [[Node: Reshape_2 = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:CPU:0"]

“hard” supervision in image segmentation with python

与世无争的帅哥 提交于 2020-01-05 02:52:31
问题 There are several packages and methods for segmentation in Python. However, if I know apriori that certain pixels (and no others) correspond to a particular object, how can I use that to segment other objects? Which methods implemented in python would lend themselves to this approach? Thanks. 回答1: You'll want to take a look at semi-automated image segmentation. Image segmentation in a semi-automated perspective means that you know before hand what class certain pixels belong to - either

AttributeError: 'NoneType' object has no attribute '_inbound_nodes'

狂风中的少年 提交于 2020-01-04 07:47:12
问题 I want to implement the loss function defined here. I use fcn-VGG16 to obtain a map x, and add a activation layer.(x is the output of the fcn vgg16 net). And then just some operations to get extracted features. co_map = Activation('sigmoid')(x) #add mean values img = Lambda(AddMean, name = 'addmean')(img_input) #img map multiply img_o = Lambda(HighLight, name='highlightlayer1')([img, co_map]) img_b = Lambda(HighLight, name='highlightlayer2')([img, 1-co_map]) extractor = ResNet50(weights =