{"id":409,"date":"2013-04-19T23:13:58","date_gmt":"2020-02-18T06:53:26","guid":{"rendered":"https:\/\/redfrontdoor.org\/blg2\/?p=409"},"modified":"2020-02-18T16:51:54","modified_gmt":"2020-02-18T16:51:54","slug":"post-403","status":"publish","type":"post","link":"https:\/\/redfrontdoor.org\/blog\/?p=409","title":{"rendered":"Simulating a laser-based image projector"},"content":{"rendered":"<div style=\"float: right;margin-left: 2em;margin-bottom: 1em\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/kangaroo-256-L.jpg\"><\/div>\n<p>A long time ago, a podcast from <a href=\"http:\/\/www.thenakedscientists.com\/\">The Naked Scientists<\/a> included an <a href=\"http:\/\/www.thenakedscientists.com\/HTML\/content\/interviews\/interview\/1961\/\">interesting interview<\/a> about a new laser projector developed by Light Blue Optics in Cambridge, UK.  It sounded cool, so I found out more about it.  Their website gives an outline of the technology, and from there I was able to find some relevant papers.<\/p>\n<p>This post gives the results of some experimenting I did with their ideas.  The technique is full-colour, using red, green, and blue lasers, but here I work just with greyscale for simplicity.  I&#8217;ll use the image to the right, which I took on a recent trip to Australia.<\/p>\n<h2>The ideas<\/h2>\n<p>The technology, as explained in the interview, &#8216;steers&#8217; the light to where it&#8217;s needed, by diffracting a laser beam.  The interview further explains that they create lots of noisy images, which your eye averages to give the image they&#8217;re trying to project.  In a bit more detail:<\/p>\n<h3>Fourier transform property of a converging lens<\/h3>\n<p>A pleasing property of the universe is that a converging lens performs a 2D spatial Fourier transform of an image on a transparency.  The details are explained, for example, in <a href=\"http:\/\/books.google.ie\/books?id=ow5xs_Rtt9AC\">this book<\/a> (do &#8216;Search inside&#8217; for &#8216;Fourier transforming property&#8217; and follow the hit to p.103).<\/p>\n<p>It seems like we could now build our projector &mdash; simply find the inverse FT of our image, put that on a transparency, and shine laser light through it and a lens.  However, in general the inverse FT is complex-valued, and, the papers tell me, no physical device exists which can give arbitrary amplitude and phase to the light at each pixel.<\/p>\n<h3>&lsquo;0 or &pi;&rsquo; phase-only spatial light modulators<\/h3>\n<p>What does exist is a device which can give a phase shift of 0 or &pi; to the light passing through each pixel, while preserving amplitude.  If we approximate the inverse FT, quantising each point to &plusmn;1 (corresponding to a phase shift of 0 or &pi;), what happens?  We lose a huge amount of information, and when we use the transparency in the projector, the result is mostly noise:<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/single-reconstruction-0.png\"><\/p>\n<p>With a willing attitude, you <em>can<\/em> just about discern some kangaroo-like features, but the image quality has room for improvement.<\/p>\n<h3>Human eyes can&#8217;t see phase<\/h3>\n<p>The next insight that LBO had (as I attempt to retrace their train of thought) was to realise that we don&#8217;t have to reconstruct the exact target image.  The eye doesn&#8217;t care about the phase of the projected image&#8217;s pixels.  From the original target image, we can create an alternative target by applying random phase independently to each pixel.  Then we follow the same process of &#8216;find the inverse FT; quantise it to 0\/&pi; phase; put it into the projector&#8217;.  We get a new very noisy reconstruction, but the point is that we get <em>different<\/em> noise.  Four examples, starting with fresh random phase each time:<\/p>\n<table style=\"margin: auto\">\n<tr>\n<td style=\"padding-right: 1em;padding-bottom: 1.5em\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/single-reconstruction-1.png\"><\/p>\n<td style=\"padding-left: 1em;padding-bottom: 1.5em\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/single-reconstruction-2.png\"><\/p>\n<tr>\n<td style=\"padding-right: 1em;padding-bottom: 1.5em\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/single-reconstruction-3.png\"><\/p>\n<td style=\"padding-left: 1em;padding-bottom: 1.5em\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/single-reconstruction-4.png\"><\/td>\n<\/td>\n<\/tr>\n<\/td>\n<\/td>\n<\/tr>\n<\/table>\n<h3>Let the human eye average many reconstructions<\/h3>\n<p>The final piece is to project many of these noisy reconstructions in very quick succession.  The viewer&#8217;s eye, by &#8216;persistence of vision&#8217;, then averages them, and perceives the target image.  Our 0-or-&pi; phase-only modulator has to have a very high refresh rate for this to work as this is all in the context of video projection.  We need 25 target frames per second, each of which needs many reconstructions.<\/p>\n<h2>Python code<\/h2>\n<p>With the ideas in place, we can use the following code to simulate the physical process of creating one noisy reconstruction:<\/p>\n<pre>\nimport numpy as N\nimport numpy.random as RND\nfrom numpy.fft import fft2, ifft2\n\n# Input image is in 'target'.\n\n# Each pixels keeps its magnitude but gets random phase:\nphi = RND.uniform(low = 0.0, high = 2.0 * N.pi, size = target.shape)\nphase_multiplier = N.exp((0.0 + 1.0j) * phi)\nrandomly_phased_target = target * phase_multiplier\n\n# Find the display which, when FT'd, gives the random-phase target:\ninv_ft = ifft2(randomly_phased_target)\n\n# Quantise to just +-1, i.e., phase of 0 or pi:\ninv_ft_pm1 = N.sign(N.real(inv_ft))\n\n# Find the image after FT and projection:\nnoisy_reconstruction = fft2(inv_ft_pm1)\n<\/pre>\n<p>We run this as many times as we like, to generate many noisy reconstructions.  (I used it to generate the examples above.)<\/p>\n<h2>Results<\/h2>\n<p>As we take the average of more and more samples, the original picture emerges clearly from the noise:<\/p>\n<table style=\"margin: auto\">\n<tr>\n<td style=\"padding-right: 1em\">\n<p style=\"margin-bottom: 9px\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/reconstruction-0005.png\"><\/p>\n<p style=\"margin-top: 9px;text-align: center\">5 samples<\/p>\n<td style=\"padding-left: 1em\">\n<p style=\"margin-bottom: 9px\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/reconstruction-0010.png\"><\/p>\n<p style=\"margin-top: 9px;text-align: center\">10 samples<\/p>\n<tr>\n<td style=\"padding-right: 1em\">\n<p style=\"margin-bottom: 9px\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/reconstruction-0100.png\"><\/p>\n<p style=\"margin-top: 9px;text-align: center\">100 samples<\/p>\n<td style=\"padding-left: 1em\">\n<p style=\"margin-bottom: 9px\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/reconstruction-1000.png\"><\/p>\n<p style=\"margin-top: 9px;text-align: center\">1000 samples<\/p>\n<\/td>\n<\/td>\n<\/tr>\n<\/td>\n<\/td>\n<\/tr>\n<\/table>\n<h3>Conjuage image removal<\/h3>\n<p>This summary omits one important detail: The transparency is purely real, taking values just in {-1, +1}, so its FT is conjugate-symmetric.  This manifests itself as a 180&deg;-rotated copy of the image superimposed on the projection.  Various clues in the papers suggest that one simple approach to this is to pad the target with black, and use only half of the projection, which is what I did for these experiments.<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"\/blog\/wp-content\/uploads\/2013\/04\/conjugate-image-treatment.png\"><\/p>\n<h2>Conclusions<\/h2>\n<p>It works!<\/p>\n<p>LBO apparently <a href=\"http:\/\/www.cabume.co.uk\/software\/lbo-pivot-takes-it-from-hardware-to-soft-and-jobs-growth.html\">&#8216;sidelined its holographic laser projector to focus on software for touch technology&#8217;<\/a> in mid-2012, and their web-site has no news more recent than that, so perhaps the technique was not commercially viable.  All the same, it&#8217;s a very interesting fusion of ideas.<\/p>\n<h2>Reference<\/h2>\n<p>This book chapter (under a Creative Commons licence) gives most of the details:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.intechopen.com\/books\/advanced-holography-metrology-and-imaging\/computer-generated-phase-only-holograms-for-real-time-image-display\">Computer-Generated Phase-Only Holograms for Real-Time Image Display.  <i>Edward Buckley<\/i><\/a>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Some experiments to explore the ideas used by an image projector using the Fourier transform as its underlying mechanism.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-409","post","type-post","status-publish","format-standard","hentry","category-uncategorized","comments-off"],"_links":{"self":[{"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=409"}],"version-history":[{"count":1,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/409\/revisions"}],"predecessor-version":[{"id":2182,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/409\/revisions\/2182"}],"wp:attachment":[{"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/redfrontdoor.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}