I have previously mentioned using the Clahe plugin in ImageJ/Fiji to create a sort of pseudo-HDR image from a 16 bit image from a digital camera.
I set the camera to record a raw image at low contrast to attempt to record as high a range of intensities as possible, then use Clahe to increase local contrast while retaining detail in highlights and shadows.
I recently installed pfstools which includes a lot of command-line tools to convert images and generate HDR images. I thought I would look into whether I could use these tools with RAW images from the camera.
It is possible to convert the RAW to a HDR file using:
pfsindcraw DSC_nnnn.RAW | pfsoutrgbe DSC_nnnn.hdr
When the image has been converted into a suitable HDR format, the different 'tone mapping' commands can be tried to see which ones produce a pleasing result. It can actually be quite difficult getting the balance right between retaining detail and producing an 'over-processed' image which looks too obviously like an HDR photograph.
Simply taking the 16 bit RAW file and adjusting the contrast to show the full range of intensities can result in a flat looking image.
The same image, processed using the Clahe plugin in ImageJ, to retain shadow and highlight details while maintaining good contrast.
Using pfstools tone mapping to increase local contrast and decrease the dynamic range.
Pfstools offers several different ways of converting the HDR file into a 256 bit colour image and a bit more trial and error may be needed to get a good result.