Daily Update: HDR Image

Took my camera out tonight and shot a few photos.  At first my camera wasn’t working well, since it is starting to fritz on me by zooming in and out by itself.  Eventually this went away and I was able to take a few shots.

I stumbled across Stuck In Customs again for the nth time by accident.  Have always been amazed by the images he takes and then post process with his HDR technique.  Decided I’d try part of the process with a set of 3 images I took of a cool orange motorcycle.

My scene isn’t the best candidate since it is mostly evenly lit.  Anyways, I loaded the 3 images up in Photomatix and ended up liking this:

1st try at HDR
1st try at HDR. Click on the image for larger view.
Original image.
Original image.

 I have also been reading a lot about DSLR cameras over the last couple days.  I know enough about photography that my current camera(Fuji S7000)  is starting to limit me.  Specifically looking at the Nikon D90 and D300.  The D300 gets me a sturdier body, better menu layout and control buttons, more than 3 images when bracketing, better IQ, and some weather proofing.  Also been looking at the Tokina 12-24mm wide angle lens and then trying to figure out what 1 or 2 other lenses I should pair with it.  It is amazing how the lenses can cost more than the cameras.  I guess it makes sense, since a bad lens produces poor images and it’s all about the images!  I need to get to a store and hold these things. 

Anyone have any suggestions on an additional 2 lenses — 2 zooms or 1 zoom and a prime?  Would like to get up to a comparable zoom like I have on my current camera of around 200mm.

Initial Raw Image Results

I’m very excited here!  I wrote a test application to read the raw RAF images that are produced by my Fuji s7000 digital camera.  Below I’ll show in general the different steps I had to go through.  This post will be short on details.  A Java image reader class will follow in a later post.  Some basic background is needed here, before the pretty pictures are shown.

One feature of the Fuji s7000 camera is that it can output the image as a raw file.  Most high-end cameras have this option.  This raw file includes all the CCD sensor information unmodified.  All cameras that output to JPG perform different sharpening and other image processing operations on the image.  The benefit is that these raw files allows one to perform these operations yourself with an application supplied with your camera, or other software like the Adobe Camera Raw program within Photoshop or dcraw and there is the possibility that the final image result will be better than what you would get directly from the camera.  Raw files also allow access to 12 bit color vs 8 bit (4096 colors vs 256) at each color point, so there is the opportunity to recover shadows or blown-out highlights.  In general you have more flexibility with the image.  Now comes the fun part!

Raw images only have 1 color at each pixel point either red, green or blue.  To be able to recognize much of anything in the image the missing 2 colors must be computed before the image will look good on screen or saved out to a JPG, BMP or similar.

Note: All images I’m showing are only a 50×50 pixel crop of the main raw image.  This crop was then blown-up 5x so that the individual pixels can be seen.  The image shows part of a tie-dyed shirt sleave.

I wanted to be able to see what I was dealing with so I wrote the data out to a standard image file.  You can see that it doesn’t look like all that much.  The arrangement of pixels you see is called a Bayer Pattern.  There is twice as many green pixels as red and blue.

1_raw_directly_from_camera_cropped
Raw data from camera.

 The data then needs to be corrected for white balance by scaling the value of the colors by certain amounts.

2_raw_after_wb_and_scaling_colors_within_int_range_cropped
After image corrected for whitebalance.

 Then the big step, demosaicking the image.  To demosaic the image I used the Bilinear Interpolation algorithm, this algorithm takes the average of the known pixels colors surrounding the current pixel for any color values its missing.  For instance if the algorithm is at a blue pixel it takes the average of the 4 red colors surrounding it to figure out what this pixels red value should be.  Similiarly for the green value.  This produces a much more pleasing image that is closer to the final result.

3_raw_after_bilinear_demosaicking_cropped
Image after it was demosaicked using bilinear interpolation.

 Lastly, the image is in the RGB color space right now, and monitors and cameras and most common file formats use the sRGB color space, so I needed to correct for that.  This results in the below image.

4_raw_after_RGB_to_sRGB_conversion_cropped
After converting to the sRGB colorspace.

A further post will detail more specifics related to dealing with the RAF format produced by the Fuji s7000, resources I used, and how I figured out how to read the file format.

Starting Point

I’m constantly thinking about new projects and slowly working on the ones I’ve started.  I would like to share the issues I work through and the new things I learn while working on these projects.  You’ll be able to learn from my posts, and we can get into a discussion that will help all of us further our understanding of the topics.  We all know that the internet is a great resource, and I’d like to contribute to it in my little way.

Possible new posts coming up:

  • Demosaicing raw images
  • Fuji s7000 camera raw image file format with a Java image reader
  • Image Processing: Filters, Histograms, Masks, Brushes
  • JUnit testing
  • Java image and file browser with support for dynamic thumbnail sizes
  • Java image viewer with zooming
  • Fonts and custom text in Java
  • My decision process for choosing a file format for my image and document reader
  • Biking in Minnesota
  • My art from grade school. Why did they not tell me to press harder on the crayons and color pencils?
  • Book reviews. 
  • Yes, and there will be more — when I get my thoughts and notes in order!

I’m sure I will find much more than the above to write about, and since posts will be detailed there will be multiple posts about each topic.  I hope the things I write about will help some of you.  I’ll be growing in my understanding of these topics as time passes, just like you did or are.  Please point out my trouble-spots, and how I can fix them, and what I should read to get better understanding of the topic.  Let’s help each other learn here.

Let me know if any of the above topics strike your fancy.  If you put a legit email in for your comment I’ll try and let you know personally when I post about the topic.

Out for now,  have a great end of the week!

-Adam J. Bavier