20 pixel_format = cvb.PfncFormat.BayerGB8
23 image_source.size, pixel_format), pixel_format
27 image_source.copy(image_format_pair[0])
29 return image_format_pair
32def get_another_representation(
36 converter.destination_format)
40 converter.execute(src_image, dst_image)
45format_value_name_dict = {
49def to_string(pixel_format: int) -> str:
50 return format_value_name_dict[pixel_format]
53def save(image: cvb.Image, path: str) ->
None:
55 print(f
" Saved as: {path}")
58if __name__ ==
'__main__':
59 print(
"As a source, a Bayer pattern image is given.")
60 base_name =
"FruitBowl"
62 src_image_format_pair = get_image(
64 base_name +
"Bayer" + extension))
65 save(src_image_format_pair[0],
66 base_name + to_string(src_image_format_pair[1]) + extension)
68 print(
"As the destination, an RGB format is given.")
69 dst_format = cvb.PfncFormat.RGB8
71 print(
"Create a pixel format converter.")
74 print(
"Convert the source to another.")
75 dst_image = get_another_representation(src_image_format_pair[0], converter)
77 print(
"Saving the converted image as a file.")
78 save(dst_image, base_name + to_string(dst_format) + extension)
The Common Vision Blox image.
Definition: __init__.py:2097
cvb.Image load(str file_name)
Loads an image with the given file name.
Definition: __init__.py:2309
cvb.Image from_pixel_format(cvb.Size2D size, int format)
Creates an uninitialized image with the given parameters.
Definition: __init__.py:2212
str install_path()
Directory Common Vision Blox has been installed to.
Definition: __init__.py:8318