sephonlee / PhyloParser

Automatically read tree structure from image format
http://viziometrics.org/about/
MIT License
2 stars 1 forks source link

Value error with PhyloParser.resizeImageByLineWidth(image) #3

Open sorrynoclue42 opened 3 years ago

sorrynoclue42 commented 3 years ago

Hi, I tried using your example.py code and ran into the following error (in line 14):

`ValueError Traceback (most recent call last)

in 12 13 # Normalize image dimension based on linewidth ---> 14 image, w = PhyloParser.resizeImageByLineWidth(image) 15 # PhyloParser.displayImage(image) ~\PhyloParser\PhyloParser.py in resizeImageByLineWidth(image, linewidth) 226 @staticmethod 227 def resizeImageByLineWidth(image, linewidth = 4): --> 228 w = PhyloParser.findLineWidth(image) 229 if abs(w) > linewidth : 230 ratio = linewidth / abs(float(w)) ~\PhyloParser\PhyloParser.py in findLineWidth(image, upper_bond) 238 # 2. Iteratively Use opening until detecting a change of overall pixel values 239 def findLineWidth(image, upper_bond = 15): --> 240 mask, nonTreeMask, contours, hierarchy = PhyloParser.findContours(255 - PhyloParser.negateImage(image)) 241 242 linewidth = 1 ~\PhyloParser\PhyloParser.py in findContours(var_mask1, var_mask2) 268 height, width = var_mask1.shape 269 var_mask1 = cv.copyMakeBorder(var_mask1, 1, 1, 1, 1, cv.BORDER_CONSTANT, value = 0) --> 270 _, contours, hierarchy= cv.findContours(var_mask1.copy(), cv.RETR_TREE, cv.CHAIN_APPROX_NONE) 271 272 lenghtList = [] ValueError: not enough values to unpack (expected 3, got 2)` I used the jpg image (107 kb, 712x938 pixel) pasted below. Any suggestions? Thanks! ![combosch 2016_4](https://user-images.githubusercontent.com/25839918/95021898-17311e00-0674-11eb-953b-62e0e4e497ce.jpg)