import inspect
import os
import cvb
pixel_format = cvb.PfncFormat.BayerGB8
image_source.size, pixel_format), pixel_format
image_source.copy(image_format_pair[0])
return image_format_pair
def get_another_representation(
converter.destination_format)
converter.execute(src_image, dst_image)
return dst_image
format_value_name_dict = {
def to_string(pixel_format: int) -> str:
return format_value_name_dict[pixel_format]
def save(image: cvb.Image, path: str) -> None:
image.save(path)
print(f" Saved as: {path}")
if __name__ == '__main__':
print("As a source, a Bayer pattern image is given.")
base_name = "FruitBowl"
extension = ".bmp"
src_image_format_pair = get_image(
base_name + "Bayer" + extension))
save(src_image_format_pair[0],
base_name + to_string(src_image_format_pair[1]) + extension)
print("As the destination, an RGB format is given.")
dst_format = cvb.PfncFormat.RGB8
print("Create a pixel format converter.")
print("Convert the source to another.")
dst_image = get_another_representation(src_image_format_pair[0], converter)
print("Saving the converted image as a file.")
save(dst_image, base_name + to_string(dst_format) + extension)
cvb.Image load(str file_name)
cvb.Image from_pixel_format(cvb.Size2D size, int format)