Using EXR images in OpenCV - opencv

I'm currently working on a project with OpenEXR and I would like to implement some Blob detection algorithms. To do this I figured that I could use OpenCV as it says in the documentation that it can open OpenEXR format files.
I have all the libraries installed and working as I've been doing other things. I open a simple jpg file with openCV cvLoadImage. It works fine. But when i try to open any .exr file it doesn't seam to like it. I get a gray window where there should be the image display.
Has anyone done any tests with OpenCV and OpenEXR libraries working together? Have they worked for you? What do you think?
Thanks.

Yes, that's done, I posted a Ticket in the OpenCV project at willowGarage and they made all needed changes, you now can use OpenEXR with OpenCV as before!
Great
My HDR tone mapping algorithm will work again, cool
Have a nice programming now ;o)
Alex

Well Alex!
My news aren't really encouraging... I tried to use OpenEXR with OpenCV but it's not doing it's work. It says in the documentation that OpenCV 2.0 has OpenEXR support but...
I've searched the web to find some example of working EXR images in OpenCV but had no luck.
At this time I've developed myself a function to convert an image read with the OpenEXR libraries that uses Ilm::Rgba* structure to save the pixels of the image and convert it to char* that OpenCV uses with images. The IlpImage structure is the one I use. Actually I'm working with an example from OpenFrameworks and using they're Image structure...
It's a really early stage in my development because I had to start over...
I hope this can help you... but if you enter the world of OpenEXR it's a pretty dark world in terms of documentation, so all I can say is good luck!
Feel free to contact me and I'll see if I can help you!

This question is rather old now, but I noticed whilst reading the OpenEXR manual today that it says (whilst talking about reading named channels)
If one of those channels is not present in the image file, the corresponding memory buffer for the pixels will be filled with an appropriate default value.
I'd speculate here that the grey image you are seeing is an "appropriate default value".

Related

How to transform a ID3D11Texture2D into any picture format

I have a ID3D11Texture2D and want to write it to disk using literally any picture format (png, bmp, jpeg, ...).
I have already tried to read the docs https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nn-d3d11-id3d11texture2d, which are less than helpful, and i have found an NVIDIA tutorial of how to take individual ID3D11Texture2D and convert them into a video: https://github.com/NVIDIA/video-sdk-samples/tree/master/nvEncDXGIOutputDuplicationSample
However, I dont find anything how to simply write it to disk in any format. I'm sure I'm missing something obvious, any hint would be appreciated.
To experiment, I used https://github.com/NVIDIA/video-sdk-samples/tree/master/nvEncDXGIOutputDuplicationSample, set the frames to capture to 1, and try to write the ID3D11Texture2D to file before encoding to video.
I have a solution for exactly this in the ScreenGrab module which captures a texture (if not already in Map-supporting memory), and then writes it out as a picture using WIC. It handles some edge-cases like "typeless" resources and MSAA as well.
The 'standalone' version is on GitHub here as part of the DirectXTex package:
https://github.com/microsoft/DirectXTex/blob/main/ScreenGrab/ScreenGrab11.h
https://github.com/microsoft/DirectXTex/blob/main/ScreenGrab/ScreenGrab11.cpp
Documentation is here.
ScreenGrab is also included in the DirectX Tool Kit for DX11 and DX12. There's also a basic DX9 version in the DirectXTex package as well.
ScreenGrab can write to any file container supported by WIC. It also has buit-in support for writing DDS files directly without using WIC.
In addition to using ScreenGrab (which is intended as a light-weight screenshot solution), you can also use the DirectTex library to capture a texture and then save it to DDS, HDR, TGA, or any WIC-supported file format.

OpenCV Audio support (MSMF and GStreamer backends)

