Blocks.ImageRead

 1import cv2
 2import numpy as np
 3
 4def main(inputs, outputs, parameters, synchronise):
 5    '''
 6    ## Reads an Image from a Specified Path
 7    This box reads an image from a given file path. The path to be specified is written in the parameter
 8    `ImagePath`.\n
 9    It is read through the `cv2.imread()` function and shared through the `share_image()` function.
10    
11    **Inputs**: None
12
13    **Outputs**: BGR Image
14
15    **Parameters**: ImagePath
16    '''
17    path = parameters.read_string("ImagePath")
18    image = cv2.imread(path)
19    auto_enable = False
20    try:
21        enable = inputs.read_number("Enable")
22    except Exception:
23        auto_enable = True
24
25    while(auto_enable or inputs.read_number('Enable')):
26        outputs.share_image('Out', image)
27        synchronise()
28
29
30        
def main(inputs, outputs, parameters, synchronise)
 5def main(inputs, outputs, parameters, synchronise):
 6    '''
 7    ## Reads an Image from a Specified Path
 8    This box reads an image from a given file path. The path to be specified is written in the parameter
 9    `ImagePath`.\n
10    It is read through the `cv2.imread()` function and shared through the `share_image()` function.
11    
12    **Inputs**: None
13
14    **Outputs**: BGR Image
15
16    **Parameters**: ImagePath
17    '''
18    path = parameters.read_string("ImagePath")
19    image = cv2.imread(path)
20    auto_enable = False
21    try:
22        enable = inputs.read_number("Enable")
23    except Exception:
24        auto_enable = True
25
26    while(auto_enable or inputs.read_number('Enable')):
27        outputs.share_image('Out', image)
28        synchronise()

Block Description

Reads an Image from a Specified Path

This box reads an image from a given file path. The path to be specified is written in the parameter ImagePath.

It is read through the cv2.imread() function and shared through the share_image() function.

Inputs: None

Outputs: BGR Image

Parameters: ImagePath