# Separate two identical images that were combined with a horizontal offset

Hello all,

Is there a way using built-in functions to separate images that have been combined into a single image with 50%-50% transparency and a slight offset in the horizontal direction? I think it would be possible to do this by searching horizontally along each row of pixels for similar pixels that map back to a specific location. Once this offset distance is known, I expect the pixels from each individual image could be extracted.

Any thoughts would be appreciated.

-Karl

in general, it’s impossible. blame math.

if you have x = a + b and a value for x, you can’t solve for both a and b given this information.

if you can apply additional assumptions about the original picture content, it might be possible. “might” does not mean “yes”.

Here’s an example of the type of image I’m trying to separate.

I’m thinking that an additional assumption could be the amount of offset between the two images. I don’t know for sure if this would help. What are some other assumptions I could look into?

is this two instances of the same picture?

then you could try something called “deconvolution”.

https://docs.opencv.org/3.4/d1/dfd/tutorial_motion_deblur_filter.html

the point spread function would be two simple dots at some horizontal distance. in your case, the points need to have different weights. I got this result from a weighting of 0.68 + 0.32 (roughly), separation of 40 pixels.

Yes, the images are identical with exception to one being cropped slightly in the horizontal direction.

What’s the best way to apply the weighting to the two points defining the point spread function?

Thanks!

unless you know how the inputs were blended…

manual fiddling is what I did. perhaps something that analyzes the result and adjusts the weighting.