python - Unable to Process an image transformed in OpenCV via scikit-image -


i want skeletonize image using scikit-image module skeletonization. image pre processed opencv library. given image 'feb_16-0.jpg', convert gray scale, perform morphological transformation of opening image, apply gaussian blur , adaptive thresholding using opencv , python:

import cv2 import numpy np matplotlib import pyplot plt skimage.morphology import skeletonize skimage.viewer import imageviewer img = cv2.imread('feb_16-0.jpg',0) kernel = np.ones((1,1),np.uint8) opening = cv2.morphologyex(img, cv2.morph_open, kernel) blur = cv2.gaussianblur(opening,(1,1),0) ret3,th4 = cv2.threshold(blur,0,255,cv2.thresh_binary+cv2.thresh_otsu) 

i want skeletonize image using scikit-image skimage.morphology.skeletonize. have tried writing code performing erosion , dilation manually skeletonize image using opencv , python. but, proved highly inefficient processing decided switch scikit-image library @ point. however, when pass numpy array preprocessed opencv scikit-image module using code:

skel = skeletonize(th4) 

and try view results of same, end error:

image contains values other 0 , 1 

i unable interpret cause same. can kindly me out in resolving datatype error?

please see if below code works.

import cv2 import numpy np matplotlib import pyplot plt skimage.morphology import skeletonize skimage.viewer import imageviewer img = cv2.imread('feb_16-0.jpg',0) kernel = np.ones((1,1),np.uint8) opening = cv2.morphologyex(img, cv2.morph_open, kernel) blur = cv2.gaussianblur(opening,(1,1),0) ret3,th4 = cv2.threshold(blur,0,255,cv2.thresh_binary+cv2.thresh_otsu) th4[th4 == 255] = 1 skel = skeletonize(th4) viewer = imageviewer(skel) viewer.show() 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -