Message Boards Message Boards

2
|
6334 Views
|
4 Replies
|
7 Total Likes
View groups...
Share
Share this post:

Does ImageExposureCombine produce a hi bit depth image?

Posted 8 years ago

I need more detail on what ImageExposureCombine does. I have a machine vision application with very high dynamic range. My camera will only output 8 bits per channel. I hope to combine multiple images to achieve at least 16 bits of dynamic range. I want to apply my algorithm on the high bit depth image. I do not want the image tone mapped to look good on an 8 bit display.

Does ImageExposureCombine produce a HDR image, or is it just tone mapping into the display representation?

POSTED BY: Jeff Burns
4 Replies
Posted 8 years ago

It is good to know a function to produce HDR output will be available soon.

My current images were taken by doubling the exposure time with each frame. If I had taken these with a DSLR, I could have used Adobe Camera Raw or Lightroom to create an HDR image. Because the machine vision camera saves the images as bmp files, the exposure meta data is not saved in the files. Adobe products do not like this.

This code seems to do what I need:

ImageAdd@MapIndexed[ImageMultiply[#, (1.0/#2[[1]])] &, MyImageList]]
POSTED BY: Jeff Burns

That would work but it's quite crude. You could try creating a mask for the well exposed parts of each image and do a weighted sum. Something like this

imgList = 
  SortBy[ImageMeasurements[#, "Mean"] &][Image[MyImageList, "Real"]];

ratios = ConstantArray[1/2, Length[imgList]];
compensations = 1 / FoldList[Times, 1, 1/ratios];

midexposure = Map[
    normalExposure[#, {.5, .3}] &,
    ColorConvert[imgList, "Grayscale"]
   ];
normalizedmasks = normalizeImages[midexposure];

scaled = ImageMultiply @@@ 
   Transpose[{imgList, normalizedmasks, compensations}];
ImageAdd[scaled]

Where normalizeImages makes sure the total across the masks for each pixel is 1

normalizeImages[images_] :=
 With[
    {
        tot = ImageAdd @@ images,
        l = Length[images]
    },
    (Image`ImageDivide[#1, tot] &) /@ images
  ]

And normalExposure weights the pixels according to a Gaussian distribution around 0.5 (or whatever you want)

normalExposure[img_, {mean_, sigma_}] :=
 Image`ImageExp[ImageMultiply[
    Image`ImagePower[ImageMultiply[
          ImageSubtract[img,
         mean], 1/sigma], 2], -1]]

If you don't like the result you can experiment with different weighting functions.

ImageExposureCombine is producing a low dynamic range image by merging the "good" parts of each image. Where "good" is a mixture of non super/sub-saturation and good contrast values. The result is equivalent to an already tone mapped HDR image in the sRGB colorspace. The image type is preserved in the output but all the operations are done in 64bits arithmetic therefore if you convert your images to "Real" you will not throw away anything.

At the moment we have no function that outputs an HDR image but one is about to come (11.1 or 11.2).

I think ImageExposureCombine outputs always the same ImageType as the input images. I think if you convert your images like:

newimages = Image[#,"Real32"]& /@ images;
out = ImageExposureCombine[newimages]
ImageType[out]

that should be high bit depth. Other options are "Bit16" instead of "Real32".

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract