示例#1
0
def harris(im, d_value):
    data_src = im.getdata()
    xsize, ysize = im.size
    data_res = []
    now_pix = 0
    last_pix_col = 0
    last_pix_row = []
    rows = Rows(data_src, 3, xsize)
    win = Window(3)
    while 1:
        w = win.update(rows.update())
        if win.is_enable():
            break
    for y in range(ysize):
        for x in range(xsize):
            if rows.frame_empty():
                rows.create(data_src, 3, xsize)
            pix_tblr = [w[0][1], w[2][1], w[1][2], w[1][0]]
            pix_now = w[1][1]
            diff_tblr = []
            for pix in pix_tblr:
                diff_tblr.append(abs(pix_now - pix))
            pix_res = 0
            for d_tb in diff_tblr[0:2]:
                for d_lr in diff_tblr[2:4]:
                    if d_tb >= d_value and d_lr >= d_value:
                        pix_res = 1
            data_res.append(pix_res)
            w = win.update(rows.update())
    return data_res
示例#2
0
def harris(im, d_value):
    data_src = im.getdata()
    xsize, ysize = im.size
    data_res = []
    now_pix = 0
    last_pix_col = 0
    last_pix_row = []
    rows = Rows(data_src, 3, xsize)
    win = Window(3)
    while 1:
        w = win.update(rows.update())
        if win.is_enable():
            break
    for y in range(ysize):
        for x in range(xsize):
            if rows.frame_empty():
                rows.create(data_src, 3, xsize)
            pix_tblr = [w[0][1], w[2][1], w[1][2], w[1][0]]
            pix_now = w[1][1]
            diff_tblr = []
            for pix in pix_tblr:
                diff_tblr.append(abs(pix_now - pix))
            pix_res = 0
            for d_tb in diff_tblr[0:2]:
                for d_lr in diff_tblr[2:4]:
                    if d_tb >= d_value and d_lr >= d_value:
                        pix_res = 1
            data_res.append(pix_res)
            w = win.update(rows.update())
    return data_res
示例#3
0
def create(im, wsize, rank):
    data_src = im.getdata()
    xsize, ysize = im.size
    data_res = []
    rows = Rows(data_src, wsize, xsize)
    win = Window(wsize)
    while 1:
        w = win.update(rows.update())
        if win.is_enable():
            break
    for i in range(len(data_src)):
        if rows.frame_empty():
            rows.create(data_src, wsize, xsize)
        data_res.append(rank_fitter(w, rank))
        w = win.update(rows.update())
    return data_res
示例#4
0
def create(im, wsize, mask, mode):
    data_src = im.getdata()
    xsize, ysize = im.size
    data_res = []
    rows = Rows(data_src, wsize, xsize)
    win = Window(wsize)
    while 1:
        win.update(rows.update())
        if win.is_enable():
            break
    for y in range(ysize):
        for x in range(xsize):
            if rows.frame_empty():
                rows.create(data_src, wsize, xsize)
            w = win.update(rows.update())
            data_res.append(erosion_dilation(w, mask, mode))
    return data_res
示例#5
0
def create(im, wsize, rank):
	data_src = im.getdata()
	xsize,ysize = im.size
	data_res = []
	rows = Rows(data_src, wsize, xsize)
	win = Window(wsize)
	while 1:
		w = win.update(rows.update())
		if win.is_enable():
			break
	for i in range(len(data_src)):
		if rows.frame_empty():
			rows.create(data_src, wsize, xsize)
		data_res.append(rank_fitter(w, rank))
		w = win.update(rows.update())
	return data_res
示例#6
0
def create(im, wsize, mask, mode):
	data_src = im.getdata()
	xsize,ysize = im.size
	data_res = []
	rows = Rows(data_src, wsize, xsize)
	win = Window(wsize)
	while 1:
		win.update(rows.update())
		if win.is_enable():
			break
	for y in range(ysize):
		for x in range(xsize):
			if rows.frame_empty():
				rows.create(data_src, wsize, xsize)
			w = win.update(rows.update())
			data_res.append(erosion_dilation(w, mask, mode))
	return data_res
示例#7
0
 def iterate(self):
     '''
     this method creates iterative way of accessing rows data
     '''
     rows = Rows(self._rows)
     return rows