As it's mentioned in Release highlights, OpenCV (4.5.5) now have Audio support in videoio module. However, there's no documentation related on this topic.
I've tried a few things on my own like:
cv::VideoCapture cap(fileName,cv::CAP_MSMF);
However, no results so far.
How can I activate Audio Support? Am I missing something?
(Does not work neither for camera nor video files)
Additionally, I don't use pre-built binaries but, tried with pre-built ones(for Windows) and it didn't work neither.
As far as I see, this question does not make any sense unless they implement an interface. That's why they have no documentation about this topic. Hope they'll bring that feature with 4.5.6.

How to get imagemagick to support .flif and .bpg formats?

For quite some time now there have been several image codecs which provide significant improvements over PNG and JPG, however the latter still remain dominant.
Two formats in particular that I'd really like to see getting more adoption are FLIF and BPG. They seem superior in every possible way to JPG and PNG (except for lacking market acceptance). Especially FLIF seems extremely promising.
TL;DR = Besides supporting them in my own software, is there a way to get FLIF and BPG support in imagemagick?
The ChangeLog for ImageMagick says
2015-06-25 6.9.1-7 ... * Support BPG image format
There's no direct BPG support in the ImageMagick source code, but config/delegates.xml lists delegates "bpgdec" and "bpgenc" which convert BPG files to and from PNG files which then get processed by ImageMagick. You would have to supply those delegates if they aren't already on your system. You can download the sources for bpgdec and bpgenc from
http://bellard.org/bpg/
There's nothing about FLIF in the ChangeLog, but a "pull request" for FLIF support was recently applied, and coders/flif.c exists in the ImageMagick sources (it requires a separate libflif to work). You can download the source code for libflif from https://github.com/FLIF-hub/FLIF
I haven't tested either feature.
bpgdec, bpgen, and libflif are all LGPL-licensed, and a reduced version of bpgdec is available under a BSD license.
To get imagicmagick to work with .bpg you have to compile it separate from what is already there. In other words, you have to add it in. So download the source code and it doesn't compile. Give up and use something else or try this because I got it to work
use apt-get and install
libpng*
libsdl1*
libsdl2*
libsdl-image*
cmake
libjpeg*
and maybe libjpg*
decompress the .bpg files you downloaded and just
use the command
make and sudo make install
AFTER that imagemagick will work with libpg and will not give an error of a missing delegate..

Using LibTiff with Delphi

I'd like to use LibTiff with XE3 to access image meta data information from TIFF files.
I need to find the number of pages inside tiff and their sizes.
I suggested LibTiff because I need the fastest possible implementation of reading tiff image meta data.
The only link I have found is not working anymore:
http://www.awaresystems.be/imaging/tiff/delphi.html
OK, Internet Archive has returned back to operational state, and here is your download:
LibTiffDelphi, full version. Large download (approx 1.39 megabyte), includes Debug and Release versions
Well, the download links at that site do appear to be down. You could try downloading from here instead: http://www.vdebris.comli.com/wp-content/uploads/2009/09/libtiffdelphi_3_9_1.rar
I think you could use Mike Lischke's GraphicEx to solve your problem. The TImageProperties record that is made available by the TGraphicExGraphic class appears to have what you need.
found that code working with *.tif and used graphics + lib for solution building TIF SPLITTER
not sure if it helps to solve your problem

jpeg2000 on ios app

Has anyone had luck converting and using jpeg2000 on the ios? I am writing and inventory app and would love to go with a jpeg2000 file type if I can figure out how to get the phone to support it.
I have seen that there is a nice project for webp - https://github.com/carsonmcdonald/WebP-iOS-example - which seems like it would also work but I think the jpeg2000 results are even better.
Just trying to eval options. Thx in advance
We used JPEG 2000 for my last project (Spot.app)
I downloaded the official open-source JPEG 2000 codec source from here: http://www.openjpeg.org/index.php?menu=download
Build it into a static library and voila.
Here's some sample code I created: https://gist.github.com/1861465
Image IO has nice image conversion functions that eliminate the need for 3rd party code. See more here: How do I convert UIImage to J2K (JPEG2000) in iOS?
No need to bring in the JPEG 2000 project.

Resources