Extracting a reflection to overlay a banner

Discuss digital image processing techniques and algorithms. We encourage its application to ImageMagick but you can discuss any software solutions here.
Locked
michael.huber.1841
Posts: 6
Joined: 2015-09-03T07:59:10-07:00
Authentication code: 1151

Extracting a reflection to overlay a banner

Post by michael.huber.1841 »

I have some real problems to extract a reflection from a given image. My goal is to overlay a banner with a solid color but keep the reflection intact. So my idea was to extract the reflection first to be able to overlay the reflection over the banner afterwards. As a result I want the image to look as realistic as possbile.

To reduce the problem, I created a minimalistic example with a car. As you can see, there are white reflections on the car.

Image

To illustrate my problem I overlayed a banner in pure solid white color that obviously destroys the reflection.

Image

So my goal is to have the reflection from the base-layer on top of the white banner. I already put a lot of effort into this problem without a perfect solution:

1) First I tried some different blend modes with the banner-layer. This approach doesn't work because the pure white of the banner (rgb 255,255,255) is almost the brightest color in the rgb-colorspace-model and adding color to white results in white. A possible solution should work with other solid colors too. For example the blend-mode "screen" (looks good with colors, but white doesn't work at all).

Image
Image

To make things as easy as possbile I already created the banner in different colors.

http://www.imageupload.co.uk/images/2015/09/10/cyan.png
http://www.imageupload.co.uk/images/201 ... agenta.png
http://www.imageupload.co.uk/images/201 ... /black.png
http://www.imageupload.co.uk/images/201 ... yellow.png
http://www.imageupload.co.uk/images/201 ... ec2737.png


2) I tried to extract the reflection to overlay it over the banner afterwards. I transformed all dark pixels to transparent to eliminate the areas that are not part of the reflection. Pure black (rgb 0,0,0) becomes completely transparent, gray-pixels becomes half-transparent and so on... The result:

Image

When overlaying this layer in normal-blend-mode, the result doesn't look very realistic:

Image


Can anybode help me? Maybe with some improvements of my ideas or maybe even with some fresh ideas?

Best,
Michael

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Extracting a reflection to overlay a banner

Post by snibgo »

When you photograph a white banner, the only part that will be pure white in the photograph will be specular highlights.

Windows BAT script:

Code: Select all

convert ^
  BaseCar.png ^
  ( +clone ^
    ( +clone ^
      -colorspace Gray +level-colors #088,#0ff ^
      carBlackBanner.png ^
      -compose CopyOpacity -composite ^
    ) ^
    -compose Over -composite ^
  ) ^
  -compose Lighten -composite ^
  compCar.png
BaseCar.png is your photo of the car. carBlackBanner.png is your black banner.

For a white banner, change the "+level-colors" to #bbb,#fff or similar.
snibgo's IM pages: im.snibgo.com

Locked