18 pixel_format = cvb.PfncFormat.BayerGB8
21 image_source.size, pixel_format), pixel_format
25 image_source.copy(image_format_pair[0])
27 return image_format_pair
30def get_another_representation(
34 converter.destination_format)
38 converter.execute(src_image, dst_image)
43format_value_name_dict = {
47def to_string(pixel_format: int) -> str:
48 return format_value_name_dict[pixel_format]
51def save(image: cvb.Image, path: str) ->
None:
53 print(f
" Saved as: {path}")
56if __name__ ==
'__main__':
57 print(
"As a source, a Bayer pattern image is given.")
58 base_name =
"FruitBowl"
60 src_image_format_pair = get_image(
62 base_name +
"Bayer" + extension))
63 save(src_image_format_pair[0],
64 base_name + to_string(src_image_format_pair[1]) + extension)
66 print(
"As the destination, an RGB format is given.")
67 dst_format = cvb.PfncFormat.RGB8
69 print(
"Create a pixel format converter.")
72 print(
"Convert the source to another.")
73 dst_image = get_another_representation(src_image_format_pair[0], converter)
75 print(
"Saving the converted image as a file.")
76 save(dst_image, base_name + to_string(dst_format) + extension)
The Common Vision Blox image.
Definition: __init__.py:2038
cvb.Image load(str file_name)
Loads an image with the given file name.
Definition: __init__.py:2250
cvb.Image from_pixel_format(cvb.Size2D size, int format)
Creates an uninitialized image with the given parameters.
Definition: __init__.py:2153
str install_path()
Directory Common Vision Blox has been installed to.
Definition: __init__.py:8257