suggestion : cloning with rotation, mirroring, and resizing

Moderator: jsachs

Post Reply
pierrelabreche
Posts: 414
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

suggestion : cloning with rotation, mirroring, and resizing

Post by pierrelabreche »

The situation :
When cloning, it can be difficult to rotate / mirror / resize the source image to fit the target area.
When cloning along a curved line, it can be more difficult and tedious to rotate / mirror / resize the source image to fit the target area, with many adjustments along the source and target image areas.

Suggestion ( with examplar controls )
  • Enable user to define, on-the-fly, an angular control for leveling, mirroring, and resizing.
  • Thus, the shape radius for the source image would be independent from the shape radius of the target image. There would also be a control for mirroring the image. An angular control in the source and target shapes, like the one implemented in oval gradients, would allow rotating the source image and the paint tool shape.
  • The source image would be shown in semi-transparency over the target image for visual alignment.
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: suggestion : cloning with rotation, mirroring, and resizing

Post by Marpel »

I think I know of what you are referring. If not, disregard my comments.

I have long used the following process to clone a part of one image into another by:
- Composition, one point alignment, initially at 50% opacity.
- Move the overlay image around until the two areas line up to get an initial impression. If good enough, go to 100% and OK the process.
- Clone from the just generated image to the intended image. Clone is used so I can "gently" choose exactly which part of the image I finally want. Or use a mask in the first instance, but I prefer the clone "tweaking".
- If, in the first instance, I find the part that I wish to clone from, a bit off in level or size, I will then play with Rotate/Level/Resize and this often takes a couple tries.
- Then back to the Composite, one point alignment routine to get the areas to line up, then use Clone to copy part(s) of the resultant image into the base image.

So, if the above could be accomplished with one Transformation Tool, that would be great.

Photoshop has this exact capability, where you can place an image on a layer above the base image and, at 50% opacity for lining up, move, rotate and resize all at the same time, then back to 100% opacity and use a brush to capture just what you wish. Just not sure if that would be a "big ask" for PWP.

Marv
pierrelabreche
Posts: 414
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: suggestion : cloning with rotation, mirroring, and resizing

Post by pierrelabreche »

Hello Marv,

First, thanks for the details of your workflow and in Photoshop.

I had tried a workflow similar to yours in PWP. Altgough it is feasible, it is difficult to align everything.

I also imagined another tool, a custom repair line. Two lines could be drawn as a series of connected points (bezier or line segment) on the source image and on the cloning target image. The lines could have alignment points and bending handles along the path. The behavior would be similar to the scratch removal tool, except that the source for repair is another image or a location within the target image. Scaling would be automatic along the two lines.

What do you think ?

Regards
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: suggestion : cloning with rotation, mirroring, and resizing

Post by Marpel »

Sounds almost like Composite and multi point alignment?

Years ago (like at least 20), I used multi point (4 or 5 I think), on an image of a city night skyline where I composited (stitched) five vertical images together for a panorama. It has been awhile so can't recall every detail, but I do remember having a heck of a time lining all parts along the multi point line (for lack of a better description). Each actual point lined up okay, but the areas between the points were always out a bit.

I got it good enough that it was printed and has been hanging (about 4 feet wide) in our basement rec room. It looks decent at first glance, but every time I look at it, I can see imperfect alignment areas, which I suspect no one else would notice.

I suppose it would depend on the size of the areas you wish to clone from/to and how easily visible they would be, although I suppose that could be mitigated by placing a gazillion points along the lines.

Marv
pierrelabreche
Posts: 414
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: suggestion : cloning with rotation, mirroring, and resizing

Post by pierrelabreche »

There would actually be two repair lines : 1 the source image sampling line ; 2 the target image painting line.

Each custom repair line could be defined with just two endpoints, with bending control handles for controlling the curvature. Intermediate points could be added to precisely conform the line to features in the image.

The thickness of the line would be controlled by a slider like the existing scratch radius control.
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: suggestion : cloning with rotation, mirroring, and resizing

Post by Marpel »

But I think that is what I was getting at with my explanation (unless I am way out in my interpretation of your idea).

As an example, let's say you wanted to replace an area in an image that is the shape of an "S" (the thickness of the S would be controlled by the slider you describe). Perhaps one is wishing to replace the edge of a flower petal (funny enough, I use this example because I just finished doing some macro photography of the petals of a flower).

So an S is laid out in the image, placing points along the line. Similarly, in the source image, an S is also drawn over the source area, and the same number of points are placed along the line. Each point is numbered and would correlate to it's matching numbered point in the other image. As I suggested in my skyline example, the more the number of points, the better the two lines/areas may line up. How precise one wants the match, depends on the effort of the user.

The blending of the two areas, along the edges of the line width, could be controlled by the feather control of the tool/brush.
pierrelabreche
Posts: 414
Joined: January 29th, 2019, 11:47 pm
What is the make/model of your primary camera?: Nikon Z8

Re: suggestion : cloning with rotation, mirroring, and resizing

Post by pierrelabreche »

Hi,

I was just picking really on the "gazillion points".

Intermediate points have correspondence in each line : they define corresponding curve segments. Each curve segment would clone the corresponding areas of the source and target images.

In your example, an S is laid out in the target image, placing points along the line. In the source image, an S shaped line is generated from the target line shape. The endpoints and intermediate points are placed along the line automatically. Each point is numbered and correlates to its matching numbered point in the other image.

A bounding quadrangle is generated around the shape in the source image, for the purpose of shifting, rotating, and perspective warp. It initially a rectangle. This bounding rectangle can be manipulated as per the warp transformation.

As you suggested in the skyline example, with more points, the better the two lines/areas may line up. The points in the line are useful features for registration/alignment.
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: suggestion : cloning with rotation, mirroring, and resizing

Post by Marpel »

I think, in theory, your suggestion has merit. Because I have no clue about coding and all that stuff, I don't know if it is easily doable.
Post Reply