Page 1 of 1

Removing Background (blue screen) and insert background image

Posted: 2016-01-20T10:51:25-07:00
by Mottografie
Hi all,

I use digicamcontrol 2.0.6.0. This program has a auto export plugin feature which gives me the ability to run MagickScript code. Unfortunately I don't know how to convert Syntax from ImageMagick to the XML format.

Here are 2 things I would like to try:
http://www.imagemagick.org/Usage/masking/#known_bgnd

See the paragraph: removing a known background.

Second is:
http://snippets.aktagon.com/snippets/55 ... magemagick

These are 2 methods I would like to use.

This method does not return good results (it was predefined in digicamcontrol):

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<msl xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MagickScript.xsd">
  <read>
    <colorFuzz value="100"/>
    <transparentChroma colorHigh="#FFFFFF" colorLow="#BFBFCF"/>
    <backgroundColor value="#FFFFFF"/>
    <alpha option="Background"/>
    <brightnessContrast brightness="5" contrast="10"/>
  </read>
</msl>
My photo backdrop is blue, so I changed cologHigh and colorLow to different values to test, but I never had good results. And I don't know how to add a background image after removal of the blue screen.

Any help would be highly appreciated. I am lost somehow :)

All the best,
Matthias

Re: Removing Background (blue screen) and insert background image

Posted: 2016-01-20T12:01:34-07:00
by snibgo
If you upload an image with blue background, and a replacement background image, we can probably show you the command line required. I don't know the XML format.

You can upload to somewhere like dropbox.com and paste the URLs here.

Re: Removing Background (blue screen) and insert background image

Posted: 2016-01-20T12:17:03-07:00
by dlemstra
The xml format is the script language of Magick.NET.

Re: Removing Background (blue screen) and insert background image

Posted: 2016-01-20T12:20:55-07:00
by snibgo
Yes, indeed. I don't know it, in the same sense that I don't know the Perl interface or many others.

Re: Removing Background (blue screen) and insert background image

Posted: 2016-01-20T12:26:03-07:00
by Mottografie
Hi snibgo!

Thanks for your quick reply.

How can I run a command line? As far as I figured it out I can only use the XML interface... :-( The image should stay in DigiCamControl.

At the moment the process is: Camera is fired with remote shutter release. Camera takes a picture of a person in front of a blue background. Digicamcontrol processes the image, and after processing it shows the finished image for 8 seconds, preview closes.

Process starts again when the next person takes a picture... and so on (Photo Booth)

At the stage where digicamcontrol processes the picture I have the possibility to use MagickScript (so called "Auto Export Plugin -> Script". At the stage where digicamcontrol shows the picture the background should be changed yet.

Now the question is: Do you know if I can run a commandline via XML interface?

Sorry, I'm new to this. I have some (very basic) programming skills, but not with ImageMagick or MagickScript :-(

Thanks and regards,
Matthias

Before I forget:
Blue backdrop:
https://dl.dropboxusercontent.com/u/257 ... ckdrop.jpg

pic with people in front of blue backdrop:
https://dl.dropboxusercontent.com/u/257 ... th_pic.jpg

Example for background file to place in pic instead (it will change with every event):
https://dl.dropboxusercontent.com/u/257 ... 6x2304.jpg

Re: Removing Background (blue screen) and insert background image

Posted: 2016-01-20T12:59:29-07:00
by snibgo
Ideally, you can use images that haven't been through lossy JPEG compression.

The blue background can be removed, either by finding where the "with people" image is the same as "without people", or more crudely by making certain shades of blue transparent. Further refinement might be needed to prevent blue clothing becoming transparent.

The people cast a shadow on the blue background. What do you want to do with this?

Re: Removing Background (blue screen) and insert background image

Posted: 2016-01-20T13:02:03-07:00
by Mottografie
I don't care about the shadow. Guess it will be difficult to get the blue border out of the shadows... If it would be gone I would not care.

If blue cloths disappear as well it would be not perfect, but if i face too many problems I could also switch to green background.

Re: Removing Background (blue screen) and insert background image

Posted: 2016-01-20T13:23:03-07:00
by snibgo
This does the basic job. Windows BAT syntax.

Code: Select all

set NO_PPL=backdrop.jpg
set PPL=photo_booth_pic.jpg
set NEW_BACK=nightime-surf-3456x2304.jpg

%IM%convert ^
  %PPL% ^
  ( +clone ^
  %NO_PPL% ^
  -compose Difference -composite ^
  -grayscale RMS ^
  -level 10%%,15%% ^
  -negate ^
  ) ^
  %NEW_BACK% ^
  +swap ^
  -compose Over -composite ^
  out.png
The shadow remains the same colour as in photo_booth_pic.jpg. Removing it is difficult, as it is the same colour as the woman's clothing. The image would need to be segmented.