Warp Transform

Moderator: jsachs

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: Warp Transform

Post by Marpel »

Jonathan,

Sorry to be a pest on this one, but I just can't seem to get the multi-point composite to work. Just for info, my input image is 7360 x 4912 and overlay image and mask are 6506 x 2954. The item I wish to composite into the input image is in the lower section of the overlay image/mask but is a bit higher than the log in the input image (and a bit curved) if I were to use a straight one point composite, so I have to lower the overlay image a tiny amount and move it to the right by about 500 pixels.

For accuracy sake, I started by making a black mask (size of input image) with a white rectangle (size of the overlay image) in the lower left corner (straight composite, no points) and using that mask, darkened the rest of the input image while leaving the lower left area untouched, just so I could tell what the size of the overlay image would be.

I first moved the overlay image in multi-point with just the three corner points, so the masked shadow was within a small distance from the log.

I then added about ten points along the lower edge of the log and by zooming in to the input, overlay and preview image, began moving the points to get the shadow to line up. Ny the time I had moved all the points along the "line" each corresponding point was within a few pixels from the perfect location.

However, the result, again, was a bizarre resultant image with the shadow skewed all over the place.

I saved the resultant image and, hopefully can include it within this post (haven't tried yet). Perhaps you can take a look and tell me what I am doing wrong. As mentioned, each corresponding point is lined up extremely close with no points off somewhere else in the image. I started at one end and lined each one up then moved down the line, making sure all points were accounted for.

Again, thanks in advance. I've been working on, and been frustrated by, this all day and, barring a solution to this, I may have to take up drinking again.

Marv
Attachments
test.jpg
test.jpg (37.28 KiB) Viewed 4081 times
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Warp Transform

Post by jsachs »

Hard to tell from just the end result - can you post the original image and give me an idea of what you effect you are trying to achieve again?
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: Warp Transform

Post by Marpel »

Jonathan,

Happy to do as requested, however, I may have stumbled on the issue. Perhaps you can try this and see if you run into the same thing. If you do not, I will do as requested.

I generated a 5000 x 5000 white image. Using the pen tool, I hand-drew a black horizontal line (quite thick and maybe half to 3/4 the page wide) in the middle of the image- with a bit of a bend in it.

I cropped (rectangle) around the line with some space so the cropped image was about 3000 x 2000 (don't think the size is real important).

I flipped that new image upside down and made a mask of the line.

I used multi-point and first did a general "get it close by moving the three corner points.

I began adding further points along the line (Initially I placed a number of thin vertical black lines that crossed the main line, along the main line, so I could use the intersecting points to easier line up the corresponding points from each image), and as I went from left to right along the line I would (in zoom mode) place each corresponding point.

Everything was lining up as expected until I reached the "c" point (3 for the corners, 4,5,6,7,8,9, then a,b etc along the line). As soon as I added the "c" point, the overlay line went crazy and skewed across the page like it shows in the image I attached. When I deleted this point, everything went back to as it should have been. When I added the "c" point again, things went awry.

As I recall, when doing this process initially with the first image, everything also seemed to go well up to a certain point and, although I can't recall specifically if that was when I added the "c" point, I suspect this may have been the cause.

Regards,

Marv
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Warp Transform

Post by jsachs »

What are you using for the alignment method?
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: Warp Transform

Post by Marpel »

Sorry, should have mentioned that in prior posts. The default, Hardy Method.

Marv
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Warp Transform

Post by jsachs »

Again, you need to switch to Gaussian.
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: Warp Transform

Post by Marpel »

Hello Jonathan,

Tried pretty well the exact same thing I tried earlier today, but used the Gaussian Method as suggested. At point "d" the preview showed the skewed result I tried to describe earlier. I deleted "d" and "c" but the result did not change much.

I am attaching the input image as well as the resultant image. The overlay image is an upside down crop of the line and its mask is of that overlay image, so figured it would be of no value to attach those two.

Regards,

Marv
Attachments
test-line.jpg
test-line.jpg (14.25 KiB) Viewed 4021 times
test-line-result.jpg
test-line-result.jpg (27.12 KiB) Viewed 4021 times
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Warp Transform

Post by jsachs »

OK, I think I see what is happening - it has to do with the first three alignment points which are not properly placed when you flip the image upside down. By requiring them to match on in the final image you are forcing the warp to twist the image severely. To avoid this, you need to use Composite twice.

What I suggest is to first register the upside down image with the input image so that the upside down log is placed as close as possible to its final position. Then you can use multi-point alignment to make small adjustments to the log. You can register the upside down image using composite with two point alignment and setting the operation to Register instead of Blend. Once the log is roughly in the right place, a second multi-point composite should work much better.
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: Warp Transform

Post by Marpel »

Sorry for the confusion.

I am attaching three images. The input image will be the water scene/sunset with a dark log (bottom left), which I composited in from another photograph. I wish to lay down a shadow on the near side of this log. To do that, I flipped the original mask (second attached image) of the log (which I used to composite the log) and found a generic greyish image (third attached image) that I will be using as the overlay image and compositing into the water scene/log image (with a soft light or other blend mode).

Initially, I thought I could use the warp transform but ultimately decided to use the Composite Transform, with multi-point mode (which you also suggested early on). I need multi-point because the log shape in the mask and the log in the input image, do not marry up very well so I need to bend the shadow in multiple locations to meet up with the side of the log.

When I did that, I could only get the result shown in the first image I attached to a prior post.

Because there was some confusion, I thought I would do up a quick example with the hand-drawn black line on a white background and use that line as a simple mask. As I described in an earlier post, things went fine until I reached point "c" then the image went askew, so I posted that result in the next post to show you what I meant. It seemed that whenever I tried to place a point beyond the letter "c" (in both examples), the masked in object went crazy. And at your suggestion, I used the Gaussian Method. That's why I asked you to try and duplicate the line drawn example, to see if there was a bug somewhere or I was just doing something wrong and the fault was mine.

Marv
Attachments
seaside-shadow-mask.jpg
seaside-shadow-mask.jpg (7.49 KiB) Viewed 3995 times
seaside-shadow.jpg
seaside-shadow.jpg (12.14 KiB) Viewed 3995 times
seaside.jpg
seaside.jpg (28.63 KiB) Viewed 3995 times
jsachs
Posts: 4203
Joined: January 22nd, 2009, 11:03 pm

Re: Warp Transform

Post by jsachs »

At first I could not see what you were doing, but then I experimented with the samples you posted and did see the problem so I edited my previous posting with a suggestion.

I understand the idea of putting an upside down shadow under the log, but I don't understand what you want the end result to look like. If you just wanted to line up the upside down log with the right side up log and composite the background you can use composite with 2-point alignment, but you seem to be trying to achieve some other effect.

If you could create an acceptable mask for the log shadow, you could use the Brightness transformation to darken the original image just in that area to simulate a shadow.

I took your images and registered the mask to the log in the input image using 3-point alignment so I could shear the mask to make it look like the sun was coming from an angle. Then I used the sheared mask with the Brightness transformation to darken the masked area.
Log with shadow
Log with shadow
Log with shadow.jpg (33.78 KiB) Viewed 3960 times
Jonathan Sachs
Digital Light & Color
Post Reply