Ejemplo n.º 1
0
try canny on raw gray image and do asm on it after binarize it.
"""

import numpy as np
import os
from PIL import Image
import sys

# read image and get the global features about image
dir = os.getcwd()
sys.path.append(dir)
result_dir = dir + '/result/result_5/'
fn = dir + '/data/data.jpg'
img =Image.open(fn)
width = img.size[0]
height = img.size[1]
arr = np.array(img.getdata(), dtype=np.uint8).reshape(height, width, 3)

# get the gray image
from skimage.color import rgb2gray
#from src.util import saveimage
gray = rgb2gray(arr)
#fn = dir + '/result/result_1/gray'
#saveimage(gray, fn, title='gray', is_gray=True, show=True)

from src.canny import my_canny
fn = result_dir + 'canny'
s = 4
cannied = my_canny(gray,fn, sigma=s)