- your image is probably 8-bit per pixel. The RAW10 is 10-bit per pixel. So you'll always have the two highest bits wasted. If the image was initially RAW10, you're never going to recreate the additional 2 bits of information that were lost.
- RAW10, like all raw formats assumes the decoder knows what sensor the image corresponds to. Therefore, the RAW10 format does not include any information about the image such as width and height and bayer pattern. The image is just one long line of pixels. It's up to the decoder reshape that into a rectangle of the right size and to remove potential padding pixels (if the number of columns is not a multiple of 4).
- If the image is colour, then the pixels in RAW10 needs to be encoded using a bayer pattern. There are several possible bayer patterns (GBRG, GRBG, BGGR, RGGB) so you'd have to chose the one that matches your sensor/decoding software. An additional problem is that while matlab has a function to decode bayer patterns it does not have one for encoding into them, so you'd have to write your own.
How to convert jpeg file to RAW10 data format?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mark Allen Lagaya
le 3 Avr 2018
Commenté : Walter Roberson
le 4 Avr 2018
Hello,
Is there a way to convert an image file (e.g. jpeg format) to RAW10 data format using MatLab?
Thank you.
0 commentaires
Réponse acceptée
Guillaume
le 3 Avr 2018
While yes, as Walter says, you potentially could write a converter, it seems to be the opposite workflow to what people normally do. So, what would be the reason to want to do this?
There are a few technical considerations to bear in mind as well:
Once the image has been bayer encoded it's easy to convert it to RAW10. I can write the code for that if really needed (but not the bayer encoding).
5 commentaires
Guillaume
le 4 Avr 2018
Modifié(e) : Guillaume
le 4 Avr 2018
The person doing the work figures the bayer pattern might be CYYM
Actually, you can see later on that they figure out it's BGGR. That makes more sense, I've never heard of a sensor with CMY filters.
Each sensor will have its own pattern and again, it's not something encoded in the raw10 format. It's up to the reader to know what it is and decode the image accordingly.
Walter Roberson
le 4 Avr 2018
Ah, I did not look on the right part of the page for the continuation indicators. There is too much information in the discussion for me to process well at the moment, as I am not familiar with a number of parts of what is being discussed -- but it is clear that at least for that device that reversing a RAW10 would not be easy.
I think we would need more information about the device being used on the test bench.
Plus de réponses (1)
Walter Roberson
le 3 Avr 2018
Yes, it should not be bad if you follow the file format description of https://developer.android.com/reference/android/graphics/ImageFormat.html#RAW10
There is no obvious file header for RAW10, just data. I am not sure how the size information is stored.
3 commentaires
Guillaume
le 3 Avr 2018
a bitstream in a text file
The two things are contradictory. What do you mean exactly?
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!