Replies: 6 comments 7 replies
-
Here is when I ran it in the terminal OS and it is both JPG and the DNG file compared to the previous picture (where it was in Visual Studio Code) |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the question. I think the problem may simply be that the image viewer does not handle DNG files correctly. It discovers that it doesn't know how to decode the image, so you end up with the "background", which is the white/grey checkerboard pattern, showing through. (Viewing a completely transparent image file usually looks the same.) When you use our command line applications, these save a small greyscale thumbnail. DNG files sometimes contain thumbnails like this because they know that some viewer applications will only understand and render the thumbnail. But the Python DNG library that we use does not save a thumbnail (hence why the image doesn't show up). You could convert the DNG files to regular image files to view them. The easiest way is probably to use dcraw:
which will create a |
Beta Was this translation helpful? Give feedback.
-
I would consider doing the processing directly in Python using Picamera2. Note that dcraw turns the raw image into a processed image, so if that's what you want you may as well use the processed image directly from Picamera2. (I assume you're familiar with the fact that a DNG file contains a Bayer pattern which needs a certain amount of processing before it is "viewable".) With Picamera2 you can grab a raw and a processed image simultaneously. You can request the processed image in either RGB or YUV420 (where the Y gives you greyscale directly). You have numpy and OpenCV to do any processing that you need, and I believe OpenCV supports writing to TIFF files too. |
Beta Was this translation helpful? Give feedback.
-
I suspect there was nothing wrong with your DNG file, it's just that the image viewer cannot handle it properly. (As I said, try dcraw on it to be sure!) I also suspect a little bit that you don't want the raw file at all, because that's a Bayer pattern and not a regular image. It needs, usually, lots of processing to be usable. Is it perhaps the case that you want an uncompressed image, and not a raw image? (Unfortunately, in the video community they sometimes use "raw" to mean "uncompressed", but in the image sensor community, and therefore in libcamera and Picamera2, "raw" means "Bayer".) |
Beta Was this translation helpful? Give feedback.
-
So my advice would be to configure the camera to give you "YUV420", and then use |
Beta Was this translation helpful? Give feedback.
-
So I am having trouble with .DNG format. When I do it in the terminal I get some decent images (monochromed but 253 x 190 pixels). However, when I go into python (Visual Studio Code or Thonny), the .DNG image is just these white and grey boxes (4056 x 3040 Pixels)... does anyone know what I am doing wrong here?? The plan is for me to take both JPG and DNG, and then with the DNG convert it to a Tiff format. Then convert the Tiff to grayscale. And then from there I am able to calculate for the Albedo. PLEASE HELP
Beta Was this translation helpful? Give feedback.
All reactions