Cannot write to Z channel using OpenEXR - hdr

I'm trying the read/write examples in the following official documentation:
ReadingAndWritingImageFiles.pdf
But I can't write to the Z channel. The image is all black in exrdisplay(the official EXR viewer) even the exposure is max.
If I replace 'Z' with 'R' then I can see a reddish image using exrdisplay.

Related

HSI color format in python with opencv library

Good morning, I was reviewing in python, along with Opencv, conversions to formats of different colors, but I do not find the HSI format, with the cv2.cvtColor() function.
Does anyone know if it matches the COLOR_BGR2HLS parameter?
Thank you for your attention
According to the Wikipedia article given HERE, the HSV, HLS and HSI color space terminology can be used interchangeably.
There is another option available in OpenCV as well cv2.cvtColor(img1,cv2.COLOR_BGR2HSV).
If you work out both the options, the resulting image would appear slightly different as in the following:
Using HSV:
Using HLS:
Now if you split the channels of these images (to split use cv2.split()) and analyze them:
The hue channel appears to be the same in both cases.
The saturation channel also provides the same result but appear to be switched.
You will notice a slight difference between the value channel of HSV image and the luminosity channel of the HLS image.
Work it out for an image and you will see for yourself.
HSV, HLS and HSI are similar not exactly same

Replace white background of image with transparent using C++ / OpenCV or Matlab

Using C++ / OpenCV or Matlab I'm trying to find a method to replace the white background of an image from file with a transparent background and then save the image for further use elsewhere. (The image is similar to something like this: http://www.psdgraphics.com/file/monitor-on-white-background.jpg)
I understand this task can be completed easily with simple image editing software but I need to do this for a large batch of images. I've tried methods such as Make white background transparent png matlab as well as a bunch of others with no luck.
Thanks!
Load the image. Loading images in OpenCV
Convert it to a 4 channel image. OpenCV: transforming 3 channel image into 4 channel
Determine where the background is adjust the alpha channel of those pixels accordingly. I don't know what your images look like, but if there is no other white in your images, it's a fairly simple task. (If a pixel is white, then it should be transparent.) Otherwise, if there is other white in your images, then you need to look for the contiguous region(s) of white that make up the background. See Flood Fill Algorithm
Save the image (See the link from 1.)

How to create HDR images using opencv

I am using opencv 3.0 version which has support for creating HDR images and trying to produce an HDR image using three images at different exposure.
And i found this tutorial of opencv.
http://docs.opencv.org/master/d3/db7/tutorial_hdr_imaging.html#gsc.tab=0
Its easy to understand but it takes paramter like exposure times for images.
How do i will get this exposure time ? I have only images. Do any one has tried it already ?
Thanks
Image exposure time is in EXIF data. In the explorer window right click the image, go to properties, you will see some of the EXIF data including exposure time if the image has that data.
or you can write a program to extract metadata to a txt file. I used python exifread() to read exposure time.
https://pypi.python.org/pypi/ExifRead

Importing and looping through a PNG image to check for transparency

I would like to write CPP code that is able to take in a PNG file, scan through its pixels and identify where the transparent pixels are.
I tried doing this with CIMG, but it didn't work out as CIMG only supports the RGB channels. Even after installing image magick, the 4th channel is not giving me the right values.
Anyone can suggest a library I could use?

Library to generate Images with pixels

I'm looking for a Library that allows me to generate an Image via pixel information, in this style(dummyfunction):
/*
coord_x = X coordinate
coord_y = Y coordinate
red = red part of RGB
green = green part of RGB
blue = blue part of RGB
*/
setPixel(int coord_x, int coord_y, int red, int green, int blue)
Is there such a Function? I've searched libpng, but it doesn't appear to allow to set pixels manually (might be wrong, though)...
Prefered formats for output would be PNG, GIF would be acceptable, JPG will probably not work (due to compression and lack of transparency as in PNG and GIF).
a strong and powerful library is Imagick:
Use MagickWand to convert, compose, and edit images from the C language. There is also the low-level MagickCore library for wizard-level developers.
http://www.imagemagick.org/script/api.php?ImageMagick=2m69higs264080492m8ttkndb5#c
I'd use Boost.GIL.
If you're on Windows, you could use GDI+.
You could look at ITK (http://www.itk.org). Its primary use is for medical image processing, but it works just as well for processing other images. It's also portable (built using CMake).