Composite Transformation precision

Moderator: jsachs

Post Reply
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Composite Transformation precision

Post by Marpel »

This may be one of those "Of course, duh" moments on my part, however, here goes -

I am wondering if there is an easy way to align composite parts of two images using 1 point shift, with extreme precision (by zooming in up to 7 or 8:1 and moving the object a pixel at a time). To explain: I often, with the use of a mask, add an object from one image to another, while retaining the position of the alignment points, so I may then change the tone/colour of the added object (sometimes using a blend mode) after the initial composite. This works perfectly well if the alignment points remain within the Input image, but become impossible if the alignment point falls outside the boundaries of the input image. I can precisely place an object a single time by moving the alignment point in the Overlay image to where the object is located, then precisely moving the alignment point in the Input image by using extreme zoom. However, because the alignment points in both the Overlay and Input images revert back to the lower left corner, it is extremely difficult to align them again in the the exact same location.

To better explain, I have an image in which there are a group of birds flying just above the surface of the water and casting a shadow on the waters surface just below the birds, I am trying to place the birds and shadows in another image, then changing the tone/hue (through blend modes) to the birds/shadows a couple times to compare the revised tones/hues to see which one is best. I first place both then remove the shadow or bird portion of the mask and change one or the other. However, if I leave the alignment points at the default lower left point of each image, and the alignment point of the Overlay image falls outside the Input image, it is difficult to zoom in to any appreciable degree because the alignment point disappears from view. Even if I shrink the Input image considerably and move the boundaries to leave a largish white area around that image, my screen (21 inch) won'y allow me to zoom in to beyond about 1:5 (not 5:1) maximum. This is insufficient to properly align the object again, because the masked object jumps too great when I even move the cursor a minor amount.

Any thoughts/suggestions??

Hopefully my explanation is sufficient and clear. If not, let me know and I'll take another run at it.

Thanks,

Marv
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Composite Transformation precision

Post by Marpel »

Sorry, I should have added this part in the initial post, but just thought of it after I pressed Submit.

Often, in doing the compositing, rather than trying to build a second mask of the object from the composted result, especially if the initial mask has some radius'd blur and the "new" object blends closely in tone/colour with the Input image, I often do the initial composite, then composite the mask of the object itself, that I initially used, onto an 8 bit black image using "Lighten", so the resulting mask and revised composite image line up exactly for the added object. I can then change the tone/colour of the object at will by using this new mask.

Hope this helps to clarify.

Marv
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Composite Transformation precision

Post by den »

The following is an example workflow I will use to precision Composite-Blend two overlapping images with an "1-point (shift)" Alignment...

1) Paint a small 0.0 Transparant/0.0 Softness "spot" that will be the common point of Alignment on each of the two overlapping images, Left and Right...
precision_alignment_1.jpg
precision_alignment_1.jpg (86.55 KiB) Viewed 5299 times
2) Select the Right image and add borders sufficient to contain the Composite-Blend overlapped image... ...This image becomes the Input image of the Composite-Blend transform.
3) Open Composite-Blend with the Input the resulting 2) image and the Overlay image the Left overlap image... ...Select "1-point (shift)" Alignment and initially set the Overlay Amount = 50%... ...move the "1" alignment point in the Left and resulting 2) image to a common pixel of the Paint "spot"... ...move one or the other until there is no apparant shift in the Preview when the Overlay Amount is 100 or 0%... ...click OK with the Overlay Amount = 100...
precision_alignment_2.jpg
precision_alignment_2.jpg (76.66 KiB) Viewed 5308 times
precision_alignment_3.jpg
precision_alignment_3.jpg (87.41 KiB) Viewed 5299 times
4) Trim excess borders and clone out the Paint "spot".

"1-point (shift)" Alignment is a simplified case for illustration but I have been successful doing a similar process with two overlapping images and "2-point (shift/rotate/scale) Alignment, i.e. two Paint alignment "spots"... ...although if rotation and scaling occurs, the Overlay image portion may soften and require a slight amount of sharpening to match the Input image portion if it essentially remained unchanged.

Perhaps Jonathan/Kiril could comment on the use of Composite-Blend Alignment "Refine"...

...den...
jsachs
Posts: 4212
Joined: January 22nd, 2009, 11:03 pm

Re: Composite Transformation precision

Post by jsachs »

