From 9f362fd038b7f83e132bfe528a76f0b7637882a1 Mon Sep 17 00:00:00 2001 From: Alexandre Gobbo Date: Fri, 16 Aug 2019 14:23:05 +0200 Subject: [PATCH] Script execution --- script/cpython/image_functions.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/script/cpython/image_functions.py b/script/cpython/image_functions.py index e1c21f2..f56ac1f 100644 --- a/script/cpython/image_functions.py +++ b/script/cpython/image_functions.py @@ -1,10 +1,17 @@ import numpy import time +from scipy import signal, ndimage + def img_get_int(fname, thres1, thres2, thres3, thres4, header, width, height, depth, x1,y1,x2,y2, bx1,by1,bx2,by2 , filter_median = False, filter_nsigma = 0): # read actual image file img = numpy.fromfile(fname, dtype=numpy.uint32) img.shape = height, width + if filter_nsigma>0: + img = ndimage.gaussian_filter(img, filter_nsigma) + elif filter_median: + #img = signal.medfilt2d(img.astype('d'), kernel_size=3) + img = ndimage.median_filter(img, size=3) # signal roi area_I = ( x2 - x1 + 1) * ( y2 - y1 + 1) I_sum = img[y1:y2, x1:x2].sum() @@ -12,7 +19,6 @@ def img_get_int(fname, thres1, thres2, thres3, thres4, header, width, height, d thresh2_count = len(numpy.where(img>thres2)[0]) thresh3_count = len(numpy.where(img>thres3)[0]) thresh4_count = len(numpy.where(img>thres4)[0]) - time.sleep(1.0) # background roi I_sum_bgr = img[by1:by2, bx1:bx2].sum() area_bgr= (bx2 - bx1 + 1) * (by2 - by1 + 1)