matlab - opencv-python image processing code-debugging -
i have written code in ocv-python image processing(detection of veins in eye), not working, can help?
import os,sys import numpy np import scipy import cv2 import pil import image import imagechops i=cv2.imread('eye.jpg',0); cv2.imshow(i); j= cv2.medianblur(i, 3); clahe = cv2.createclahe(cliplimit=2.0, tilegridsize=(8,8)); k= clahe.apply(j); kernel = np.ones((5,5),np.uint8); closing = cv2.morphologyex(k, cv2.morph_close, kernel); h, w = i.shape[:2]; seed_pt = none; mask = np.zeros((h+2, w+2), np.uint8); l=cv2.floodfill(k, mask, seed_pt, (255, 255, 255)); o=imagechops.difference(closing,l); (thresh, im_bw) = cv2.threshold(o, 128, 255, cv2.thresh_binary | cv2.thresh_otsu); cv2.imshow(im_bw);
'
particularly having problem reading .jpg file(it reads .png file), imshow() function not working, , errors being shown imagechops , otsu threshold function.
the matlab code above code is(it working perfectly):
t=('http://www.ohiolionseyeresearch.com/core/files/uploads/2014/03/1217.png'); i=imread(t); figure, imshow(i) q=rgb2hsv(i); t=rgb2gray(i); figure, imshow(t) k=medfilt2(t); figure, imshow(k) u=adapthisteq(k); se=strel('disk',10); c=imclose(u,se); figure, imshow(c) d=imfill(u,'holes'); figure, imshow(d) z=imabsdiff(c,d); figure, imshow(z) level=graythresh(z); bw=im2bw(z,level); imshow(bw)
'
Comments
Post a Comment