Placing a mark on the image is ingenious. As I mentioned in an earlier post, I changed Composite to remember the locations of alignment points when used with images of the same size which should solve this problem if I understand it correctly. We hope to release a new maintenance release with this feature soon.
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Composite Transformation precision

Post by Marpel »

Den,

Thanks for your reply. However, if I am reading it correctly, I don't believe it addresses my particular situation (and I admit that may be due to my initial explanation being less than adequate). I believe you are describing how to blend two overlapping images (as if taken for a panorama). I have used the 50% blend opacity trick but use an object already shared in each image, such as that small rock in the water. My question on your technique is, how do you ensure the white spot is placed precisely in the exact same location in each image, so it is not out by a few, or more, pixels and how is it different/better than using the rock in your example?

As to my conundrum, perhaps a quick hypothetical example: I have two photos, one (Overlay image) of which has an object, lets say a flower, in the upper right area. I wish, by using a mask of the flower, to place that flower in the lower left area of the second (Input) image, and at the same time (or directly after actually) wish to place the exact same flower mask into a second mask image so it aligns precisely with the newly placed flower. I can easily move the alignment point in the Overlay image from its default lower left corner to the flower, then move the Input alignment point to precisely place the flower (down to an exact pixel if necessary by zooming in on both the Input image and Preview image). However, once this is done, the alignment points for the next operation revert to their lower left corner.

However, if I do not move the alignment point in the Overlay image, the same alignment of two images can be repeated again and again. But that only works if the alignment point in the Input image is moved around inside the image. In my example, if I did not first move the Overlay image alignment point, the corresponding alignment location in the Input image would move well out of the image area and disappear, especially if needing to zoom in considerably for a precise placement. I wish to use the method where both alignment points start and remain in the lower left corner of both images because, in my example, I can then duplicate the exact same movement, but with the flower mask and a new all black 8 bit image, using "Lighten" blend mode. By doing that, I have exactly placed the flower mask to the flower's new location in the lower left area in the resulting image and can use that new mask to alter hue/tone of the flower if need be, or protect the flower and make adjustments to the rest of the new image.

This problem only occurs (which seems to be quite frequent with me) when an object in the Overlay image has to be placed farther to the left and/or down in the Input image so that it "forces" the lower left alignment point out of the Input image area and I then can't zoom in for any exact placement.

Marv
den
Posts: 856
Joined: April 25th, 2009, 6:33 pm
What is the make/model of your primary camera?: Canon EOS-350D/Fuji X100T
Location: Birch Bay near Blaine, WA USA

Re: Composite Transformation precision

Post by den »

Marpel...

I like to use "spots" because it is easier for me to see/locate where the Alignment points need to be/are and then be able to track micro-shift Alignment point shifts a pixel or partial pixel at a time...

For poistioning Object masks in Composite Base images, try...

1) Instead of a Composite-Blend OK when you place an Object (Overlay) with a mask in a Base (Input)... ...do an Apply...
Object_Mask_1.jpg
Object_Mask_1.jpg (47.69 KiB) Viewed 5188 times
2) then change the Overlay image to its mask image with Amount = 100 without making any changes to Alignment... ...do an OK... ...you will have an image that looks similar to:
Object_Mask_2.jpg
Object_Mask_2.jpg (41.66 KiB) Viewed 5184 times
3) create an 8 bit BW image from the resulting 2) image... ...this image can be used as a mask and is precisely aligned so that changes are only made to the imported Object of the resulting 1) image even if Alignment points are outside the Base image dimensions...
Object_Mask_3.jpg
Object_Mask_3.jpg (59.54 KiB) Viewed 5187 times
...den...
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Composite Transformation precision

Post by Marpel »

Den,

Thanks for the updated information. I have tried this method and it works perfectly for what I was looking for.

Something that came to me as a result of your demonstration, it appears in your example that your Overlay image is much smaller than the Input image, making it easy to maneuver within the Input image. I, however, was trying to maneuver an Overlay image which was the same size as, or larger than, the Input image and found the alignment point disappearing outside the window of the Input image. As I was reading your example, the "obvious" thought that came to me was, I just needed to crop the area of the Overlay image (and its respective mask) to a size small enough to be able to move around while keeping the alignment point within the window frame.

Although I have used the Composite Transform with masks a gazillion times over the years, I had never realized that the "Apply" button could be used in the manner you described for quickly and easily making a mask for the newly positioned object. Great idea and one that I will be routinely using from now on.

Thanks again,

Marv
Post Reply