Bringing-Old-Films-Back-to-Life icon indicating copy to clipboard operation
Bringing-Old-Films-Back-to-Life copied to clipboard

Preserve colors in color video sources

Open makemota opened this issue 2 years ago • 7 comments

Currently processed videos get converted to black&white regardless of the color of the sources. Is it possible to retain/enhance original colors in output similar to your Bringing-Old-Photos-Back-to-Life - "Quality Restore"?

makemota avatar Feb 14 '23 22:02 makemota

You can find "torch.abs(pixel_prop[:,:1,:,:] - curr_lr[:,:1,:,:])" in RNN_Swin_4.py, Line 216&239. The "1" means only use the first dimension because all the dimension are same(if use the gray input). You can process the second and third dimension by this way :)

CuddleSabe avatar Jun 15 '23 09:06 CuddleSabe

You can find "torch.abs(pixel_prop[:,:1,:,:] - curr_lr[:,:1,:,:])" in RNN_Swin_4.py, Line 216&239. The "1" means only use the first dimension because all the dimension are same(if use the gray input). You can process the second and third dimension by this way :)

Could you please clarify :"... You can process the second and third dimension by this way :)" How that line should look "residual_indicator = torch.abs(pixel_prop[:,:1,:,:] - curr_lr[:,:1,:,:])" in order to process/output full color? My great appreciation for your response.

makemota avatar Jun 17 '23 17:06 makemota

You can find "torch.abs(pixel_prop[:,:1,:,:] - curr_lr[:,:1,:,:])" in RNN_Swin_4.py, Line 216&239. The "1" means only use the first dimension because all the dimension are same(if use the gray input). You can process the second and third dimension by this way :) +1 for more detailed explanation

semel1 avatar Jun 18 '23 23:06 semel1

u can process in this way: if u have a rgb image "217, 65, 43" for "r, g, b", then u can get three "gray image"-----"217, 217, 217" , "65, 65, 65" and "43, 43, 43". Process them in the original way, then concat "three gray image" into one rgb image

CuddleSabe avatar Jun 19 '23 06:06 CuddleSabe

u can process in this way: if u have a rgb image "217, 65, 43" for "r, g, b", then u can get three "gray image"-----"217, 217, 217" , "65, 65, 65" and "43, 43, 43". Process them in the original way, then concat "three gray image" into one rgb image

Colorful Image 720x540 consists 388800 pixel. Each of them could have their own RGB index. "rgb image "217, 65, 43" - is not a real image but solid color. Or, may be I misunderstood your approach?

semel1 avatar Jun 19 '23 16:06 semel1

May be you've meant to process 3 color channel (well 4 - if image has alpha channel)? In this case you can process all of them separately and then superimpose (not concatenate) in to one RGB. But such approach is absolutely insane and is not acceptable (IMHO). - You have to process the same video 3 times (just imagine how much time it will take).

Beside of the fact that the quality of restored videos is low (as mentioned in issue #17), I don't think that put such effort make any sense (IMHO). The workaround I tried Is to composite in NLE restored video over original using "Luminance"mask. That works, but again because of low restoration quality (scratches are not processed/removed, instead useful details gets removed, restored image dimensions gets distorted and doesn't fit any video standard) I do not see any use of that algorithm.

semel1 avatar Jun 19 '23 23:06 semel1

May be you've meant to process 3 color channel (well 4 - if image has alpha channel)? In this case you can process all of them separately and then superimpose (not concatenate) in to one RGB. But such approach is absolutely insane and is not acceptable (IMHO). - You have to process the same video 3 times (just imagine how much time it will take).

Beside of the fact that the quality of restored videos is low (as mentioned in issue #17), I don't think that put such effort make any sense (IMHO). The workaround I tried Is to composite in NLE restored video over original using "Luminance"mask. That works, but again because of low restoration quality (scratches are not processed/removed, instead useful details gets removed, restored image dimensions gets distorted and doesn't fit any video standard) I do not see any use of that algorithm.

have you made color video process successfuly?

YoungofNUAA avatar Jan 11 '24 02:01 YoungofNUAA