Subtract an image to the other

This commit is contained in:
Benjamin Loison 2024-05-23 14:53:16 +02:00
parent 6ad8483990
commit 2144babd8f
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -14,16 +14,19 @@ def getImageFilePath(imageIndex):
def getImageColorChannel(imageIndex, color):
imageFilePath = getImageFilePath(imageIndex)
return getColorChannel(imageFilePath, color)
return getColorChannel(imageFilePath, color).astype(np.int32)
colorChannel = getImageColorChannel(IMAGE_INDEX, COLOR)
print(colorChannel.shape)
firstColorChannel = getImageColorChannel(IMAGE_INDEX, COLOR)
secondColorChannel = getImageColorChannel(IMAGE_INDEX + 1, COLOR)
differenceColorChannel = firstColorChannel - secondColorChannel
print(differenceColorChannel.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)
colorChannel = crop(colorChannel, INTERESTING_POSITION, Y_RANGE, X_RANGE)
print(colorChannel.shape)
plt.imshow(colorChannel)
colorChannelToDisplay = differenceColorChannel
colorChannelToDisplay = crop(colorChannelToDisplay, INTERESTING_POSITION, Y_RANGE, X_RANGE)
print(colorChannelToDisplay.shape)
plt.imshow(colorChannelToDisplay)
plt.show()