dustysys / ddetailer

340 stars 74 forks source link

X/Y offset causes mask to wrap around image #19

Closed poisenbery closed 9 months ago

poisenbery commented 1 year ago

If you use the X or Y offset to move the mask around, it is possible for the mask area to exceed the canvas size. This results in the mask wrapping around to the other side of the image.

Example: I have faces near the top of the image and I want the mask to include their hair as well. I increase the dilation factor and change the Y offset to move it up. Normally, this results in masks over the face AND hair, but in some cases where the face is very near the top of the image, the Y offset will cause the mask to wrap around to the bottom of the image.

This ends up causing unwanted padding and results in a massive loss of quality.

Correct behavior: Screenshot (1264)

Correct Masked area and padding: Screenshot (1265)

Incorrect behavior: Screenshot (1266)

Incorrect masked area and unwanted padding: Screenshot (1267)

I thought of using A+B to avoid the issue, but feet/legs intersecting body parts have a tendency to make it not work.

poisenbery commented 1 year ago

Here is another example with the mask going through the top and sides. As you can see, the entire image is padded, making it behave more like "Whole Image" instead of "Only Masked" Screenshot (1268) Screenshot (1269)