cheind / pytorch-debayer

Convolutional PyTorch debayering / demosaicing layers
MIT License
79 stars 10 forks source link

Can I use a specific CFA? #7

Open makejohn opened 1 year ago

makejohn commented 1 year ago

I got a TDI camera, which is R G B R G B... which mean the image CFA should be like

[R G B R G B R G B R G B R G B R G B R G B ] [R G B R G B R G B R G B R G B R G B R G B ] [R G B R G B R G B R G B R G B R G B R G B ] [R G B R G B R G B R G B R G B R G B R G B ]

Does this project support this kind of CFA? Or should I modify something to make this project fit with this "RGB" CFA

cheind commented 1 year ago

hey,

so you got a line-based camera? The arrangement of filters is currently unsupported by this library out of the box. You will need to tweak things a bit. You could for example shift every second row by -1 and then drop every third column..this should give

RGRG GBGB

but will cost you resolution (due to dropping columns) and will probably also offset colors a bit (due to shifting). Alternatively you will need to come up with custom conv kernels.

makejohn commented 1 year ago

Thanks for your reply, I am not familiar with pytorch, just met a lot of false color while demosaicing the TDI-camera image, I trying to solve this issue using different methods.