So I want to encode a secret image in another b&w image. This image must have the same size as the original image that we are trying to hide the secret image in, so we have a correspondence of pixels for the two images.
To encode the secret image:
If a pixel in the secret image is white (so, with RGB values of [255, 255, 255]), add 1 to the blue component (last number).
Otherwise, leave the blue component untouched.
So basically the coloured image is hidden in the b&w image by using an altered blue component from the original image.
Decoding the b&w image is done through reversal of the encoding process.
So lets say I currently have the following list of pixels:
P = [[0, 0, 0], [255, 255, 255], [255, 184, 254], [255, 0, 254]]
Assuming that the width and height of both images are the same.
How would I check if any 'pixel' in P is equal to 255? So this means that all 3 numbers in the 'pixel' must be equal to 255.
You can use
for idx,lst in enumerate(P):
if lst==[255,255,255]:
print(idx,lst)
or
enc_P=[]
for lst in P:
if lst==[255,255,255]:
print(lst)
enc_P.append(lst)