python - Converting a PIL image to skimage? -
i have image loaded in code (very long , unnecessary, won't post here) need work on skimage detect blobs in image. reason of images , attempts have used don't work.
the image modified pil in code above make objects trying find white (255, 255, 255), , other pixels black. code needs identify positions of these. have tried many different things work (converting them numpy array, not converting them numpy array ect.)
i following these instructions : http://scikit-image.org/docs/dev/auto_examples/plot_blob.html basics, not tutorial, more example.
i think rgb2gray function being problematic returns nothing 0, whilst print(numpy.array(img)) returns values between 0 , 1, suggesting loss of information when rgb2gray called.
here code seems problematic:
img_gray = rgb2gray(numpy.array(img)) # convert numpy array skimage print(img_gray) print(numpy.array(img)) img_blobs = blob_doh(img_gray, threshold=0.01, max_sigma=500) print(img_blobs) how can fix this?
edit:
here each of images, arrays , lists print:
[[ 0. 0. 0. ..., 0. 0. 0. ] #img_gray [ 0. 0.00392157 0.01568627 ..., 0. 0. 0. ] [ 0. 0.01176471 0.05882353 ..., 0. 0. 0. ] ..., [ 1. 0.99607843 0.96078431 ..., 0. 0. 0. ] [ 1. 1. 0.98039216 ..., 0. 0. 0. ] [ 1. 1. 0.99215686 ..., 0. 0. 0. ]] [[[ 0 0 0] #img [ 0 0 0] [ 0 0 0] ..., [ 0 0 0] #img [ 0 0 0] [ 0 0 0]] [[ 0 0 0] #img [ 1 1 1] [ 4 4 4] ..., [ 0 0 0] #img [ 0 0 0] [ 0 0 0]] [[ 0 0 0] #img [ 3 3 3] [ 15 15 15] ..., [ 0 0 0] #img [ 0 0 0] [ 0 0 0]] ..., [[255 255 255] #img [254 254 254] [245 245 245] ..., [ 0 0 0] #img [ 0 0 0] [ 0 0 0]] [[255 255 255] #img [255 255 255] [250 250 250] ..., [ 0 0 0] #img [ 0 0 0] [ 0 0 0]] [[255 255 255] [255 255 255] [253 253 253] ..., [ 0 0 0] [ 0 0 0] [ 0 0 0]]] [] #img_blobs
Comments
Post a Comment