mirror of
https://github.com/TencentARC/GFPGAN.git
synced 2026-04-20 12:50:50 +00:00
Detail mattes and ID maps (suggestion) #106
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @KeygenOld on GitHub (Nov 12, 2021).
Would be cool if we could define a "detail matte" to help the algorithm figure out which areas should be more detailed and which should be blurry and out of focus. This could be a secondary grayscale image. Black would be lowest detail (blurred), 50% gray would be neutral areas that are ignored, white would be the highest detail, and gradient would fall between.
This doesn't need to be a very detailed image, and could just be a sort of suggestion to the software and painted using soft brushes in photoshop or gimp, to define which areas should not be ignored due to image degradation.
Would also be good to be able to set a flag to create a secondary image—this way we could get a render that uses it and one that doesn't, in case we need to blend the two, i.e.
--output_detail_imageto render both. Some people may even find a delta image useful, but not necessary for myself.This could be useful for:
An alternate idea would be to use a "heat matte". These are used in 3D for defining various things, such as the amount that skin geometry should slide over muscle or how much a body should jiggle. These could be grayscale images, but may be RGB images, or layered RGB images, so you can use color to define various parameters. This is probably too complicated to be bothered with, but suggesting it anyway as food for thought.
For GFPGAN, a heat map could work as follows:
If you wanted to go really crazy, you could use different colors to define parts of the face (hair, eyes, nose, mouth, ears), for images that are very damaged.
ID Maps or Layered Masks
Another useful feature would be to output an ID map so that parts of the image could easily be masked in post (photoshop, etc). This is something else that comes from CGI. Modern render engines can output a render of various colors that can then be used as masks in post by plug-ins that are made to recognize them and avoid aliasing so you can color correct and composite things easily. Outputting an ID map that defined background, face, and the rest of the body could be very useful for final adjustments. If not, a simple layered TIFF file with 3 layers of solid colors and alpha channels would suffice and be more accessible to people used to 2D graphics.
Not sure if it's worth your time to do any of this, but just some ideas that came to mind while experimenting with the tools so figured I'd share just in case you thought they were of some benefit to your research. I could personally use them for the images I'm working with.