Comments (11)
If you want to save it back as a raw file, then no. If you just want to change the raw pixels for the postprocessing, then yes, just change pixels in the arrays, e.g. raw.raw_image_visible[:] = new_data
from rawpy.
@Ir1d If you downsample then you destroy the Bayer matrix, which means you can't postprocess anymore. Please ask such questions on stackoverflow.
from rawpy.
Thanks Maik! I am not saving the raw file; the only process that I need is the postprocessing. I am trying to modify the raw.raw_image_visible to see what corresponding postprocessing results it would lead to.
I have a couple of more questions here. Does the postprocessing process only depend on the raw_image_visible matrix, or is it that it depends on other options in the raw file as well? I tried to fill a new_data (which is 100x100) into raw.raw_image_visible (which is 200x200). It led to a ValueError though: could not broadcast input array from shape (100,100) into shape (200,200). I modified the new_data as the upper left block contains the actual matrix values, while other parts are all set to zeros; then fed it into raw.raw_image_visible and it worked.
However, the results aren't what I was originally expecting for. My goal is trying to figure out what operations I could do on the raw data so that it leads to a simulated corresponding low-resolution counterpart of the original image. What I did earlier - by selecting a subset of the raw data doesn't lead to an image that is slightly blurry, but some points that have a color difference (I also tried bicubic interpolation of the raw data, seems it doesn't work either). Do you have any clue about it, if the above-mentioned makes sense to you. Thank you so much. :)
from rawpy.
I you just want to reduce the output resolution, maybe the half_size=True
option is a solution. But this is probably not what you have in mind when talking about "simulating".
Before I continue, do you understand the concept of Bayer matrices?
from rawpy.
Thanks for your reply. Yeah that is not what I had in mind by setting "half_size=True".
I am actually trying to investigate the SR(super-resolution) problem by using raw data. As the raw data technically contains more information (hasn't been through all the processings) and offers higher controllability, my thought is that maybe it is more suitable for the SR problem of being able to restore more details. The traditional SR problem achieves the low-resolution images using bicubic interpolation.
img_2 = imresize(imresize(img, 1/2, 'bicubic'), [size(img, 1), size(img, 2)], 'bicubic');
For raw data though, I don't really have a clue of how to achieve similar "simulated" low-resolution images.
My basic understanding of Bayer matrices is that in raw data, each pixel value retains the intensity pixel value of only one color channel of the three RGB channels. The whole raw data is organized in Bayer pattern (RGBG) as blocks. I am all new into this so the understanding can be not very accurate.
from rawpy.
I actually want to enable the "half_size=True" option, but in the opposite direction. I am not sure this option is achieved from a down-sampling the RGB image of original image size, or from the raw data.
Given both raw data and RGB data of the original image size, instead of achieving a half-sized RGB image, I am wondering what the corresponding raw data would be like that could generate the half-sized RGB image.
from rawpy.
Given that rawpy is just a simple wrapper around libraw, I have the feeling that your question should better be asked in a general raw photography discussion forum than here. You will get more helpful answers.
from rawpy.
Okay, I see. Thanks a lot for your help! :)
from rawpy.
Could you still tell me your answer to this question, does the postprocessing process only depend on the raw_image_visible matrix, or is it that it depends on other options in the raw file as well?
from rawpy.
Postprocessing mostly depends on the image matrix, the chosen postprocessing parameters, and, if the parameters don't override it, then things like camera whitebalance can be used directly from the file metadata.
from rawpy.
@Melody-doudou Hi, have you solved this? Can you share your solution on how to perform postprocessing on downsampled images?
Since the numpy array is downsampled, it cant overwrite the original array
from rawpy.
Related Issues (20)
- Issues with X-H2 RAW files. HOT 11
- Adobe DNG SDK support HOT 1
- No source on pipy HOT 2
- “Image too big” thrown when file does not exist HOT 2
- Adobe DNG GainMap support HOT 5
- Support for Python 3.12 (was: ERROR: Could not find a version that satisfies the requirement rawpy) HOT 1
- Cannot read thumbnail of NEF file HOT 1
- Mimic Adobe Photoshop Open-Save quality HOT 1
- Setting manual raw_pattern HOT 10
- Support arm64 MacOS HOT 1
- new API to get wb factors from gray box HOT 2
- How to process bayer10? HOT 1
- How could I do some transform in raw domain and transform it into rgb domain? HOT 1
- Support for StripOffsets and StripByteCounts in DNG tags HOT 1
- Questions about support for the Z9
- Include Libraw snapshot releases? HOT 2
- catching corruptions HOT 2
- 12bit raw data- Maximum pixel value around 2200
- Compatibility issue with NumPy 2.0.0 HOT 5
- Rawpy support for MacOS and python version 3.8 and 3.9 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rawpy.