How to use ImageMagick to substract a image from another? - image-processing

I have this two images :
(source: free.fr)
(source: free.fr)
How can I use imagemagick to remove the background (second picture) from the first one ?
Cheers,
Rémy
Here I made you a final but simple example :
Transparent Overlay http://noosphere.ionyse.com/transparent_example/transparent_difference.png
Background http://noosphere.ionyse.com/transparent_example/background.png
Example 1 http://noosphere.ionyse.com/transparent_example/background-example.png
Example 2 http://noosphere.ionyse.com/transparent_example/background-example2.png
Here you see that anywhere I put the transparent overlay on the background I get the perfect match using the opacity of the overlay PNG.
I would like to be able to calculate this overlay image. Do you think it is possible using ImageMagick ?

This is explained over here How to save the DIFFERENCES between two images ?.
Another useful link: http://www.imagemagick.org/Usage/compare/#difference

Related

How to dim/blur everything outside given rect in iOS?

I'm currently developing an iOS app that is using OCR.
Currently I'm using AVFoundation to preview the video from the camera (using Apples sample AVCam).
For a good user experience I want to lay out a rectangle in the preview layer. The image inside this rectangle will be the image parsed by the OCR engine. My problem is that I also would like to "dim" everything outside this rectangle and I'm currently out of ideas how to solve this. Does anybody know how to do this?
Edit
This is what I would like to accomplish (image taken from the app Horizon):
http://i.imgur.com/MuuJNS9.png
You can use two black images covering the top and bottom areas that you want to "dim", set the alpha of those images to a certain value, like 0.5.
Why not add a subview that covers the entire screen and set the background color to a semi transparent gray - your gray overlay?
And then add the image parsed by the OCR engine add a subview of this grayoverlay int the center of it

How to modify the image color after two images

I have two face images. I can map one face images onto the other one.
However, the generated image is not good. How can I refined the color and
light on the face region ?
You could try doing a histogram match to the original face. You wont be able to recreate the shadow effects that way, but you might be able to match the skin tone.
Hope this links will be helpful:
1) Image recoloring
2) Face relighting

how can I make a custom overlay filter?

I have a viewController with a UIImageView. The imageView is to be loaded with a different random picture from a given array when the viewController is displayed. Above the UIImageView I would like to implement a filter similar to one I found in photoshop but with my own custom modification for a clear window to the image below. Basically, what I am looking to do is display a random image behind a blurred filter but I would like a part of the blur filter to have a custom shaped window to the image below it where the image can be seen clearly. The rest of the image would still be blurred out. I have read apples documentation for applying filters to images but none of them suit my needs. Pretty new to development and haven't written any code for this feature yet. I'm more looking to see if it can be done and if so, could you point me in the direction of where I can research to find the answers I'm looking for? cheers!
I would recommend that you take the input image, pass it through a CIGaussianBlur, then I'd draw the image applying an image mask (using CIBlendWithMask or a CGPath.)

Crop center of the UIImage

At present, I am working on core graphics based iPhone application.
I have tried to crop center of the image but i can't do that.
Here,I have an images named (fig a) as shown below, and i need to crop it on center of this image.
So, the resultant image should look like (fig b).
How can i do this?.
fig a :
fig b :
Answer :
I think what you want is : iOS UIImage clip to paths. Rob has described how to remove selected part of UIImage using UIBezierPath. You can customize it for yourself to get what you want.
You can also use some View as a Mask above that Central Part.
Take a look on BJIMageCropper
Hope This will helps you

overlaying images when displaying in OpenCV

I have two images that I want to display on top of each other. one image a single channel image and the second image is a RGB image but with most of the area being transparent.
How these two images are generated in different functions. I know to just display these on top of each other, i can use the same window name when calling cvShowImage() but this doesn't work when they are drawn from different functions. When trying this, I used cvCvtcolor() to convert he binary image from single channel to RGB and then displaying the second image from another function. But this didn't work. Both images are same dimension, depth and number of channels (after conversion).
I want to avoid passing in one image into the second function and then draw them. So I'm looking for a quick dirty trick to display these two images overlapped.
Thank you
EDIT:
I don't think that's possible. You'll have to create a new image or modify an existing one. Here's an article that shows how to do this: Transparent image overlays in OpenCV
There is no way to "overlay" images. cvShowImage() displays a single image from memory. You'll need to blend/combine them together. There are several ways to do this.
You can copy one into 1 or 2 channels of the other, you can use logical operations like AND, OR or XOR, you can use arithmetic operations like Add, Multiply and MultiplyScale (these operations will saturate values larger than 255). All these can also be done with an optional mask image like your blob image.
Naturally, you may want to do this into a third buffer so as not to overwrite your originals.
Apparently now it can be done using OpenCV 2.1 version
http://opencv.willowgarage.com/documentation/cpp/highgui_qt_new_functions.html#cv-displayoverlay

Resources