<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Image Compression with the SVD in R</title>
	<atom:link href="http://www.johnmyleswhite.com/notebook/2009/12/17/image-compression-with-the-svd-in-r/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.johnmyleswhite.com/notebook/2009/12/17/image-compression-with-the-svd-in-r/</link>
	<description>&#34;He who refuses to do arithmetic is doomed to talk nonsense.&#34;</description>
	<lastBuildDate>Thu, 09 Feb 2012 17:17:15 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: John Myles White</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/12/17/image-compression-with-the-svd-in-r/comment-page-1/#comment-18946</link>
		<dc:creator>John Myles White</dc:creator>
		<pubDate>Sun, 27 Feb 2011 02:26:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3736#comment-18946</guid>
		<description>Yeah, that&#039;s the right interpretation of &#039;i&#039;. Sorry for the confusion. I&#039;ve just edited the example code to keep future visitors from getting confused.</description>
		<content:encoded><![CDATA[<p>Yeah, that&#8217;s the right interpretation of &#8216;i&#8217;. Sorry for the confusion. I&#8217;ve just edited the example code to keep future visitors from getting confused.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Brickley</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/12/17/image-compression-with-the-svd-in-r/comment-page-1/#comment-18942</link>
		<dc:creator>Dan Brickley</dc:creator>
		<pubDate>Sat, 26 Feb 2011 22:13:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3736#comment-18942</guid>
		<description>Ah got it, the line with the &#039;i&#039; only really makes sense in the loop (although any of the given values can be substituted...

Great writeup btw, really nice to have this running locally rather than just read about it in papers :)</description>
		<content:encoded><![CDATA[<p>Ah got it, the line with the &#8216;i&#8217; only really makes sense in the loop (although any of the given values can be substituted&#8230;</p>
<p>Great writeup btw, really nice to have this running locally rather than just read about it in papers :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Brickley</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/12/17/image-compression-with-the-svd-in-r/comment-page-1/#comment-18941</link>
		<dc:creator>Dan Brickley</dc:creator>
		<pubDate>Sat, 26 Feb 2011 22:05:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3736#comment-18941</guid>
		<description>What&#039;s the &#039;i&#039; in green.matrix.compressed &lt;- u[,1:i] %*% diag(d[1:i]) %*% t(v[,1:i]) ?
 
I get &quot;Error: object &#039;i&#039; not found&quot;...</description>
		<content:encoded><![CDATA[<p>What&#8217;s the &#8216;i&#8217; in green.matrix.compressed &lt;- u[,1:i] %*% diag(d[1:i]) %*% t(v[,1:i]) ?</p>
<p>I get &quot;Error: object &#039;i&#039; not found&quot;&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sumner</title>
		<link>http://www.johnmyleswhite.com/notebook/2009/12/17/image-compression-with-the-svd-in-r/comment-page-1/#comment-17858</link>
		<dc:creator>Michael Sumner</dc:creator>
		<pubDate>Mon, 21 Dec 2009 00:20:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.johnmyleswhite.com/?p=3736#comment-17858</guid>
		<description>Hi, thanks this is great. I modified your example to use rgdal to read the file, which gives you more options for formats. 


library(rgdal)

## this could read the TIFF directly
imdata &lt;- readGDAL(&quot;image.ppm&quot;)


## as.matrix converts from sp&#039;s data.frame form to matrix
red.matrix &lt;- as.matrix(imdata[1])
green.matrix &lt;- as.matrix(imdata[2])
blue.matrix &lt;- as.matrix(imdata[3])

## we need to flip vertically (could transpose with t() if necessary)
green.matrix &lt;- green.matrix[,ncol(green.matrix):1]
green.matrix.svd &lt;- svd(green.matrix)


d &lt;- green.matrix.svd$d
u &lt;- green.matrix.svd$u
v &lt;- green.matrix.svd$v


op &lt;- par(mfrow = c(3,2))
for (i in c(3, 4, 5, 10, 20, 30))
{
	green.matrix.compressed &lt;- u[,1:i] %*% diag(d[1:i]) %*% t(v[,1:i])

	image(green.matrix.compressed, col = heat.colors(255), main = i)

}</description>
		<content:encoded><![CDATA[<p>Hi, thanks this is great. I modified your example to use rgdal to read the file, which gives you more options for formats. </p>
<p>library(rgdal)</p>
<p>## this could read the TIFF directly<br />
imdata &lt;- readGDAL(&quot;image.ppm&quot;)</p>
<p>## as.matrix converts from sp&#039;s data.frame form to matrix<br />
red.matrix &lt;- as.matrix(imdata[1])<br />
green.matrix &lt;- as.matrix(imdata[2])<br />
blue.matrix &lt;- as.matrix(imdata[3])</p>
<p>## we need to flip vertically (could transpose with t() if necessary)<br />
green.matrix &lt;- green.matrix[,ncol(green.matrix):1]<br />
green.matrix.svd &lt;- svd(green.matrix)</p>
<p>d &lt;- green.matrix.svd$d<br />
u &lt;- green.matrix.svd$u<br />
v &lt;- green.matrix.svd$v</p>
<p>op &lt;- par(mfrow = c(3,2))<br />
for (i in c(3, 4, 5, 10, 20, 30))<br />
{<br />
	green.matrix.compressed &lt;- u[,1:i] %*% diag(d[1:i]) %*% t(v[,1:i])</p>
<p>	image(green.matrix.compressed, col = heat.colors(255), main = i)</p>
<p>}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.220 seconds -->

