示例#1
0
    def _scanningwindow(self, src):

        size = src.shape
        height = size[0]
        width = size[1]
        dst = np.zeros([height - 1, width - 1], dtype=np.uint8)
        for jj in xrange(0, height - self.win_height, self.win_height / 2):
            for ii in xrange(0, width - self.win_width, self.win_width / 2):
                aux = src[jj, ii] + src[jj + self.win_height,
                                        ii + self.win_width] - src[
                                            jj + self.win_height,
                                            ii] - src[jj, ii + self.win_width]
                if aux > self.win_min_pix:
                    dst[jj:jj + self.win_height, ii:ii + self.win_width] = 255
        return dst
示例#2
0
文件: background.py 项目: lacatus/TFM
    def _scanningwindownointegral(self, src):

        size = src.shape
        height = size[0]
        width = size[1]
        dst = np.zeros((height, width), dtype=np.uint8)
        for jj in xrange(0, height - self.win_height, self.win_height / 2):
            for ii in xrange(0, width - self.win_width, self.win_width / 2):
                aux = 0
                for zz in xrange(jj, jj + self.win_height, 1):
                    for ww in xrange(ii, ii + self.win_width, 1):
                        if src[zz, ww] > 0:
                            aux += 1
                if aux > self.win_min_pix:
                    dst[jj : jj + self.win_height, ii : ii + self.win_width] = 255
        return dst
示例#3
0
    def _scanningwindownointegral(self, src):

        size = src.shape
        height = size[0]
        width = size[1]
        dst = np.zeros((height, width), dtype=np.uint8)
        for jj in xrange(0, height - self.win_height, self.win_height / 2):
            for ii in xrange(0, width - self.win_width, self.win_width / 2):
                aux = 0
                for zz in xrange(jj, jj + self.win_height, 1):
                    for ww in xrange(ii, ii + self.win_width, 1):
                        if src[zz, ww] > 0:
                            aux += 1
                if aux > self.win_min_pix:
                    dst[jj:jj + self.win_height, ii:ii + self.win_width] = 255
        return dst
示例#4
0
文件: background.py 项目: lacatus/TFM
    def _scanningwindow(self, src):

        size = src.shape
        height = size[0]
        width = size[1]
        dst = np.zeros([height - 1, width - 1], dtype=np.uint8)
        for jj in xrange(0, height - self.win_height, self.win_height / 2):
            for ii in xrange(0, width - self.win_width, self.win_width / 2):
                aux = (
                    src[jj, ii]
                    + src[jj + self.win_height, ii + self.win_width]
                    - src[jj + self.win_height, ii]
                    - src[jj, ii + self.win_width]
                )
                if aux > self.win_min_pix:
                    dst[jj : jj + self.win_height, ii : ii + self.win_width] = 255
        return dst
示例#5
0
文件: background.py 项目: lacatus/TFM
    def setconfiguration(self, src, config):

        size = src.shape
        height = size[0]
        width = size[1]

        self.counter = 1
        self.win_height = config["win_height"]
        self.win_width = config["win_width"]
        self.win_min_pix = config["win_min_pix"]
        self.bg_img = src
        self.bin_img_1 = np.zeros((height, width))
        self.bin_img_2 = self.bin_img
        self.scan_img = self.bin_img
        self.diff_img = self.bin_img
        self.diff_img_copy = self.bin_img
        self.contours = None
        self.rectangles = []
示例#6
0
文件: background.py 项目: lacatus/TFM
    def setdefault(self, src):

        size = src.shape
        height = size[0]
        width = size[1]

        self.counter = 1
        self.win_height = 30
        self.win_width = 15
        self.win_min_pix = 200
        self.bg_img = src
        self.bin_img_1 = np.zeros((height, width))
        self.bin_img_2 = self.bin_img
        self.scan_img = self.bin_img
        self.diff_img = self.bin_img
        self.diff_img_copy = self.bin_img
        self.contours = None
        self.rectangles = []
示例#7
0
    def setconfiguration(self, src, config):

        size = src.shape
        height = size[0]
        width = size[1]

        self.counter = 1
        self.win_height = config['win_height']
        self.win_width = config['win_width']
        self.win_min_pix = config['win_min_pix']
        self.bg_img = src
        self.bin_img_1 = np.zeros((height, width))
        self.bin_img_2 = self.bin_img
        self.scan_img = self.bin_img
        self.diff_img = self.bin_img
        self.diff_img_copy = self.bin_img
        self.contours = None
        self.rectangles = []
示例#8
0
    def setdefault(self, src):

        size = src.shape
        height = size[0]
        width = size[1]

        self.counter = 1
        self.win_height = 30
        self.win_width = 15
        self.win_min_pix = 200
        self.bg_img = src
        self.bin_img_1 = np.zeros((height, width))
        self.bin_img_2 = self.bin_img
        self.scan_img = self.bin_img
        self.diff_img = self.bin_img
        self.diff_img_copy = self.bin_img
        self.contours = None
        self.rectangles = []