<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4252649934180117562</id><updated>2011-08-27T05:48:06.266-07:00</updated><title type='text'>Random Things</title><subtitle type='html'>Some interesting technical things I came across.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://42smurf.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4252649934180117562/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://42smurf.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Chris Petrich</name><uri>http://www.blogger.com/profile/11392282610594797747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4252649934180117562.post-7072777209732217290</id><published>2010-11-29T23:09:00.000-08:00</published><updated>2010-12-26T22:44:45.530-08:00</updated><title type='text'>Some Garmin GPS receivers output wrong coordinates in NMEA sentence</title><content type='html'>&lt;h2&gt;Executive Summary&lt;/h2&gt;Some Garmin GPS receivers get a simple mathematical conversion wrong that causes them output incorrect coordinates in their NMEA sentences. The only NMEA data streams I looked at are those of the &lt;a href="https://buy.garmin.com/shop/shop.do?pID=175"&gt;Garmin GPS 16&lt;/a&gt; and &lt;a href="https://buy.garmin.com/shop/shop.do?pID=223&amp;amp;pvID=794"&gt;Garmin GPS 18 OEM&lt;/a&gt;, and those suffer from the software bug described below.&lt;br /&gt;&lt;u&gt;Example:&lt;/u&gt; walking slowly and logging one coordinate pair per second as output in the NMEA sentences of the GPS 16, the following records were obtained.&lt;br /&gt;&lt;div style="background-color: #f4cccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;29 March 2009&lt;/b&gt;&lt;br /&gt;Latitude (N) &amp;nbsp; Longitude (W)&lt;br /&gt;DDMM.FFFF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DDDMM.FFFF&lt;br /&gt;7122.0816&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15631.9960&lt;br /&gt;7122.0815&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15631.9978&lt;br /&gt;7122.0810&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 156&lt;span style="background-color: #9fc5e8;"&gt;32.9996&lt;/span&gt;&lt;br /&gt;7122.0806&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15632.0016&lt;br /&gt;7122.0804&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15632.0025&lt;/div&gt;&lt;br /&gt;And another example, walking even slower.&lt;br /&gt;&lt;div style="background-color: #f4cccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;b&gt;12 May 2010&lt;/b&gt;&lt;br /&gt;Latitude (N)&amp;nbsp; Longitude (W)&lt;br /&gt;DDMM.FFFF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DDDMM.FFFF&lt;br /&gt;7122.2581&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15630.9982&lt;br /&gt;7122.2583&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15630.9989&lt;br /&gt;7122.2584&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15630.9991&lt;br /&gt;7122.2585&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15630.9990&lt;br /&gt;7122.2585&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15630.9989&lt;br /&gt;7122.2587&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15630.9991&lt;br /&gt;7122.2590&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 156&lt;span style="background-color: #9fc5e8;"&gt;31.9996&lt;/span&gt;&lt;br /&gt;7122.2590&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 156&lt;span style="background-color: #9fc5e8;"&gt;31.9996&lt;/span&gt;&lt;br /&gt;7122.2591&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15630.9995&lt;br /&gt;7122.2593&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 156&lt;span style="background-color: #9fc5e8;"&gt;31.9999&lt;/span&gt;&lt;br /&gt;7122.2595&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15631.0000&lt;br /&gt;7122.2596&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15631.0002&lt;/div&gt;&lt;br /&gt;&lt;h2&gt;Details&lt;/h2&gt;GPS receivers calculate their position relative to a set of satellites in Euclidean space, i.e. the same coordinate space we are familiar with since high school. I think Garmin receivers do a nice job at that, in particular considering their price. In my limited experience, all Garmin GPS receivers seem to do this correctly. While presumably all Garmin receivers display and store correct coordinates, at least some receivers occasionally (but systematically) output wrong coordinates through their serial interface. If you do not connect anything to your Garmin that receives GPS coordinates in real time then you can stop reading here and continue enjoying your purchase. Have fun.&lt;br /&gt;&lt;br /&gt;For those of use who do connect stuff to our Garmin receivers, we can sometimes choose between two data formats: the proprietary Garmin binary format, and the standard (ASCII) NMEA sentences. This blurb applies to data transferred from the GPS receiver &lt;i&gt;in NMEA sentences, only&lt;/i&gt;. From what I can tell, the binary data stream is correct.&lt;br /&gt;&lt;br /&gt;Some Garmin GPS receivers are able to output data through a serial (and recently USB) interface. The non-proprietary format used follows NMEA 0183 specifications. In this standard, data are transmitted as plain ASCII text. Coordinates are represented in a somewhat peculiar format as &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DDMM.FFFF&lt;/span&gt;, where &lt;span style="font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;D&lt;/span&gt; is decimal degrees, &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;M&lt;/span&gt; is minutes, and &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;F&lt;/span&gt; is fractional minutes. For example, consider 71.36 degrees. This is 71 degrees 21 minutes and 36 seconds, i.e. 71 degrees 21.6 minutes, and would be transmitted as &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;7121.6000&lt;/span&gt;. At least the following OEM receivers have a software bug that does the conversion to the &lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;DDMM.FFFF&lt;/span&gt; NMEA format wrong: &lt;b&gt;Garmin GPS 16&lt;/b&gt; (discontinued) and &lt;b&gt;Garmin GPS 18 OEM-PC&lt;/b&gt; (still available as of 2010). Note that I am not familiar with the NMEA output of the Garmin GPS 18&lt;b&gt;x&lt;/b&gt; or any other Garmin receiver.&lt;br /&gt;&lt;br /&gt;At the heart of the issue seems to be a combination of sloppy programming in conjunction with the use of low resolution (single-precision, IEEE 754) floating point arithmetic.&lt;br /&gt;&lt;br /&gt;Consider the following case: we attach an external data logger to a Garmin receiver that reads the NMEA sentences to keep track of our position while we walk very slowly, at something like 0.5 meters per second, due North. We may find the following (this result is simulated with the script below): &lt;br /&gt;&lt;div style="background-color: #f4cccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;actual latitude &amp;nbsp; &lt;i&gt;output&lt;/i&gt;&lt;i&gt; in NMEA sentence&lt;/i&gt;&lt;/div&gt;&lt;div style="background-color: #f4cccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;in degrees&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;in DDMM.FFFF format&lt;/i&gt;&lt;/div&gt;&lt;div style="background-color: #f4cccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71.359976&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;7121.5986&lt;/i&gt;&lt;br /&gt;71.359982&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;7121.5991&lt;/i&gt;&lt;br /&gt;71.359988&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;7121.5991&lt;/i&gt;&lt;br /&gt;71.359994&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;7121.5995&lt;/i&gt;&lt;br /&gt;71.360000&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;7121.6000&lt;/i&gt;&lt;br /&gt;71.360006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;7121.6004&lt;/i&gt;&lt;br /&gt;71.360012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;7121.6004&lt;/i&gt;&lt;br /&gt;71.360018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;7121.6009&lt;/i&gt;&lt;/div&gt;So far so good. We see that the conversion took place with limited precision but otherwise everything is fine.&lt;br /&gt;&lt;br /&gt;Doing the same experiment a bit further to the South we find (this result is simulated with the script below): &lt;br /&gt;&lt;div style="background-color: #f4cccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;actual latitude &amp;nbsp; &lt;i&gt;output&lt;/i&gt;&lt;i&gt; in NMEA sentence&lt;/i&gt;&lt;/div&gt;&lt;div style="background-color: #f4cccc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;in degrees&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;in DDMM.FFFF format&lt;/i&gt;&lt;/div&gt;&lt;div style="background-color: #f4cccc;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71.349982 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7120.9989&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71.349988&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7120.9994&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71.349994&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7120.9994&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71.350000 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 71&lt;span style="background-color: #9fc5e8;"&gt;21.9999&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71.350006&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7121.0003&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71.350012&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7121.0008&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;71.350018&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 7121.0012&lt;/span&gt;&lt;/div&gt;Clearly, a rounding error occurred in the conversion that increased the minutes from 20 to 21 before the fractional minutes actually rolled over to 0.&lt;br /&gt;&lt;br /&gt;I have seen this error occur over and over again in both latitude and longitude in the region around Barrow, Alaska. However, I bet this problem is more general and will be observable at certain minutes all around the world, including in San Francisco (37° 46' N), and New York (40° 31' N) — in case somebody would like to check.&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Reverse Engineering&lt;/h2&gt;How can we reproduce this error? Well, for example with the following Python 2.x script:&lt;br /&gt;&lt;div style="background-color: #fff2cc; font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; font-size: small; line-height: 100%;"&gt;&lt;pre&gt;import numpy as np&lt;br /&gt;# simulate the roll-over error in&lt;br /&gt;# Garmin's degree / minute conversion&lt;br /&gt;# script written by Chris Petrich, 2010&lt;br /&gt;&lt;br /&gt;# this seems to happen if minutes are calculated in two&lt;br /&gt;# different ways in conjunction with limited precision&lt;br /&gt;&lt;br /&gt;def convert(degrees):&lt;br /&gt;    # enforce use of single precision (i.e. f4)&lt;br /&gt;    degrees = degrees.astype('f4')&lt;br /&gt;    v60 = np.array(60., dtype='f4')&lt;br /&gt;    &lt;br /&gt;    # integer degrees&lt;br /&gt;    deg = np.floor(degrees)&lt;br /&gt;    # get fractional minutes:&lt;br /&gt;    minute = (degrees - deg) * v60    &lt;br /&gt;    frac = minute - np.floor(minute)&lt;br /&gt;    &lt;br /&gt;    # now calculate whole minutes differently:&lt;br /&gt;    minute = np.floor( degrees*v60 - deg*v60 )&lt;br /&gt;&lt;br /&gt;    # get the number before the dot:&lt;br /&gt;    whole = int( deg ) * 100 + int( minute )&lt;br /&gt;    &lt;br /&gt;    return '%.4i.%.4i' % (whole, int(frac*10000))&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;# generate a few coordinates:&lt;br /&gt;delta = .000006&lt;br /&gt;ref = 71 + 21/60.&lt;br /&gt;test_degrees = np.arange(ref-5*delta, ref+5*delta, delta)&lt;br /&gt;# and output data&lt;br /&gt;print "GARMIN's rounding error"&lt;br /&gt;print 'decimal deg,  DDMM.FFFF (NMEA)'&lt;br /&gt;for deg in  test_degrees:&lt;br /&gt;    print deg, '%s' % convert(deg)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;h2&gt;Remedy&lt;/h2&gt;The remedy may be obvious: if this bugs you then write to Garmin and request a firmware patch for your receiver. Happy geo-locating!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4252649934180117562-7072777209732217290?l=42smurf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://42smurf.blogspot.com/feeds/7072777209732217290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4252649934180117562&amp;postID=7072777209732217290' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4252649934180117562/posts/default/7072777209732217290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4252649934180117562/posts/default/7072777209732217290'/><link rel='alternate' type='text/html' href='http://42smurf.blogspot.com/2010/11/some-garmin-gps-receivers-output-wrong.html' title='Some Garmin GPS receivers output wrong coordinates in NMEA sentence'/><author><name>Chris Petrich</name><uri>http://www.blogger.com/profile/11392282610594797747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4252649934180117562.post-1150864824943624991</id><published>2008-11-13T10:46:00.000-08:00</published><updated>2009-01-22T12:27:27.690-08:00</updated><title type='text'>Techical aspects about IR photography with digital cameras</title><content type='html'>I use a digital SLR camera (DSLR), Nikon D60, converted by &lt;a href="http://lifepixel.com/"&gt;lifepixel.com&lt;/a&gt; to take photos in the near infra-red (IR), i.e. about 720 nm - 1200 nm (this is NOT thermal infrared: thermal images are taken around 10000 nm). The conversion replaces the IR block filter between lens and CCD with an IR pass filter. When I look through the view finder I see "normal" colors, but what I see on the display after taking a shot is a first rendition of an infrared image.&lt;br /&gt;&lt;br /&gt;The conversion significantly alters the response of the color receptors of the R, G, and B channels: instead of reflecting the red, green, and blue components of a scene, the combination of the IR-pass filter and the dye inside of the receptors leads to the following spectral sensitivity (my measurements were inspired by &lt;a href="http://www.samirkharusi.net/spectrograph.html"&gt;&lt;span style="text-decoration: underline;"&gt;Samir Kharusi&lt;/span&gt;&lt;/a&gt;):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_kvy0DvCr2h0/SRyBGucFehI/AAAAAAAAAAU/R422_k83vAI/s1600-h/IR_CCD_spectral_response_small.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 270px;" src="http://2.bp.blogspot.com/_kvy0DvCr2h0/SRyBGucFehI/AAAAAAAAAAU/R422_k83vAI/s400/IR_CCD_spectral_response_small.jpg" alt="" id="BLOGGER_PHOTO_ID_5268227616661666322" border="0" /&gt;&lt;/a&gt;The response of the R, G, and B-channels are red, green and blue shaded curves, respectively. First off, we see that R, G, and B channels have different spectral response curves, i.e. we are actually able to capture with this setup something like color (the thin, light red and green lines are examples for spectral separation calculated from a linear combination of the R, G, and B channels). Most notable, the R channel has a response from 720 nm to the limit due to the bandgap of the Silicon CCD; the B channel is sensitive from 800 nm on. Note the dominance of the R-channel: any light in the near IR that hits the sensor and triggers a response of G or B channel will also trigger a response of the R channel. Hence, we will probably want to use a custom white balance: if we tell the camera to use a build-in white balance (designed for visible light, not near-IR) we'll get a photo that looks very red. We also see that the R channel is most sensitive in the shorter wavelengths while the B channels is most sensitive in the longer wavelengths. Hence, we may want to swap color channels and display the R-channel as blue and the B-channel as red.&lt;br /&gt;&lt;h3&gt;Camera white balance&lt;/h3&gt;It seems that most people set a custom white balance in IR by taking a photo of green foliage (e.g. grass) instead of something white [in D60: Shooting Menu -&gt; White balance -&gt; Preset manual -&gt; Measure]. This will render foliage white on a JPG straight-out the camera. I like this choice: foliage tends to have a flat reflectivity spectrum in the near IR, i.e. even if we were able to see colors in the near IR we would probably see foliage as gray or white.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Post-processing of JPGs&lt;br /&gt;&lt;/h3&gt;&lt;br /&gt;My program of choice for basic image manipulations is the free &lt;a href="http://www.irfanview.com/"&gt;IrfanView&lt;/a&gt;. The very minimum amount of post-processing I do is swapping the R and B channels of my JPGs (Image -&gt; Swap Colors -&gt; RGB to BGR). Hence, we can interpret the resulting image as follows: if an object looks reddish it has an infrared color, and if an object looks blueish it has more of a visible (deep-red) than infrared tone. I also like to increase the saturation a bit to make the photo a more dramatic (Image -&gt; Color corrections...). Here's an example:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_kvy0DvCr2h0/SRyLDwV7UkI/AAAAAAAAAAc/mUu74JtHrzg/s1600-h/DSC_0705_IR_BGR_adj.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 268px;" src="http://1.bp.blogspot.com/_kvy0DvCr2h0/SRyLDwV7UkI/AAAAAAAAAAc/mUu74JtHrzg/s400/DSC_0705_IR_BGR_adj.jpg" alt="" id="BLOGGER_PHOTO_ID_5268238560749376066" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;h3&gt;Colors in near-IR&lt;/h3&gt;If we apply a white balance based on a green surface, and map the R and B channels to blue and red, respectively (as outlined above), then we tend to get the following colors:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;white/gray: thick, translucent clouds; snow; leaves; grass&lt;/li&gt;&lt;li&gt;blue: clear ice; water; clear sky; skin&lt;br /&gt;&lt;/li&gt;&lt;li&gt;red: bark; dry grass; some (often black) synthetic materials; some sun glasses&lt;/li&gt;&lt;/ul&gt;Due to the contrast between snow and ice at longer wavelengths, near-IR photos (typ. &gt; 800 nm) have long been used in science to photograph glaciers. For the same reason, near-IR photos of sea ice surfaces often reveal more structural detail. This is illustrated below; the exposed edges of ice blocks have very little red-components, i.e. they are very dark above 800 nm compared to the surrounding snow. I took these photos under overcast skies at the edge of landfast sea ice in &lt;a href="http://www.panoramio.com/photo/10432762"&gt;Wales, Alaska&lt;/a&gt; on May 6, 2008:&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Near-IR:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_kvy0DvCr2h0/SRysnxnW-8I/AAAAAAAAABU/B0PQAY5BUvE/s1600-h/cIR_dsc_0280_pgm_adjusted_small.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 267px;" src="http://4.bp.blogspot.com/_kvy0DvCr2h0/SRysnxnW-8I/AAAAAAAAABU/B0PQAY5BUvE/s400/cIR_dsc_0280_pgm_adjusted_small.jpg" alt="" id="BLOGGER_PHOTO_ID_5268275463449934786" border="0" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Visible:&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_kvy0DvCr2h0/SRysib-KA6I/AAAAAAAAABM/s3MKZsGXOHI/s1600-h/DSC_0927_small.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 266px;" src="http://2.bp.blogspot.com/_kvy0DvCr2h0/SRysib-KA6I/AAAAAAAAABM/s3MKZsGXOHI/s400/DSC_0927_small.jpg" alt="" id="BLOGGER_PHOTO_ID_5268275371740627874" border="0" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;JPG vs. raw image format&lt;/h3&gt;I usually save near-IR images in RAW format because I usually want to adjust color balance and exposure. The RAW image (Nikon .nef file) contains a thumb nail jpg which can be displayed and extracted with IrfanView. Of course it doesn't hurt to have the camera save both JPG and RAW at the same time.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Exposure setting&lt;/h3&gt;This is tricky with most DSLRs because light is metered independently of the CCD and filter in front of it. Hence, the converted D60 continues to meter light in the visible, and the brightness of a scene in the visible tells us little about the brightness in the near-IR. The amount of IR light increases significantly as we move from overcast skies to clear skies (it is even higher under tungsten light, and much lower under fluorescent light). In order to prevent the R-channel from saturating, I set the exposure compensation on my camera to something like 0 to -1 EV under overcast skies, 0 to -2 EV under clear skies, much lower under indoor tungsten lighting, and much higher (e.g. +3 EV or more) under fluorescent light. Actually, forget these numbers and try for yourself: it depends on the scene. Experimentation is my friend.&lt;br /&gt;&lt;br /&gt;Optimal exposure settings depend on what's going to happen with the photo: if I am only interested in near-IR black-and-white photography then I may be most interested in wavelengths above 850 nm. In this case I will expose appropriately for the B channel and deliberately overexpose R and G channels.&lt;br /&gt;&lt;br /&gt;Unfortunately, it is very difficult to tell from the display of the D60 whether an image is overexposed (it may be impossible). I find that I have to look at the RAW image data to tell for sure; so I always underexpose when in doubt. Underexposure does not cause artifacts although the picture is dark and there is more noise in the frame. (The RAW images of the D60 are 12 bit.)&lt;br /&gt;&lt;br /&gt;In order to analyze the raw image file I use &lt;a href="http://www.cybercom.net/%7Edcoffin/dcraw/"&gt;dcraw&lt;/a&gt; (free) to convert Nikon's raw NEF image to the well-documented 16-bit PGM format [&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;dcraw -D -4 filename.nef&lt;/span&gt;&lt;/span&gt;&lt;filename.nef&gt;]. I extract a crude histogram with a short C program that I'd be happy to post here if only I knew how.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Focus&lt;/h3&gt;The focal point of a lens depends on the wavelength. Quality lenses are designed to compensate for this from 400 nm to 700 nm; however, we use them around 900 nm. Lifepixel performs an adjustment of the focal point for a specified lens set to a specific focal length (I think they do 50 mm by default). However, we can expect to get slightly out-of-focus (soft) images when we use different equipment. Usually, I use a 18-55 mm lens and didn't notice serious issues here. However, with a 200 mm lens I have to manually adjust the focus slightly after autofocussing since the subject is obviously out of focus. (This is easy to detect in playback with the zoom function.)&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Hot spot artifact&lt;/h3&gt;I understand that there is reflection of light between the "polished" CCD and the lens in the camera. Manufacturers make sure that this does not affect the image for visible light. However, a big ugly red spot may appear if we use an unfortunate combination of camera and lens for infrared photography. I use the following Nikon lenses without problems on my converted Nikon D60 body:&lt;br /&gt;&lt;/filename.nef&gt;&lt;ul&gt;&lt;li&gt;&lt;filename.nef&gt;&lt;a href="http://www.kenrockwell.com/nikon/1855.htm"&gt;AF-S DX Zoom-NIKKOR 18-55mm f/3.5-5.6G ED II&lt;/a&gt; (bundled with D40)&lt;br /&gt;&lt;/filename.nef&gt;&lt;/li&gt;&lt;li&gt;&lt;filename.nef&gt;&lt;a href="http://www.kenrockwell.com/nikon/18-55-ii.htm"&gt;AF-S DX NIKKOR 18-55mm f/3.5-5.6G VR&lt;/a&gt; (bundled with D60)&lt;br /&gt;&lt;/filename.nef&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.kenrockwell.com/nikon/18200.htm"&gt;&lt;filename.nef&gt;AF-S DX VR Zoom-NIKKOR 18-200mm f/3.5-5.6G IF-ED&lt;/filename.nef&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Choice of camera and lens&lt;/h3&gt; I was looking for a system with the following key features&lt;br /&gt;&lt;ul&gt;&lt;li&gt;low noise&lt;br /&gt;&lt;/li&gt;&lt;li&gt;not too expensive&lt;br /&gt;&lt;/li&gt;&lt;li&gt;free of hot spots&lt;/li&gt;&lt;li&gt;does white balance of IR images properly&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The D60 bundled with the 18-55mm lens seemed to have been the best compromise back in April 2008. The CCD chip is significantly bigger than what is used in "point-and-shoot" cameras; this is where size does matter: the bigger the pixels the higher the signal-to-noise ratio. A full frame (FX) camera would have been even better but considering point 2, price, this was not an option. Seeing that the D60 came bundled with the relatively cheap and good 18-55 mm lens, and that this lens actually produces no hot spots there seemed to have been only one alternative: the D40(x). However, the D40 uses an older image processor that does not allow to define the  whitebalance based on a green image...&lt;br /&gt;Problem with Canon was that their lenses of suitable focal lengths happened to produce hot spots unless I was willing to pay big bucks. If I were to buy a new system today I'd take into account LiveView capabilities in today's DSLRs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4252649934180117562-1150864824943624991?l=42smurf.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://42smurf.blogspot.com/feeds/1150864824943624991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4252649934180117562&amp;postID=1150864824943624991' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4252649934180117562/posts/default/1150864824943624991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4252649934180117562/posts/default/1150864824943624991'/><link rel='alternate' type='text/html' href='http://42smurf.blogspot.com/2008/11/techical-aspects-about-ir-photography.html' title='Techical aspects about IR photography with digital cameras'/><author><name>Chris Petrich</name><uri>http://www.blogger.com/profile/11392282610594797747</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_kvy0DvCr2h0/SRyBGucFehI/AAAAAAAAAAU/R422_k83vAI/s72-c/IR_CCD_spectral_response_small.jpg' height='72' width='72'/><thr:total>1</thr:total></entry></feed>
