Before optimizing extract_4_color_channel_images_from_raw.py
This commit is contained in:
parent
2144babd8f
commit
a5cf1083bd
@ -1,8 +1,9 @@
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from utils import Color, getColorChannel
|
||||
from tqdm import tqdm
|
||||
|
||||
IMAGE_INDEX = 3294
|
||||
IMAGE_INDEX_RANGE = range(3294, 3553)
|
||||
Y_RANGE = 5
|
||||
X_RANGE = 25
|
||||
ORIGINAL_INTERESTING_POSITION = [5752, 1695][::-1]
|
||||
@ -16,16 +17,18 @@ def getImageColorChannel(imageIndex, color):
|
||||
imageFilePath = getImageFilePath(imageIndex)
|
||||
return getColorChannel(imageFilePath, color).astype(np.int32)
|
||||
|
||||
firstColorChannel = getImageColorChannel(IMAGE_INDEX, COLOR)
|
||||
secondColorChannel = getImageColorChannel(IMAGE_INDEX + 1, COLOR)
|
||||
differenceColorChannel = firstColorChannel - secondColorChannel
|
||||
print(differenceColorChannel.shape)
|
||||
# Could leverage crop already here.
|
||||
colorChannels = [getImageColorChannel(imageIndex, COLOR) for imageIndex in tqdm(IMAGE_INDEX_RANGE)]
|
||||
meanColorChannels = np.mean(colorChannels, axis = 0)
|
||||
estimatedPrnus = [colorChannel - meanColorChannels for colorChannel in tqdm(colorChannels)]
|
||||
estimatedPrnu = np.mean(estimatedPrnus, axis = 0)
|
||||
print(estimatedPrnu.shape)
|
||||
|
||||
def crop(image, interestingPosition, yRange, xRange):
|
||||
return image[interestingPosition[0] - yRange: interestingPosition[0] + yRange, interestingPosition[1] - xRange: interestingPosition[1] + xRange]
|
||||
|
||||
#colorChannel = crop(multipleColorsImage, ORIGINAL_INTERESTING_POSITION, Y_RANGE, X_RANGE)
|
||||
colorChannelToDisplay = differenceColorChannel
|
||||
colorChannelToDisplay = estimatedPrnu
|
||||
colorChannelToDisplay = crop(colorChannelToDisplay, INTERESTING_POSITION, Y_RANGE, X_RANGE)
|
||||
print(colorChannelToDisplay.shape)
|
||||
plt.imshow(colorChannelToDisplay)
|
||||
|
Loading…
Reference in New Issue
Block a user