src/crop_xray_vector.py
def run_system(img_name, proc_type='inpaint'):
    '''Wraps all functionality for image processing into a single function.
    Arguments:
        img_name: Path to image of interest.
        proc_type: Type of processing to perform.
    Returns:
        new_image: Cropped and processed image.
        all_images: Vector of all images to be used for OCR.
    '''
    img = io.imread(img_name)
    # get image mask
    all_images = get_mask(img)
    # inpaint image or masking out the text
    if proc_type == 'inpaint':
        no_text = cv2.inpaint(img, all_images[0], 3, cv2.INPAINT_NS)
    elif proc_type == 'mask':
        all_images[0] = hide_names_mask(all_images[0])
        all_images[0] = np.array((255 - all_images[0])/255, np.uint8)
        no_text = img.copy()
        no_text[:, :, 0] = np.array(no_text[:, :, 0] * all_images[0], np.uint8)
        no_text[:, :, 1] = np.array(no_text[:, :, 1] * all_images[0], np.uint8)
        no_text[:, :, 2] = np.array(no_text[:, :, 2] * all_images[0], np.uint8)
    # get biggest blob
    new_image = get_extracted_img(no_text)
    yellow_img = get_only_text(all_images[1], img)
    all_images[0] = yellow_img

    return new_image, all_images
Wraps all functionality for image processing into a single function.
    Arguments:
        img_name: Path to image of interest.
        proc_type: Type of processing to perform.
    Returns:
        new_image: Cropped and processed image.
        all_images: Vector of all images to be used for OCR.
    
Wraps all functionality for image processing into a single function.
Wraps all functionality for image processing into a single function .
def run_system(img_name, proc_type='inpaint'):
    img = io.imread(img_name)
    all_images = get_mask(img)
    if proc_type == 'inpaint':
        no_text = cv2.inpaint(img, all_images[0], 3, cv2.INPAINT_NS)
    elif proc_type == 'mask':
        all_images[0] = hide_names_mask(all_images[0])
        all_images[0] = np.array((255 - all_images[0])/255, np.uint8)
        no_text = img.copy()
        no_text[:, :, 0] = np.array(no_text[:, :, 0] * all_images[0], np.uint8)
        no_text[:, :, 1] = np.array(no_text[:, :, 1] * all_images[0], np.uint8)
        no_text[:, :, 2] = np.array(no_text[:, :, 2] * all_images[0], np.uint8)
    new_image = get_extracted_img(no_text)
    yellow_img = get_only_text(all_images[1], img)
    all_images[0] = yellow_img
    return new_image, all_images
def run_system ( img_name , proc_type = 'inpaint' ) : img = io . imread ( img_name ) all_images = get_mask ( img ) if proc_type == 'inpaint' : no_text = cv2 . inpaint ( img , all_images [ 0 ] , 3 , cv2 . INPAINT_NS ) elif proc_type == 'mask' : all_images [ 0 ] = hide_names_mask ( all_images [ 0 ] ) all_images [ 0 ] = np . array ( ( 255 - all_images [ 0 ] ) / 255 , np . uint8 ) no_text = img . copy ( ) no_text [ : , : , 0 ] = np . array ( no_text [ : , : , 0 ] * all_images [ 0 ] , np . uint8 ) no_text [ : , : , 1 ] = np . array ( no_text [ : , : , 1 ] * all_images [ 0 ] , np . uint8 ) no_text [ : , : , 2 ] = np . array ( no_text [ : , : , 2 ] * all_images [ 0 ] , np . uint8 ) new_image = get_extracted_img ( no_text ) yellow_img = get_only_text ( all_images [ 1 ] , img ) all_images [ 0 ] = yellow_img return new_image , all_images
Wraps all functionality for image processing into a single function.
Wraps all functionality for image processing into a single function .
'''Wraps all functionality for image processing into a single function.
    Arguments:
        img_name: Path to image of interest.
        proc_type: Type of processing to perform.
    Returns:
        new_image: Cropped and processed image.
        all_images: Vector of all images to be used for OCR.
    ''' # get image mask # inpaint image or masking out the text # get biggest blob
Cropped and processed image.
all_images: Vector of all images to be used for OCR.
Cropped and processed image . all_images : Vector of all images to be used for OCR .
new_image
img_name
Path to image of interest.
Path to image of interest .
proc_type
Type of processing to perform.
Type of processing to perform .