<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Matt Montag</title>
	<atom:link href="http://www.mattmontag.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mattmontag.com</link>
	<description>Sound, music, perception, and interaction</description>
	<lastBuildDate>Thu, 26 Jan 2012 01:37:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Music Streaming Snapshot</title>
		<link>http://www.mattmontag.com/music/music-streaming-snapshot?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=music-streaming-snapshot</link>
		<comments>http://www.mattmontag.com/music/music-streaming-snapshot#comments</comments>
		<pubDate>Fri, 20 Jan 2012 01:03:42 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=635</guid>
		<description><![CDATA[Monthly Users According to Facebook - January 2012 Service Launch Date Monthly Users Spotify Oct 2008 13,200,000 Pandora Jan 2000 8,900,000 SoundCloud Oct 2008 2,500,000 Grooveshark Jan 2006 1,100,000 Bandcamp Sep 2008 990,000 MOG Dec 2009 200,000 Slacker Jun 2007 150,000 Rdio Aug 2010 70,000 Rhapsody Dec 2001 50,000 Google Music Nov 2011 1 (again, [...]]]></description>
			<content:encoded><![CDATA[<h3>Monthly Users According to Facebook - January 2012</h3>
<table>
<tr>
<th>Service</th>
<th>Launch Date</th>
<th>Monthly Users</th>
</tr>
<tr>
<td>Spotify</td>
<td>Oct 2008</td>
<td>13,200,000</td>
</tr>
<tr>
<td>Pandora</td>
<td>Jan 2000</td>
<td>8,900,000</td>
</tr>
<tr>
<td>SoundCloud</td>
<td>Oct 2008</td>
<td>2,500,000</td>
</tr>
<tr>
<td>Grooveshark</td>
<td>Jan 2006</td>
<td>1,100,000</td>
</tr>
<tr>
<td>Bandcamp</td>
<td>Sep 2008</td>
<td>990,000</td>
</tr>
<tr>
<td>MOG</td>
<td>Dec 2009</td>
<td>200,000</td>
</tr>
<tr>
<td>Slacker</td>
<td>Jun 2007</td>
<td>150,000</td>
</tr>
<tr>
<td>Rdio</td>
<td>Aug 2010</td>
<td>70,000</td>
</tr>
<tr>
<td>Rhapsody</td>
<td>Dec 2001</td>
<td>50,000</td>
</tr>
<tr>
<td>Google Music</td>
<td>Nov 2011</td>
<td>1 (again, according to Facebook)</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>iTunes</td>
<td></td>
<td>19,000,000 likes (typically 5x monthly users)</td>
</tr>
<tr>
<td>Amazon MP3</td>
<td></td>
<td>180,000 likes</td>
</tr>
</table>
<p>-</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/music/music-streaming-snapshot/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Universal&#039;s Audible Watermark</title>
		<link>http://www.mattmontag.com/music/universals-audible-watermark?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=universals-audible-watermark</link>
		<comments>http://www.mattmontag.com/music/universals-audible-watermark#comments</comments>
		<pubDate>Tue, 10 Jan 2012 22:43:26 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=620</guid>
		<description><![CDATA[A while ago I posted my confusion about Weird Spotify Compression Artifacts. It turns out the artifacts are not due to compression, but a result of audio watermarks that Universal Music Group embeds in all of their digitally distributed tracks. This includes tracks resold in lossless formats. The artifacts appear on UMG tracks at Rdio, [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I posted my confusion about <a href="http://www.mattmontag.com/music/weird-spotify-compression-artifacts">Weird Spotify Compression Artifacts</a>. It turns out the artifacts are not due to compression, but a result of audio watermarks that <a href="http://www.universalmusic.com/labels">Universal Music Group</a> embeds in all of their digitally distributed tracks.  <b>This includes tracks resold in lossless formats.</b> The artifacts appear on UMG tracks at Rdio, Spotify, iTunes, Amazon, and anywhere else the tracks are distributed. I have also heard UMG's watermarks over FM radio, and that is no mistake since the watermark originated as a way to track promotional releases. Universal Music labels include Interscope, The Island Def Jam, Universal Republic, Verve, GRP, Impulse!, Decca, Deutsche Grammophon, etc.</p>
<p>Just to show that it's not limited to Spotify, here is an example of the <a href="http://www.passionato.com/preview/WY147a0c9f66172/">watermark artifacts</a> through another distributor.</p>
<h2>What the watermark sounds like</h2>
<p><a href="http://www.mattmontag.com/images/watermarked_full.png"><img src="/images/watermarked_full_thumb.png" class="aligncenter size-full"></a><br />
<small>Spectrogram of the difference between a watermarked and unwatermarked UMG track. The energy is concentrated in two bands between about 1 khz and 3.5 khz - where the human ear is most sensitive.</small></p>
<p>The watermark scheme modulates the total energy in two different bands, 1khz to 2.3 khz and 2.3 to 3.6 khz. This is known as a spread spectrum watermark.  The energy is concentrated in the most perceptually sensitive frequencies because that makes it more difficult to attack or remove without (further) audible distortion. </p>
<p>The energy is increased or reduced in 0.04 second blocks.  It can be characterized as a fluttering or tremolo sound. Listen closely to the original vs. watermarked audio samples and try to focus on the 1 khz to 3.6 khz noise range.  It helps to wear headphones in a quiet environment.</p>
<h3>Audio samples</h3>
<p>Here is a short sample (excerpt: Three Doors Down - When You're Young). These are lossless original and watermarked files; what you hear is not a result of compression.<br />
<b>Original:</b><br />
<audio controls="controls"><source src="/media/3dd[original].wav" type="audio/wav" /></audio><br />
<b>Watermarked:</b><br />
<audio controls="controls"><source src="/media/3dd[watermarked].wav" type="audio/wav" /></audio></p>
<p>If the difference between the two isn't clear, here it is by itself:<br />
<b>Difference:</b><br />
<audio controls="controls"><source src="/media/3dd[difference].wav" type="audio/wav" /></audio></p>
<h2>Technical details</h2>
<p>The watermark does not start until 1 second into the audio. After this the signal is divided into 0.08 second blocks. Each block is divided in two: some amount of energy is <b>added</b> to the first half and the same amount is <b>subtracted</b> from the second half. This coding scheme allows blind detection (without access to the original file).  The actual information in the watermark is not easily recovered because it is modulated by a pseudo random sequence, which is generated by a secret key.</p>
<p><!--<br />
UMG uses WAM!NET to distribute digital tracks and apply watermarks. According to <a href="http://www.umldigitalops.com/wnsupport/overview/eFolio.html">WAM!NET documentation</a>, The watermark is a technology of Korea-based MarkAny company, who might have licensed their audio watermark from Digimarc.  These <a href="http://www.google.com/patents/US6839673">MarkAny</a> <a href="http://www.google.com/patents/US7773751">patents</a> might be relevant.<br />
--></p>
<h2>Removing the watermark</h2>
<p>Since the watermark creates audible distortion, it's worthwhile to try to reduce it. I wrote a script that analyzes the block energy and applies some smoothing. This is the result so far.<br />
<b>Watermarked:</b><br />
<audio controls="controls"><source src="/media/3dd[watermarked].wav" type="audio/wav" /></audio><br />
<b>Restored:</b><br />
<audio controls="controls"><source src="/media/3dd[restored].wav" type="audio/wav" /></audio></p>
<h2>More discussion</h2>
<p><a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=89818">Hydrogenaudio forums on watermarking</a></p>
<p><a href="http://www.techdirt.com/articles/20110809/04114515451/umg-watermarks-audiophile-files-pisses-off-paying-customers.shtml">UMG Watermarks audiophile files, pisses off paying customers</a></p>
<p>Why do labels watermark tracks? Watermarking simplifies copyright enforcement by letting a company track music on peer-to-peer networks.  "It gives them the ability to put pressure on policy makers and ISPs to do filtering," says Fred Von Lohmann, an Electronic Frontier Foundation attorney.  That may be about the best explanation you will find.  See <a href="https://www.eff.org/press/mentions/2008/1/11-0" title="DRM Is Dead, But Watermarks Rise From Its Ashes">DRM Is Dead, But Watermarks Rise From Its Ashes</a></p>
<p>I don't have anything against watermarking, but I have a problem as a consumer when it is poorly implemented and destroys music I've downloaded legally. </p>
<p>Why isn't UMG's watermark talked about more?  Maybe people think it's a compression issue, as I did, and blame the streaming service/distributor.  Or maybe people just aren't noticing the artifacts.  That is fine, but really, if you've spent more than $39 on your speakers, you will probably care. Especially if you are paying the full retail price for something advertised as lossless audio.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/music/universals-audible-watermark/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WFS Paper Presented at AES 131</title>
		<link>http://www.mattmontag.com/research/wfspaper-at-aes-131?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wfspaper-at-aes-131</link>
		<comments>http://www.mattmontag.com/research/wfspaper-at-aes-131#comments</comments>
		<pubDate>Tue, 25 Oct 2011 01:50:25 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=554</guid>
		<description><![CDATA[I presented a short paper derived from my thesis work at the 131st Convention of the Audio Engineering Society in New York City. The paper is titled Wave Field Synthesis in Three Dimensions by Multiple Line Arrays. The paper focuses on subjective assessment of a modification to traditional wave field synthesis. I met Dr. Frank [...]]]></description>
			<content:encoded><![CDATA[<p>I presented a short paper derived from my thesis work at the 131st Convention of the Audio Engineering Society in New York City.  The paper is titled <a href="http://www.mattmontag.com/media/2011/10/AES-131-e-brief-Montag-Wave-Field-Synthesis-by-Multiple-Line-Arrays.pdf">Wave Field Synthesis in Three Dimensions by Multiple Line Arrays</a>. The paper focuses on subjective assessment of a modification to traditional wave field synthesis.  I met Dr. Frank Melchior, CTO of <a href="http://www.iosono-sound.com">IOSONO</a>, after the presentation. Dr. Melchior also presented an assessment of modified WFS at the convention. </p>
<p><a href="http://www.mattmontag.com/media/2011/10/AES-131-e-brief-Montag-Wave-Field-Synthesis-by-Multiple-Line-Arrays.pdf"><img src="http://www.mattmontag.com/media/2011/10/ebrief.png" alt="" title="Montag AES e-Brief 2011" width="275" height="355" class="aligncenter size-full wp-image-555" /></a></p>
<h4>Abstract:</h4>
<p>Wave field synthesis (WFS) is a spatial audio rendering technique that produces a physical approximation of wavefronts for virtual sources. Large loudspeaker arrays can simulate a virtual source that exists outside of the listening room. The technique is traditionally limited to the horizontal plane due to the prohibitive  cost of planar loudspeaker arrays.  Multiple-line-array wave field synthesis is proposed as an extension to linear WFS. This method extends the virtual source space in the vertical direction using a fraction of the number of loudspeakers required for plane arrays. This paper describes a listening test and software environment capable of driving a loudspeaker array according to the proposed extension, as well as the construction of a modular loudspeaker array that can be adapted to multiple-line configurations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/research/wfspaper-at-aes-131/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Speech Synthesis Markup</title>
		<link>http://www.mattmontag.com/personal/mac-os-x-speech-synthesis-markup?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mac-os-x-speech-synthesis-markup</link>
		<comments>http://www.mattmontag.com/personal/mac-os-x-speech-synthesis-markup#comments</comments>
		<pubDate>Fri, 23 Sep 2011 10:09:50 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=529</guid>
		<description><![CDATA[I put a Sound Blaster 16 in my first computer. It came with a CD-ROM full of goodies like Dr. Sbaitso, the talking psychologist. One app was called TextAssist and it had a special syntax that let you string together phonemes, specifying pitch, duration, even vibrato. I spent hours composing weird robot jingles. Itsy Bitsy [...]]]></description>
			<content:encoded><![CDATA[<p>I put a Sound Blaster 16 in my first computer. It came with a CD-ROM full of goodies like <a href="http://www.youtube.com/watch?v=sV3pYZZ2jEw&amp;feature=related">Dr. Sbaitso, the talking psychologist</a>. One app was called TextAssist and it had a special syntax that let you string together phonemes, specifying pitch, duration, even vibrato. I spent hours composing weird robot jingles.</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-530" title="TextAssist" src="http://www.mattmontag.com/media/2011/09/ta_cp.jpg" alt="" width="354" height="209" /> <a href="http://www.mattmontag.com/media/2011/09/spider.mp3">Itsy Bitsy Spider by TextAssist</a></p>
<p>The built-in text-to-speech on Mac OS also has the ability to sing your melodies through <a href="http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/SpeechSynthesisProgrammingGuide/FineTuning/FineTuning.html#//apple_ref/doc/uid/TP40004365-CH5-SW7" target="_blank">phonemic modifiers and TUNE syntax</a>. (The full specification is available at the link.) TUNE embedded speech commands alter intonation by controlling pitch, word emphasis, pause length, etc. This stuff is baked in, so if you're on a Mac, try highlighting the following code block, control-click, and go <strong>Speech &gt; Start Speaking</strong>:</p>
<p><code>[[inpt TUNE]]<br />
_<br />
1OW {D 1066; P 109.0:0 119.8:12 153.0:30 164.6:39 154.0:50 131.7:62 120.7:69 111.2:73 97.1:89 103.1:93}<br />
_<br />
h {D 194; P 123.0:0 130.0:12}<br />
1EY {D 652; P 147.0:0 159.0:14 161.0:32 147.3:63 112.0:91}<br />
_<br />
w {D 161; P 109.0:0}<br />
1AW {D 1171; P 116.0:0 153.3:17 148.2:33 151.0:51 133.0:55 112.4:71 99.5:74 79.0:89 65.7:98 119.0:100}<br />
% {D 293}<br />
_<br />
D {D 132; P 127.0:0}<br />
IH {D 318; P 160.0:0 136.5:43 114.6:63 112.0:88}<br />
s {D 145; P 112.0:0 119.0:95}<br />
_<br />
IH {D 189; P 119.0:0 119.0:13 119.0:27 120.0:87 119.0:93}<br />
z {D 180; P 117.0:0 117.0:64 117.0:86 117.0:93}<br />
_<br />
k {D 80; P 117.0:0 113.0:81 164.0:95}<br />
1UW {D 820; P 164.0:0 168.0:9 172.0:18 169.5:46 139.0:74 116.8:86}<br />
l {D 260; P 104.0:0 92.0:64 104.0:100}<br />
. {D 212}<br />
[[inpt TEXT]]</code></p>
<p>There's also a simpler mode for <a href="http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/SpeechSynthesisProgrammingGuide/Phonemes/Phonemes.html#//apple_ref/doc/uid/TP40004365-CH9-SW1" target="_blank">phonemic</a> modifiers. The first line here is spoken with default interpretation, and the second line uses the modifiers.  Try it:</p>
<p><code><br />
You talkin' to me<br />
</code><span class="Apple-style-span" style="font-family: monospace;">[[inpt PHON]] [[slnc 500]] [[rate -30]]<br />
</span><span class="Apple-style-span" style="font-family: monospace;">+yUW _1tAOl=kIHn ~AX [[pbas +3]]+mIY?</span></p>
<p>XCode also ships with a hidden gem called <a href="http://mac.appstorm.net/roundups/utilities-roundups/five-hidden-gems-from-the-developer-folder/" target="_blank">Repeat After Me</a> that helps you build this funky syntax from your own spoken phrase. <em>It extracts pitch contour and fits phonetic onsets of a typed phrase to your spoken phrase. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/personal/mac-os-x-speech-synthesis-markup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.mattmontag.com/media/2011/09/spider.mp3" length="355295" type="audio/mpeg" />
		</item>
		<item>
		<title>Gaze-Enhanced HDR Viewing</title>
		<link>http://www.mattmontag.com/research/gaze-enhanced-hdr-viewing?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=gaze-enhanced-hdr-viewing</link>
		<comments>http://www.mattmontag.com/research/gaze-enhanced-hdr-viewing#comments</comments>
		<pubDate>Wed, 21 Sep 2011 02:28:47 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=517</guid>
		<description><![CDATA[Someday, Walmart will sell TVs capable of blinding you. But until then, we have to deal with weak displays that cannot reproduce the sun's luminosity. And High Dynamic Range images will have to be viewed by proxy. Tones that fall in the HDR range of the histogram are tones that are impossible to display on your [...]]]></description>
			<content:encoded><![CDATA[<p>Someday, Walmart will sell TVs capable of blinding you. But until then, we have to deal with weak displays that cannot reproduce the sun's luminosity. And High Dynamic Range images will have to be viewed by proxy.</p>
<p><img class="aligncenter" src="http://www.slagermanphoto.com/wp-content/uploads/2008/06/range.jpg" alt="" width="286" height="165" /></p>
<p>Tones that fall in the HDR range of the histogram are tones that are <strong>impossible </strong>to display on your monitor and therefore appear as blown out or completely stopped up spots in an image.</p>
<p>In video games with an HDR graphics pipeline, the exposure is controlled automatically. <a href="http://www.youtube.com/watch?v=-spSQYtVfuk">http://www.youtube.com/watch?v=-spSQYtVfuk</a> The game acts like a digital video camera, truncating the histogram based on what's in the center of the frame.</p>
<p>However, with static HDR photographs or panoramas on a computer screen, there is no such region-of-interest-based automatic exposure. The entire picture has to be tone mapped, flattening out the image's dynamic range. If you ask me, that defeats the purpose of retaining HDR images in the first place.</p>
<p>One way around this is to create an interactive HDR viewer that would tune the exposure for, say, the region near the mouse cursor. But an even better option would be to track the user's gaze. Now we're in academic territory.</p>
<p>Interactive viewing could be implemented in browser with these cool HDR Javascript tools: <a href="http://pfstools.sourceforge.net/hdrhtml.html">http://pfstools.sourceforge.net/hdrhtml.html</a>. Actual gaze tracking in the browser, well, that I'm not so sure about.</p>
<p>Another cool site that demonstrates true HDR: <a href="http://www.hdrlabs.com/gallery/realhdr/">http://www.hdrlabs.com/gallery/realhdr/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/research/gaze-enhanced-hdr-viewing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenCV 2.1 and 2.3 with Visual Studio 2010 Quick Start</title>
		<link>http://www.mattmontag.com/development/notes-on-using-opencv-2-3-with-visual-studio-2010?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=notes-on-using-opencv-2-3-with-visual-studio-2010</link>
		<comments>http://www.mattmontag.com/development/notes-on-using-opencv-2-3-with-visual-studio-2010#comments</comments>
		<pubDate>Mon, 19 Sep 2011 23:49:58 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=510</guid>
		<description><![CDATA[I am using OpenCV 2.1/2.3 with the newer C++ style OpenCV interface. There are a few tricky parts and changes that aren't mentioned in the cheatsheet. Hopefully the OpenCV documentation will continue to improve as it grows.  Anyway, here is a quick start guide that might help beginners out. Camera Capture in OpenCV 2.x #include [...]]]></description>
			<content:encoded><![CDATA[<p>I am using OpenCV 2.1/2.3 with the newer C++ style OpenCV interface. There are a few tricky parts and changes that aren't mentioned in the cheatsheet. Hopefully the OpenCV documentation will continue to improve as it grows.  Anyway, here is a quick start guide that might help beginners out.</p>
<h2>Camera Capture in OpenCV 2.x</h2>
<p><code>#include "opencv\cv.h"<br />
#include "opencv\highgui.h"<br />
using namespace cv; ...<br />
VideoCapture cap(0); // open the default camera<br />
if(!cap.isOpened()) // check if we succeeded<br />
return -1;<br />
for(;;) {<br />
Mat frame;<br />
cap &gt;&gt; frame; // get a new frame from camera<br />
imshow("Camera Preview", frame);<br />
if(waitKey(30) &gt;= 0) break;<br />
}</code></p>
<h2>OpenCV 2.1 Visual Studio Project Starter</h2>
<ul>
<li>C/C++ &gt; Include Directories:</li>
<ul>
<li>X:\OpenCV2.1\include</li>
</ul>
<li>Linker &gt; Additional Library Directories:</li>
<ul>
<li>X:\OpenCV2.1\lib</li>
</ul>
<li>Linker &gt; Input &gt; Additional Dependencies: (<strong>this will vary from one project to the next, but you probably want the first three</strong>)</li>
<ul>
<li><strong>cv210.lib</strong></li>
<li><strong>cxcore210.lib</strong></li>
<li><strong>highgui210.lib</strong></li>
<li>cvaux210.lib</li>
<li>cxts210.lib</li>
<li>ml210.lib</li>
<li>opencv_ffmpeg210.lib</li>
</ul>
<li>Add to PATH environment variable (or copy DLLs into output directory):</li>
<ul>
<li>X:\OpenCV2.1\bin</li>
</ul>
</ul>
<h2>OpenCV 2.3.1 Visual Studio Project Starter</h2>
<p>OpenCV 2.3.1 directory structure is different from other versions. I downloaded from <a href="http://surfnet.dl.sourceforge.net/project/opencvlibrary/opencv-win/2.3.1/OpenCV-2.3.1-win-superpack.exe">OpenCV-2.3.1-win-superpack.exe</a>. This assumes x86, 32-bit architecture, so change accordingly if you are on 64-bit Windows. Note this also includes libs for static linking (instead of requiring DLLs) in OpenCV2.3\build\[architecture]\[compiler]\staticlib. Project settings (this is kind of a deluxe set that was necessary to build the opencv_stitching example):</p>
<ul>
<li>C/C++ &gt; Include Directories:</li>
<ul>
<li>X:\OpenCV2.3\build\include</li>
<li>X:\OpenCV2.3\modules\imgproc\src</li>
</ul>
<li>Linker &gt; Additional Library Directories:</li>
<ul>
<li>X:\OpenCV2.3\build\x86\vc10\lib</li>
</ul>
<li>Linker &gt; Input &gt; Additional Dependencies: (<strong>this will vary from one project to the next, but you probably want the first three</strong>)</li>
<ul>
<li><strong>opencv_core231.lib</strong></li>
<li><strong>opencv_highgui231.lib</strong></li>
<li><strong>opencv_imgproc231.lib</strong></li>
<li>opencv_features2d231.lib</li>
<li>opencv_flann231.lib</li>
<li>opencv_gpu231.lib</li>
<li>opencv_haartraining_engine.lib</li>
<li>opencv_legacy231.lib</li>
<li>opencv_ml231.lib</li>
<li>opencv_objdetect231.lib</li>
<li>opencv_ts231.lib</li>
<li>opencv_video231.lib</li>
<li>opencv_calib3d231.lib</li>
<li>opencv_contrib231.lib</li>
</ul>
</ul>
<ul>
<li>Add to PATH environment variable (or copy DLLs into output directory):</li>
<ul>
<li>X:\OpenCV2.3\build\x86\vc10\bin</li>
<li>X:\OpenCV2.3\build\common\tbb\ia32\vc10 (optional, for Intel Threading Building Blocks parallel processing support)</li>
</ul>
</ul>
<p>And you'll need to include the right headers at the top of your source. You have the option of including the entire OpenCV 1 and OpenCV 2 C++-style interface, or just the C++-style interface. This gives you everything, since cv.h and highgui.h include the C++ interface:</p>
<pre>
#include "opencv/cv.h"
#include "opencv/highgui.h"
...
using namespace cv;
</pre>
<p>If you are feeling dangerous, you can use the C++ interface exclusively with .hpp:</p>
<pre>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
...
using namespace cv;
</pre>
<div>
<div>If everything compiles and then you get runtime errors at the first instance of an OpenCV function call, something like this:</div>
<blockquote>
<div>First-chance exception at 0x7c90e4ff in OpenCVHello.exe: 0xC0000008: An invalid handle was specified.</div>
</blockquote>
<div>This might be a bug in the OpenCV build, I don't know. You can disable it by going to Debug &gt; Exceptions, unfold Win32 exceptions, and uncheck 0xC0000008.</div>
</div>
<h2>Integrating OpenCV in larger programs<br />
<small>with rich interfaces</small></h2>
<p>OpenCV highgui is great for experimenting.  But eventually, you might want to develop a useful stand-alone program.  So for this, cv::imshow and cvWaitKey are not going to cut it. See discussion at StackOverflow, <a href="http://stackoverflow.com/questions/7801522/integrating-opencv-with-larger-programs" target="_blank">Integrating OpenCV with larger programs</a>.</p>
<p>In most cases, there is no magic to handing off image data to other libraries.  The standard container is an <code>unsigned char</code> array.  If your image is 320x240 RGB, then your array size is 3 x 320 x 240 x sizeof(unsigned char) bytes. Since this is an unlabeled container, the consumer of this data will also need to be supplied with the image height, width, and color mode.  You can initialize a cv::Mat with raw data by supplying a pointer (this assumes RGB color mode): <code>Mat img(rawDataWidth, rawDataHeight, CV_8UC3, rawData);</code> and later access the raw data with <code>img.data</code>.  The only snags you are likely to come across are in dealing with row order and RGB vs. BGR format. OpenCV provides <code>cv::flip()</code> and <code>cv::cvtColor()</code> to deal with this.</p>
<p>I have had success using <a href="http://muonics.net/school/spring05/videoInput/">videoInput library</a> to access DirectShow devices. The library enumerates and lists friendly names of connected devices, and generally gives you more information when something goes wrong. It's much better than guessing capture device IDs, and essential if you are going to provide some camera selection to the user. </p>
<h3>Qt + OpenCV</h3>
<p>Key points:</p>
<ul>
<li><strong> <a href="http://qt.nokia.com/" target="_blank">Qt</a></strong> is a good option because Qt is great and has a big community.</li>
<li>Open a new thread to run cv::VideoCapture in a loop and <code>emit</code> signal after frame capture. Use Qt's<code>msleep</code> mechanism, not OpenCV. <em>So, we are still using OpenCV highgui for capture.</em></li>
<li>Convert cv::Mat to QtImage:<br />
<code>QImage qtFrame(cvFrame.data, cvFrame.size().width, cvFrame.size().height, cvFrame.step, QImage::Format_RGB888);</code><code>qtFrame = qtFrame.rgbSwapped();</code></li>
<li>Optional: Render with GLWidget. Convert QtImage to GLFormat with Qt built-in method:<br />
<code>m_GLFrame = QGLWidget::convertToGLFormat(frame);</code><code>this-&gt;updateGL();</code></li>
</ul>
<h3>Juce + OpenCV</h3>
<p><img src="http://www.mattmontag.com/media/2011/09/Juce-OpenCV-example.png" alt="" title="Juce OpenCV example" width="250" class="aligncenter size-full wp-image-570" /></p>
<p>I have also had success integrating OpenCV with Juce/OpenGL, rendering a capture frame on rotating surface in OpenGL. Converting a cv::Mat to an OpenGL texture goes like this: </p>
<p>declarations:</p>
<pre>
cv::Mat frame; // object to receive a captured frame.
cv::VideoCapture cap;  // video capture object
CvMat *_img;
CvMat *arrMat, *cvimage, stub;
</pre>
<p>in camera capture loop (usually a separate thread):</p>
<pre>
cap >> frame;
/* following will convert cv::Mat to CvMat data format, which can be
	used as a texture in OpenGL */
if (_img == 0)
	_img = new CvMat(frame);
CvArr *arr = _img;
arrMat = cvGetMat(arr, &#038;stub);
cvimage = cvCreateMat(arrMat->rows, arrMat->cols, CV_8UC3);
cvConvertImage(arrMat, cvimage, 0);
//sleep function here:
  waitKey(33); //OpenCV
//Sleep(33);   //windows.h
//msleep(33);  //Qt
//wait(33);    //Juce
</pre>
<p>in the OpenGL render function:</p>
<pre>
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, cvimage->cols, cvimage->rows, 0,
	GL_BGR_EXT /* GL_BGR */, GL_UNSIGNED_BYTE, cvimage->data.ptr);
</pre>
<p>I have a feeling this sample code, which I borrowed from this <a href="http://www.vislab.usyd.edu.au/moinwiki/OpenCV/OpenCV%20and%20OpenGL">OpenGL+OpenCV tutorial</a>, could be even simpler; I also don't like that it's using OpenCV 1.0 style structures. More on Juce/OpenGL later.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/development/notes-on-using-opencv-2-3-with-visual-studio-2010/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Latitude is Cool</title>
		<link>http://www.mattmontag.com/web/google-latitude-is-cool?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google-latitude-is-cool</link>
		<comments>http://www.mattmontag.com/web/google-latitude-is-cool#comments</comments>
		<pubDate>Fri, 09 Sep 2011 13:15:32 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=476</guid>
		<description><![CDATA[Google Latitude is starting to look a lot like my original Stractor location tracking concept work. They have pie charts that illustrate where you spend your time; work, home, out and about. Google Latitude: Stractor: Okay, that's nice. Here are some other Stractor concepts...maybe we'll see some of these soon: http://www.butterscotch.com/news/168/Google-Continues-To-Improve-And-Streamline-Maps-In-New-Update]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.google.com/latitude" target="_blank">Google Latitude</a> is starting to look a lot like my original <a title="Stractor Final Presentation" href="http://www.mattmontag.com/personal/stractor-final-presentation" target="_blank">Stractor location tracking</a> concept work. They have pie charts that illustrate where you spend your time; work, home, out and about. </p>
<h5>Google Latitude:</h5>
<p><a href="http://www.mattmontag.com/media/2011/08/1-history_kenny_cropped.png"><img class="aligncenter size-medium wp-image-489" title="Latitude History" src="http://www.mattmontag.com/media/2011/08/1-history_kenny_cropped-252x400.png" alt="" width="252" height="400" /></a></p>
<h5>Stractor:</h5>
<p><a href="http://www.mattmontag.com/media/2011/08/cap0374.jpg"><img class="aligncenter size-medium wp-image-490" title="Stractor mockup" src="http://www.mattmontag.com/media/2011/08/cap0374-450x269.jpg" alt="" width="450" height="269" /></a></p>
<p>Okay, that's nice.  Here are some other Stractor concepts...maybe we'll see some of these soon:</p>
<p><a href="http://www.mattmontag.com/media/2011/08/cap0358.jpg"><img class="aligncenter size-large wp-image-492" title="Fitness log" src="http://www.mattmontag.com/media/2011/08/cap0358-600x350.jpg" alt="" width="600" height="350" /></a></p>
<p><a href="http://www.mattmontag.com/media/2011/08/cap0361.jpg"><img class="aligncenter size-large wp-image-493" title="Carbon footprint" src="http://www.mattmontag.com/media/2011/08/cap0361-600x386.jpg" alt="" width="600" height="386" /></a></p>
<p><a href="http://www.mattmontag.com/media/2011/08/cap0369.jpg"><img class="aligncenter size-large wp-image-494" title="Mileage log" src="http://www.mattmontag.com/media/2011/08/cap0369-600x437.jpg" alt="" width="600" height="437" /></a></p>
<p><a href="http://www.mattmontag.com/media/2011/08/Location-Mockup-Time-Graph.png"><img class="aligncenter size-large wp-image-495" title="Location Mockup - Time graph" src="http://www.mattmontag.com/media/2011/08/Location-Mockup-Time-Graph-600x518.png" alt="" width="600" height="518" /></a></p>
<p><a href="http://www.butterscotch.com/news/168/Google-Continues-To-Improve-And-Streamline-Maps-In-New-Update" target="_blank">http://www.butterscotch.com/news/168/Google-Continues-To-Improve-And-Streamline-Maps-In-New-Update</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/web/google-latitude-is-cool/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Music Smasher: Streaming Music API Mashup</title>
		<link>http://www.mattmontag.com/music/music-smasher-streaming-music-api-mashup?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=music-smasher-streaming-music-api-mashup</link>
		<comments>http://www.mattmontag.com/music/music-smasher-streaming-music-api-mashup#comments</comments>
		<pubDate>Fri, 29 Jul 2011 05:14:21 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=454</guid>
		<description><![CDATA[Music Smasher is a smash up of popular music streaming service APIs. I developed it to simplify the task of searching across Spotify, Rdio, Grooveshark, and other catalogs to find out who has the music you love, giving you more information for choosing a streaming service. Music Smasher is currently hosted at mattmontag.com/smasher. Note that [...]]]></description>
			<content:encoded><![CDATA[<p>Music Smasher is a smash up of popular music streaming service APIs. I developed it to simplify the task of searching across Spotify, Rdio, Grooveshark, and other catalogs to find out who has the music you love, giving you more information for choosing a streaming service.</p>
<p>Music Smasher is currently hosted at <a style="font-size: 200%;" href="http://www.mattmontag.com/smasher">mattmontag.com/smasher</a>.</p>
<p>Note that due to differences in the APIs, the result counts aren't telling the whole truth (especially for Grooveshark <img src='http://www.mattmontag.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> ). I hope I can fix that.<br />
Please post any problems or suggestions in the comments.<br />
Technical notes coming soon.</p>
<h4>Update 9/9/2011:</h4>
<p>Music Smasher has been pretty useful during regular Spotify browsing. Today I learned Spotify doesn't have any Antiloop, Mark Ronson's Bike Song, or any of the Fabriclive series.</p>
<h4>Update 12/24/2011:</h4>
<p>Results are now linked to for streaming. Rdio tracks that are unavailable for streaming or download will no longer show up in results.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/music/music-smasher-streaming-music-api-mashup/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Weird Spotify Compression Artifacts</title>
		<link>http://www.mattmontag.com/music/weird-spotify-compression-artifacts?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=weird-spotify-compression-artifacts</link>
		<comments>http://www.mattmontag.com/music/weird-spotify-compression-artifacts#comments</comments>
		<pubDate>Tue, 26 Jul 2011 02:58:31 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=439</guid>
		<description><![CDATA[Spotify Artifacts Showcase I love Spotify. But I've noticed some weird artifacts on a few albums. It sounds like a fluttery warble noise in the midrange. It's most noticeable during big string or choir sections with broad spectral content. The problem seems limited to certain albums. The worst album I've come across is this Pascal [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Playlist" href="http://open.spotify.com/user/ivionday/playlist/3ZbRKMGb8nqXqZziwtC5ZY" target="_blank">Spotify Artifacts Showcase</a></p>
<p>I love Spotify. But I've noticed some weird artifacts on a few albums. It sounds like a fluttery warble noise in the midrange. It's most noticeable during big string or choir sections with broad spectral content.</p>
<p>The problem seems limited to certain albums. The worst album I've come across is this <a href="http://open.spotify.com/album/4ryjR3lv61091po7E5I4X6">Pascal Roge Poulenc album</a>.</p>
<p>Spotify uses Ogg Vorbis encoding. Free streaming accounts get Ogg Vorbis q5, 160kbps. I wonder if this is a normal Ogg Vorbis artifact, or something more complicated. Here are some audio samples. Can you hear it?</p>
<p><a href="http://www.mattmontag.com/media/jackson-ben.wav">Michael Jackson - Ben</a> / <a href="http://open.spotify.com/track/5JObFBHz0ATRR6ZUcSwiEN">on Spotify</a><br />
<a href="http://www.mattmontag.com/media/poulenc-concerto-mvmt-2.wav">Poulenc - Piano Concerto Movement 2</a> (linked above)<br />
<a href="http://www.mattmontag.com/media/poulenc-concerto-mvmt-3.wav">Poulenc - Piano Concerto Movement 3</a><br />
<a href="http://www.mattmontag.com/media/poulenc-sonata-mvmt-1.wav">Poulenc - Piano Sonata Movement 1</a></p>
<p>And the worst example - yikes, is this intentional?<br />
<a href="http://www.mattmontag.com/media/three-doors-down.wav">Three Doors Down - When You're Young</a> / <a href="http://open.spotify.com/track/6D7uABGh6Cjo2Sx3nZ23e4">on Spotify</a></p>
<h4><strong>Update 1:</strong></h4>
<p><strong></strong>I just upgraded to Spotify Premium and switched to 320kbps high quality streaming. I'm sad to say the nasty artifacts are still audible on these songs.</p>
<h4><strong>Update 2:</strong></h4>
<p><strike><strong></strong>Due to <a href="http://www.spotifyclassical.com/2011/07/spotify-bitrategate-story-so-far.html">investigative effort</a> by Ulysses at <a href="http://www.spotifyclassical.com">spotifyclassical.com</a>, this is no longer a mystery but indeed just a case of bad compression; it turns out maybe 50 percent of the Spotify library is actually available at 320kbps.</p>
<p>If this is true then I don't like Ogg Vorbis, since their 160kbps rate seems to have far more annoying artifacts than any 160kbps MP3 I've ever heard. Ogg is supposed to be better.</strike> I have not been able to reproduce the artifacts with my own Ogg compressor.</p>
<h4><strong>Update 3:</strong></h4>
<p><strong></strong>I compared the latest Three Doors Down album on Spotify, Rdio, and FLAC original audio. It's pretty clear that <strong>sometimes, the labels just supply bad tracks to the streaming services</strong>. The Spotify and Rdio tracks were identical.  I heard the same artifacts at the same points in the song.  The FLAC was very different.  This changes some of my earlier conclusions. The artifacts are not Ogg 160kbps artifacts.</p>
<p>To answer my question above, the warbling noise is definitely not part of the original <a href="http://www.mattmontag.com/media/three-doors-down.wav">Three Doors Down - When You're Young</a>  track.  Now the question is, exactly what format are these tracks provided in, and why is there such variance even among a single label's catalog? Are these differences intentional?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/music/weird-spotify-compression-artifacts/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Exact MP3 Recompression</title>
		<link>http://www.mattmontag.com/research/exact-mp3-recompression?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=exact-mp3-recompression</link>
		<comments>http://www.mattmontag.com/research/exact-mp3-recompression#comments</comments>
		<pubDate>Sun, 24 Jul 2011 05:33:02 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Research]]></category>

		<guid isPermaLink="false">http://www.mattmontag.com/?p=431</guid>
		<description><![CDATA[Let's say you have a library for decoding MP3* streams, and your library exposes some API methods that provide access to the resulting uncompressed PCM audio stream. It's meant to hide the original MP3 data, so people can't save it to disk and rip you off. Is it possible to "reverse engineer" the PCM data [...]]]></description>
			<content:encoded><![CDATA[<p>Let's say you have a library for decoding MP3* streams, and your library exposes some API methods that provide access to the resulting uncompressed PCM audio stream. It's meant to hide the original MP3 data, so people can't save it to disk and rip you off.</p>
<p>Is it possible to "reverse engineer" the PCM data and recover the original MP3 frames, instead of reencoding and incurring more compression artifacts?</p>
<p>This is analagous to the question of whether you can revert a decompressed bitmap to a JPEG source, covered by this paper on <a href="http://www.cl.cam.ac.uk/~abl26/spie10-full.pdf" target="_blank">Exact JPEG recompression</a>. <strong>The authors are able to recover the compression parameters (quantized DCT coefficients) for 96% of the blocks**</strong> in images compressed at a JPEG quality of 75%. Cool!</p>
<p>So Spotify provides exactly the aforementioned API, with opaque methods for getting raw audio streams. Other services, whether they offer an API or not, provide the user with an uncompressed audio stream one way or another. So it would be a <strong>"big deal"</strong> to be able to recover the original compressed data.</p>
<p>Google Scholar queries for audio and mp3 recompression give lots of results related to audio watermarking, but not much in the way of optimal audio recompression. Seems to be a very interesting and potentially valuable research opportunity.</p>
<p><small>*Or any perceptual audio codec (AAC, Ogg Vorbis, etc.)</p>
<p>**Prior to JPEG compression, images are chopped into 8x8 pixel squares. Each block is compressed independently.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattmontag.com/research/exact-mp3-recompression/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

