leehomyc / Faster-High-Res-Neural-Inpainting

High-Resolution Image Inpainting using Multi-Scale Neural Patch Synthesis
http://www.harryyang.org/inpainting
MIT License
1.3k stars 213 forks source link

Handling Inapinting for Non Center Region #30

Open yannadani opened 6 years ago

yannadani commented 6 years ago

Hey!

Thanks for the code. I was trying to play around with this and had a query. I wanted to know how to inpaint images when the region of interest is not a square at the centre of the image but something which is quite arbitrary. For example, patch inpainting a detected object or a person in any part of image (espcially non center ones). Is there a way to do it here?

Thanks !

leehomyc commented 6 years ago

Hi, you can crop or pad the image such that the person is in the center. If the shape is not a square, you can use a bounding box that contains the shape (for the content network it requires the hole to be the center of the image). After that, you can apply the texture network (which is essentially style transfer) where the hole can be any shape or location. You just need to use the output of the content network as content (maybe only keep whatever is inside the original hole) and use the rest of the image as style. Our website has an example of removing and inpainting a person: http://www.harryyang.org/inpainting/