syoyo / tinydng

Header-only Tiny DNG/TIFF loader and writer in C++
MIT License
151 stars 30 forks source link

[TODO] Ability to write GainMap #36

Open eszdman opened 11 months ago

eszdman commented 11 months ago

Please, provide ability to write GainMap into dng file. This is a necessary thing when creating a dng file with camera lens shading.

syoyo commented 11 months ago

You can contribute or you can sponsor prioritizing implement GainMap write feature

electro-logic commented 11 months ago

You can use a simpler opcode called "FixVignetteRadial" to correct the camera shading. Have a look at my project DngOpcodesEditor to try out that opcode.

syoyo commented 11 months ago

Interesting! > DngOpcodesEditor.

BTW, I think usually many cameras(includes Android's DNG support) only provide GainMap opcode.

electro-logic commented 11 months ago

Hello @syoyo, Not all opcodes are extensively used. I have seen many smartphones using FixVignetteRadial, some drones use WarpRectilinear and GainMap. I'm now trying to implement GainMap because is pretty popular, keep watching the project.

syoyo commented 11 months ago

Thanks! Good to know! > I have seen many smartphones using FixVignetteRadial, some drones use WarpRectilinear and GainMap

electro-logic commented 11 months ago

You can already find a working implementation of the opcode in the repository. Some border cases are not handled yet, but seems working.

eszdman commented 11 months ago

Hello @syoyo, Not all opcodes are extensively used. I have seen many smartphones using FixVignetteRadial, some drones use WarpRectilinear and GainMap. I'm now trying to implement GainMap because is pretty popular, keep watching the project.

It would be nice if you wrote an algorithm that can convert gainmaps back and forth with this opcode

electro-logic commented 11 months ago

@syoyo Do you have an use case for this scenario? The conversion FixVignetteRadial->GainMap is feasible, but you can have only have an approximation from GainMap to FixVignetteRadial. For example DJI uses the GainMap to fix vignetting, correct aberration and balance a bit colors at the same time.