picture hidden into picture

zanroversi's picture

Hello !

I've heard about a simple and curious method to hide an image into an other. The attached composition contains two core image filters to encode and decode images according to this technic.

Basically, we replace the 4 least significant bits of the "fake image" by the 4 most significant bits of the image to be encrypted.

Hidden image is obtained by reversing the process.

You can "encrypt" text-image by replacing only the least significant bit (2nd attached comp.)

It's almost my first core image filter and I'm not sure at all it is the best way to code this operation. Moreover, I have some strange pure-green points here and there that I can't explain.

Any comment or advice to improves this is welcome ! greetings.

PreviewAttachmentSize
pictureInPictureEncryption.qtz1009.09 KB
textInPictureEncryption.qtz797.27 KB

franz's picture
Re: picture hidden into picture

haha ! now we're talking ! awesome, i love it !

zanroversi's picture
Re: picture hidden into picture

Hello and thanks, Franz !

Did you notice that binary operators "&" and "|" and modulo "%" do not work in core image filter code ? I don't understand why and how I can use them instead of this ugly replacement formula.

...

One other tiny question... Could somebody explain to me my own code ? :-)

for example, what does this mean :

vec4 poidsFort = sample(image1, samplerCoord(image1));
// I suppose I see what is going on here (vec4 stores r,g,b,a datas of the current pixel being processed by kernel ?)

float poidsFortValue = poidsFort * 255.0;
//hu? is this a kind of implicit data type conversion ? But how does this filter know about channels informations after that ?

Thanks by advance !

franz's picture
Re: picture hidden into picture

sorry mate, i can't help, as i have an aversion for core image... And there's nothing like a full and comprehensive reference around (why ?)

alternatively, here's what apple says about sampler: "A few words about samplers and sample coordinate space: The samplers you set up to provide samples to kernels that you write can contain any values necessary for the filter calculation, not just color values. For example, a sampler can provide values from numerical tables, vector fields in which the x and y values are represented by the red and green components respectively, height fields, and so forth. This means that you can store any vector-value field with up to four components in a sampler. To avoid confusion on the part of the filter client, it’s best to provide documentation that states when a vector is not used for color. When you use a sampler that doesn’t provide color, you can bypass the color correction that Core Image usually performs by providing a nil colorspace, blah blah blah"

cybero's picture
Re: picture hidden into picture

Unsupported Items in Core Image - there's a few such as Expression operators:  % << >> | & ^ || && ^^ ~  .

Use GLSL instead?

zanroversi's picture
Re: picture hidden into picture

hello,

I found this document : https://developer.apple.com/library/mac/#documentation/graphicsimaging/R... ... and some interesting forum topics here...

GLSL is an unknown world to me yet, I will try to learn a little about it, thanks.

Just for fun, I've tested the composition above with video input, it works at 15 fps. You can barely see some shadow movements in the "fake image".

Any idea about the green dots ? Values in vec4 are in the (0...1) range isn't it ?

have a good day !

dust's picture
Re: picture hidden into picture

yeah this is pretty awesome. had the same idea a while back to do something like this with video.

jersmi's picture
Re: picture hidden into picture

wtf? are you working on your spy skills? :)

pretty interesting... i did notice that if you use the darken blend mode with image+itself, it fixes the green dots.

zanroversi's picture
Re: picture hidden into picture

Hello,

Thanks for the darken blend mode trick !

But there must be something wrong in the core image filter code. Green dots shows even if I don't try yo mix the images (just translate vec4 data to bits values and reconstruct a single image).

And what about 16-bits / per channel images ? We should be able to get two nice 8-bits images. I have to try this...

have a nice sunday !