Deep3DFaceRecon_pytorch icon indicating copy to clipboard operation
Deep3DFaceRecon_pytorch copied to clipboard

How to get mesh image with original image size?

Open Feywell opened this issue 4 years ago • 5 comments

All res is with img size 224. If I use original image size mesh. How can I inverse the transform mat

Feywell avatar Dec 07 '21 10:12 Feywell

@sicxu @YuDeng , I also want to ask this question. I noticed that the input image would be cropped by the 5 facial landmarks location into a 224x224 size, if I want to paste the reconstructed image to the original image, how should I do?

@Feywell , have you solved this problem?

zhanghm1995 avatar Jan 15 '22 09:01 zhanghm1995

I save the mat in preprocessing,. So I warp the render image use the inverted mat when pasteing the image to the original image

Feywell avatar Feb 17 '22 03:02 Feywell

@Feywell , sorry to reply you so lately. Could you share your codes to invert the reconstructed image to the original one? I also save the trans_params information in align_img function and try to recover the reconstructed image to the original size, but I got the results which matched not very well.

zhanghm1995 avatar Mar 05 '22 11:03 zhanghm1995

Here is my take on it. In the function resize_n_crop_img in preprocess.py

orig_left,orig_up,orig_crop_size = (left,up,target_size)/s

will give you the upper left corner of the crop in the original image (orig_left,orig_up) and the size of the squared crop, orig_crop_size

dorjeduck avatar Apr 25 '22 20:04 dorjeduck

I find this idea also gets slightly jitting effects when processing video. Finally, I save s, left and up firstly.

Then, I resize the original image by s, and paste back the left, up to the resized original image, which works better and seamlessly.

Here is my take on it. In the function resize_n_crop_img in preprocess.py

orig_left,orig_up,orig_crop_size = (left,up,target_size)/s

will give you the upper left corner of the crop in the original image (orig_left,orig_up) and the size of the squared crop, orig_crop_size

vinthony avatar Aug 11 '22 04:08 vinthony