diff --git a/datasets/raise/extract_4_color_channel_images_from_raw.py b/datasets/raise/extract_4_color_channel_images_from_raw.py new file mode 100644 index 0000000..fbe3df4 --- /dev/null +++ b/datasets/raise/extract_4_color_channel_images_from_raw.py @@ -0,0 +1,21 @@ +import numpy as np +import matplotlib.pyplot as plt +from utils import Color, getColorChannel + +IMAGE_FILE_PATH = '../rafael/240424/photos/DSC03294.ARW' +Y_RANGE = 5 +X_RANGE = 25 +ORIGINAL_INTERESTING_POSITION = (5752, 1695) +INTERESTING_POSITION = np.array(ORIGINAL_INTERESTING_POSITION)[::-1] // 2 + +colorChannel = getColorChannel(IMAGE_FILE_PATH, Color.RED) +print(colorChannel.shape) + +def crop(image, interestingPosition, yRange, xRange): + return image[interestingPosition[0] - yRange: interestingPosition[0] + yRange, interestingPosition[1] - xRange: interestingPosition[1] + xRange] + +colorChannel = crop(colorChannel, INTERESTING_POSITION, Y_RANGE, X_RANGE) +colorChannel = colorChannel[INTERESTING_POSITION[0] - Y_RANGE: INTERESTING_POSITION[0] + Y_RANGE, INTERESTING_POSITION[1] - X_RANGE: INTERESTING_POSITION[1] + X_RANGE] +print(colorChannel.shape) +plt.imshow(colorChannel) +plt.show() \ No newline at end of file