I am looking for a way to create synthetic raw image for testing purposes.
How can I do that?
(Or should I ask in a different forum?)
I am looking for a way to create synthetic raw image for testing purposes.
How can I do that?
(Or should I ask in a different forum?)
That depends in what you want to test with those. Do you just need synthetic Bayer data or do you want to âfakeâ a whole raw file in some cameraâs file format? I havenât done either but the latter sounds really hard if not impossible, depending on the amount of detail you want to get.
Hmm. That raises an interesting question. If someone steals a picture and sells it as its own, can the original author go to court with the raw version as the sole proof of ownership, or it is possible for the thief to come up with a retro-computed raw file which, with at least one demosaicing algorithm and adequate combination of parameters, yields the published picture?
Do you mean generating synthetic test raw files such as the raw file used in this article?
Bayer moire:
https://www.libraw.org/articles/bayer-moire.html
I need this in order to test particular post-production procedures (including raw conversion an perhaps even demosaic) but because I want this to be a very controlled test I cannot achieve the accuracy I need using real photographic data. For example I want to be able to create particular image data which I donât want to be influenced by things like lens imperfections and other technical factors BUT still I want to be able to simulate the whole process itself as if it is on a real raw image.
Yes, perhaps something like this but for more advanced tests. How are these generated?
FWIW I have already sent an email to librawâs creator but I am not getting any reply for the moment.
My apologies, I donât know how such synthetic images are created. But synthetic images would be very useful for testing and comparing raw processing algorithms.
The âmoireâ image definitely is useful for comparing demosaiking algorithms, but as far as I can tell itâs not released under a free/libre compatible copyright.
It would be nice to be able to generate synthetic scene data as well as synthetic test chart type data.
Hopefully someone who knows will see this thread.
Maybe try one of the dpreview.com forums?, e.g. âphoto. science and tech.â
Thanks for the suggestion. I have done that too.
BTW not sure who should be notified about this but all email notifications sent by this forum end up in the Spam folder in Gmail. When looking at the headers I see that SPF: softfail and there are no DKIM and DMARC records which is obviously the reason. I hope someone who takes care of this will look into it.
This is too vague. If you simply want the mosaiced image, then itâs trivial (e.g creation of DNG is pretty simple). If you want to generate the whole as-if camera raw, then it could be as complicated as acquiring a camera and messing with itâs electronics and firmware in order to trick it into compressing your data into the camera-specific compression/etc.
I am willing to be able to control the hardware WB (uniwb) add noise or not, generate particular pixel patterns, gradients and other things, and obviously that should be mosaiced and linear so that it is like a real raw. I am not looking to simulate the electronics of a particular camera body but rather (as explained) to create data free from these particular influences (which we usually consider imperfections).
Do you know how to do this?
Well, if you can generate the data, containering it into DNG is trivial
Thanks but I havenât touched C code for 15 years, so I am not quite sure what to do with that If you can explain how to turn this into executable code hopefully I may give it a try. (I am on Linux)
You could create a DNG file using ExifTool and ImageMagick/GraphicsMagick. If you want it mosaiced, I think GâMIC has a filter.
http://rawpedia.rawtherapee.com/Film_Simulation#Advanced_-_Identity_DNG
Thanks. Thatâs interesting and sounds easy. But after running the 3 command lines and opening the resulting DNG in RawTherapee it looks strange (as if wrong):
Do you have any idea why? (I havenât applied any GâMIC filter)
GâMIC does have a filter, -rgb2bayer. Go here:
http://gmic.eu/reference.shtml
Search for ârgb2bayerâ. Doesnât describe specifically what the transform is, but would be a good start.
George has an equivalent thread going at dpreview. Based on the discourse there, the workflow that makes sense to me would be:
Yes, quite a lot of words on dpreview but still no clear methodology.
What is de-scale and white/black point? I have never used GâMIC but looking at the online filter gallery of GâMIC I donât see those.
Also how do you write the TIFF to DNG? See above what happens when I used exiftool for this.
de-scale: The image you create in whatever program will contain pixel values scaled to the full extent of the data type, e.g., 0-255 for 8-bit values, accommodating the behavior of human vision. The raw image from a camera looks dark to the human eye because the sensor records the light values linearly, e.g., white in a raw I just opened without applying processing is 64,64,64 in a 0-255 extent. So, youâll need to essentially apply âreverse-gammaâ to the synthetic image, where 2.2 is nominally the gamma applied when raw/linear is converted to sRGB, so do the inverse. GâMIC may be able to do this with -adjust_colors, which has a gamma input.
black/white point: you may not have to do this for a synthetic image, if the reverse gamma does what I think it should.
Generally, GâMIC is the tool I believe to be most suited to your needs, but like any powerful tool, youâll have to learn it. The documentation is a bit obtuse, but itâs cheap to craft a command, run it, and see what it does. Also, David TschumperlĂŠ, the primary programmer behind GâMIC, posts here and would probably be very happy to answer specific questions about it.