(self, pos, direction=DIRECTION_VERTICAL)
return img_a, img_b
Split input image of this ImageProc object into two at <pos> for direction <direction>. Good for splitting
        double pages after <find_pages_separator_line>.
Split input image of this ImageProc object into two at <pos> for direction <direction>. Good for splitting
        double pages after <find_pages_separator_line>.
Split input image of this ImageProc object into two at <pos > for direction <direction > . Good for splitting double pages after <find_pages_separator_line > .
def split_image(self, pos, direction=DIRECTION_VERTICAL):
        """
        Split input image of this ImageProc object into two at <pos> for direction <direction>. Good for splitting
        double pages after <find_pages_separator_line>.
        """
        
        if direction not in (DIRECTION_HORIZONTAL, DIRECTION_VERTICAL):
            raise ValueError("invalid value for 'direction': '%s'" % direction)
        
        img_dim = self.img_w if direction == DIRECTION_VERTICAL else self.img_h
        
        pos = int(round(pos))
        
        if not 0 <= pos <= img_dim:
            raise ValueError("invalid value for 'pos' (must be in [0, %f], i.e. in image space): %d" % (img_dim, pos))
        
        img_w = int(round(self.img_w))
        img_h = int(round(self.img_h))
        
        if direction == DIRECTION_VERTICAL:  # split left and right page
            ya1 = yb1 = 0
            ya2 = yb2 = img_h
            xa1 = 0
            xa2 = pos
            xb1 = pos
            xb2 = img_w
        else:
            xa1 = xb1 = 0
            xa2 = xb2 = img_w
            ya1 = 0
            ya2 = pos
            yb1 = pos
            yb2 = img_h
        
        assert 0 <= xa1 <= img_w
        assert 0 <= xa2 <= img_w
        assert 0 <= xb1 <= img_w
        assert 0 <= xb2 <= img_w
        assert 0 <= ya1 <= img_h
        assert 0 <= ya2 <= img_h
        assert 0 <= yb1 <= img_h
        assert 0 <= yb2 <= img_h
        
        # split and return copies
        img_a = self.input_img[ya1:ya2, xa1:xa2].copy()
        img_b = self.input_img[yb1:yb2, xb1:xb2].copy()
        
        return img_a, img_b
def split_image ( self , pos , direction = DIRECTION_VERTICAL ) : if direction not in ( DIRECTION_HORIZONTAL , DIRECTION_VERTICAL ) : raise ValueError ( "invalid value for 'direction': '%s'" % direction ) img_dim = self . img_w if direction == DIRECTION_VERTICAL else self . img_h pos = int ( round ( pos ) ) if not 0 <= pos <= img_dim : raise ValueError ( "invalid value for 'pos' (must be in [0, %f], i.e. in image space): %d" % ( img_dim , pos ) ) img_w = int ( round ( self . img_w ) ) img_h = int ( round ( self . img_h ) ) if direction == DIRECTION_VERTICAL : # split left and right page ya1 = yb1 = 0 ya2 = yb2 = img_h xa1 = 0 xa2 = pos xb1 = pos xb2 = img_w else : xa1 = xb1 = 0 xa2 = xb2 = img_w ya1 = 0 ya2 = pos yb1 = pos yb2 = img_h assert 0 <= xa1 <= img_w assert 0 <= xa2 <= img_w assert 0 <= xb1 <= img_w assert 0 <= xb2 <= img_w assert 0 <= ya1 <= img_h assert 0 <= ya2 <= img_h assert 0 <= yb1 <= img_h assert 0 <= yb2 <= img_h # split and return copies img_a = self . input_img [ ya1 : ya2 , xa1 : xa2 ] . copy ( ) img_b = self . input_img [ yb1 : yb2 , xb1 : xb2 ] . copy ( ) return img_a , img_b