<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Big Rich from Birmingham likes music, art and parties.  Will code for cash.  Likes socialising with beer.  Likes digital art.  Reads too many magazines.  Procrastinates far too much.</description><title>Yam Big Richard</title><generator>Tumblr (3.0; @bigrichardc)</generator><link>http://bigrichardc.tumblr.com/</link><item><title>Video</title><description>&lt;iframe width="400" height="400" src="//www.mixcloud.com/widget/iframe/?feed=http%3A%2F%2Fwww.mixcloud.com%2Fbigrichardc%2F16down8milliontogo%2F&amp;embed_uuid=202fd94d-6359-4086-b1bd-6d44a5b984d2&amp;stylecolor=&amp;embed_type=widget_standard" frameborder="0"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;</description><link>http://bigrichardc.tumblr.com/post/41795362273</link><guid>http://bigrichardc.tumblr.com/post/41795362273</guid><pubDate>Tue, 29 Jan 2013 13:09:57 -0500</pubDate></item><item><title>Echo Lake - Even The BlindDead Berlin - HipnosisOmbre -...</title><description>&lt;iframe width="400" height="400" src="//www.mixcloud.com/widget/iframe/?feed=http%3A%2F%2Fwww.mixcloud.com%2Fbigrichardc%2Fitsnotshoegaze%2F&amp;embed_uuid=58d499e6-e759-4a66-a43a-1e695085ca07&amp;stylecolor=&amp;embed_type=widget_standard" frameborder="0"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Echo Lake - Even The Blind&lt;br/&gt;Dead Berlin - Hipnosis&lt;br/&gt;Ombre - Tormentas&lt;br/&gt;Ssaliva - AVE&lt;br/&gt;Will Stratton - Who Will&lt;br/&gt;Jacaszek - White Wind Dance&lt;br/&gt;The XX - Fiction (Kid Smpl Remix)&lt;br/&gt;Black Sabbath - Planet aravan (Poolside Rework extended intro)&lt;br/&gt;Monomono - Water Pass Gari (Pts 1 &amp; 2)&lt;br/&gt;Free Association - Purple Mikes&lt;br/&gt;Fela Kuti - No Possible (Joystick Jays Vu Remix)&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/40628217595</link><guid>http://bigrichardc.tumblr.com/post/40628217595</guid><pubDate>Tue, 15 Jan 2013 17:10:27 -0500</pubDate></item><item><title>Finding the Centroid of Non Intersecting Polygons</title><description>&lt;p&gt;I answered some questions on the Processing forum which led to me writing this small function to determine the centroid of a polygon it uses this formula to determine the position of the centroid, Cx and Cy:&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="http://media.tumblr.com/5e73b6f098037c9a60f97dae46ad9b44/tumblr_inline_mgkkw3sH2v1qg8zg0.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="http://media.tumblr.com/fa87545efeda3265b80436eb89e93e22/tumblr_inline_mgkkwzfylY1qg8zg0.png"/&gt;&lt;/p&gt;
&lt;p&gt;where&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="http://media.tumblr.com/a434be2eb5af2074da4dd8ce2fcd3aa9/tumblr_inline_mgkkxw9p3L1qg8zg0.png"/&gt;&lt;/p&gt;
&lt;p&gt;it might be useful for someone.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;class&lt;/span&gt; pPoint {
 &lt;span&gt;int&lt;/span&gt; &lt;span&gt;x&lt;/span&gt;, &lt;span&gt;y&lt;/span&gt;;
 
 pPoint(&lt;span&gt;int&lt;/span&gt; x, &lt;span&gt;int&lt;/span&gt; y) {
  &lt;span&gt;this&lt;/span&gt;.&lt;span&gt;x&lt;/span&gt; = x;
  &lt;span&gt;this.y&lt;/span&gt; = y;
 } 
}

&lt;span&gt;void&lt;/span&gt; &lt;span&gt;setup&lt;/span&gt;() {
 
 &lt;span&gt;size&lt;/span&gt;(400,400);
  
 &lt;span&gt;noFill&lt;/span&gt;();
 &lt;span&gt;rect&lt;/span&gt;(10,10,200,200);
 pPoint[] pArray = &lt;span&gt;new&lt;/span&gt; pPoint[4];
 pArray[0] = &lt;span&gt;new&lt;/span&gt; pPoint(10,10);
 pArray[1] = &lt;span&gt;new&lt;/span&gt; pPoint(210,10);
 pArray[2] = &lt;span&gt;new&lt;/span&gt; pPoint(210,210);
 pArray[3] = &lt;span&gt;new&lt;/span&gt; pPoint(10,210);
  
 
  
 pPoint pp = getCentroid(pArray);
 
 &lt;span&gt;println&lt;/span&gt;(pp.&lt;span&gt;x&lt;/span&gt; + &lt;span&gt;","&lt;/span&gt; + pp.&lt;span&gt;y&lt;/span&gt;);
 &lt;span&gt;ellipse&lt;/span&gt;(pp.&lt;span&gt;x&lt;/span&gt;, pp.&lt;span&gt;y&lt;/span&gt;, 2, 2);
  
} 

pPoint getCentroid(pPoint[] pArray) {
  
  &lt;span&gt;int&lt;/span&gt; X = 0;
  &lt;span&gt;int&lt;/span&gt; Y = 0;
  &lt;span&gt;int&lt;/span&gt; A = 0;
  
  &lt;span&gt;int&lt;/span&gt; numPoints = pArray.&lt;span&gt;&lt;strong&gt;length&lt;/strong&gt;&lt;/span&gt;;
  &lt;span&gt;println&lt;/span&gt;(numPoints);
  
  &lt;span&gt;for&lt;/span&gt; (&lt;span&gt;int&lt;/span&gt; i = 0; i &amp;lt; numPoints-1; i++ ) {
        
   X = X +  (pArray[i].&lt;span&gt;x&lt;/span&gt; + pArray[i+1].&lt;span&gt;x&lt;/span&gt;) * 
             (pArray[i].&lt;span&gt;x&lt;/span&gt;*pArray[i+1].&lt;span&gt;y&lt;/span&gt; - 
              pArray[i+1].&lt;span&gt;x&lt;/span&gt;*pArray[i].&lt;span&gt;y&lt;/span&gt;);
     
   Y = Y +  (pArray[i].&lt;span&gt;y&lt;/span&gt; + pArray[i+1].&lt;span&gt;y&lt;/span&gt;) * 
             (pArray[i].&lt;span&gt;x&lt;/span&gt;*pArray[i+1].&lt;span&gt;y&lt;/span&gt; - 
               pArray[i+1].&lt;span&gt;x&lt;/span&gt;*pArray[i].&lt;span&gt;y&lt;/span&gt;);
               
   A = A + ((pArray[i].&lt;span&gt;x&lt;/span&gt; * pArray[i+1].&lt;span&gt;y&lt;/span&gt;) - (pArray[i+1].&lt;span&gt;x&lt;/span&gt; * pArray[i].&lt;span&gt;y&lt;/span&gt;));
               
  }
  
  A = A/2;
  
  X = X/(6*A);
  Y = Y/(6*A);
  
  pPoint pp = &lt;span&gt;new&lt;/span&gt; pPoint(X,Y);
  &lt;span&gt;return&lt;/span&gt; pp;
  
  
}
  
  
&lt;/pre&gt;</description><link>http://bigrichardc.tumblr.com/post/40429082118</link><guid>http://bigrichardc.tumblr.com/post/40429082118</guid><pubDate>Sun, 13 Jan 2013 10:14:00 -0500</pubDate><category>centroid</category><category>processing</category><category>polygons</category><category>code</category></item><item><title>BMXing</title><description>&lt;img src="http://25.media.tumblr.com/fd18ef381a934c2305788343a7423c43/tumblr_mg9pj2wW1L1qh8l1ro1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;BMXing&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/39939785258</link><guid>http://bigrichardc.tumblr.com/post/39939785258</guid><pubDate>Mon, 07 Jan 2013 13:18:38 -0500</pubDate></item><item><title>Edge Detection Video</title><description>&lt;iframe width="400" height="225" src="http://www.youtube.com/embed/ZFb22zsyV7E?wmode=transparent&amp;autohide=1&amp;egm=0&amp;hd=1&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0&amp;showsearch=0" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Edge Detection Video&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/39939735516</link><guid>http://bigrichardc.tumblr.com/post/39939735516</guid><pubDate>Mon, 07 Jan 2013 13:17:48 -0500</pubDate></item><item><title>Gaussian Blur in Processing</title><description>&lt;p&gt;imContinuing on with the image processing theme I looked at blurring an image.   Gaussian Blur is similar to the Sobel edge detection algorithm insomuch that for each pixel you are processing it looks at the surrounding pixels to determine what change needs to be done.  Each pixel becomes the average of the pixels around it, except that it is a weighted average, this means that the pixels closer to the centre are of more importance.&lt;/p&gt;
&lt;p&gt;To what importance we need to give each pixel surrounding and including the centre, we need to use this equation:&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="http://media.tumblr.com/c8e0f98968e812e9d383660d75232e7a/tumblr_inline_mg9ffmGMWS1qg8zg0.png"/&gt;&lt;/p&gt;
&lt;p&gt;Where x is horizontal distance from the centre pixel, y is the vertical distance from and sigma is the blur value (the higher the value the more the blur).&lt;/p&gt;
&lt;p&gt;In processing the equation would look like:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;    weightingValue = 1/(2*PI*sigma*sigma) *&lt;/em&gt;&lt;br/&gt;&lt;em&gt;                        exp(-1*((x*x)+(y*y))/(2*(sigma*sigma)));&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;By plugging in the x,y and sigma values for each pixel we end up with 9 weighting values that I store in an array.  These values need to be normalised before they can be used to change the colour values of a pixel, to do this is simple, add up all of the current weighting values and then multiply by 1/total, this ensures that the total of the new values will add up to 1.&lt;/p&gt;
&lt;p&gt;Now you have the weighting values you can step through every pixel to determine the colour intensities of the surrounding values and then multiply them buy the weighted value which are then added together to create a new value.&lt;/p&gt;
&lt;p&gt;Working out the top middle value and adding together would look like this:&lt;/p&gt;
&lt;p&gt;      &lt;em&gt;//top middle&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      //get colour of top middle pixel&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      px = pixels[((y-1)*width)+x];&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      // get r,g and b values for top middle pixel and multiply by weighting&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      redvalue = red(px)*kernelWeightings[1];&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      bluevalue = blue(px)*kernelWeightings[1];&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      greenvalue = green(px)*kernelWeightings[1];&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      // add weighted r,g and b values together&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      redIntensity += redvalue;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      greenIntensity += greenvalue;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      blueIntensity += bluevalue;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Once all of the colour values of the surrounding pixels have been weighted and added together we can then plug them back into the orignal pixel, note that I have used a array of pixels to do this as we don&amp;#8217;t want to change the original values until everyone of them has been modified.&lt;/p&gt;
&lt;p&gt;     &lt;em&gt;pixelarray[x+(width*y)] = color(redIntensity,greenIntensity,blueIntensity);&lt;/em&gt;                 &lt;/p&gt;
&lt;p&gt;After this we can use the array of pixels to create a new image.&lt;/p&gt;
&lt;p&gt;   &lt;em&gt;for(int i = 0; i&amp;lt;width*height;i++) {&lt;/em&gt;&lt;br/&gt;&lt;em&gt;       pixels[i] = pixelarray[i];&lt;/em&gt;&lt;br/&gt;&lt;em&gt;   }     &lt;/em&gt;&lt;br/&gt;&lt;em&gt;background(0);    &lt;/em&gt;&lt;br/&gt;&lt;em&gt;   updatePixels();&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;Passing through the pixels more than once will produce an image that looks something like this: &lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="http://media.tumblr.com/8e819604273a36d9763531d69285413d/tumblr_inline_mg9h51law61qg8zg0.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;Full code:&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;float&lt;/span&gt; sigma = 3.5;  &lt;span&gt;//The blur factor&lt;/span&gt;

&lt;span&gt;float&lt;/span&gt; returnWeightingValue(&lt;span&gt;float&lt;/span&gt; &lt;span&gt;x&lt;/span&gt;, &lt;span&gt;float&lt;/span&gt; &lt;span&gt;y&lt;/span&gt;) {
  
  &lt;span&gt;float&lt;/span&gt; weightingValue;
  
  &lt;span&gt;//Gaussian Equation&lt;/span&gt;
  weightingValue = 1/(2*&lt;span&gt;PI&lt;/span&gt;*sigma*sigma) *
                        &lt;span&gt;exp&lt;/span&gt;(-1*((&lt;span&gt;x&lt;/span&gt;*&lt;span&gt;x&lt;/span&gt;)+(&lt;span&gt;y&lt;/span&gt;*&lt;span&gt;y&lt;/span&gt;))/(2*(sigma*sigma)));
  &lt;span&gt;return&lt;/span&gt; weightingValue;
}

&lt;span&gt;void&lt;/span&gt; gaussBlur() {
  &lt;span&gt;float&lt;/span&gt; p = returnWeightingValue(0,0);
  &lt;span&gt;float&lt;/span&gt;[] kernelWeightings =  &lt;span&gt;new&lt;/span&gt; &lt;span&gt;float&lt;/span&gt;[9];
 
  &lt;span&gt;float&lt;/span&gt; normVal = 0;
  
  &lt;span&gt;//top left&lt;/span&gt;
  kernelWeightings[0] = returnWeightingValue(1,1);
  normVal+= kernelWeightings[0];
  
  &lt;span&gt;//top middle&lt;/span&gt;
  kernelWeightings[1] = returnWeightingValue(0,1);
  normVal+= kernelWeightings[1];
  
  &lt;span&gt;//top right&lt;/span&gt;
  kernelWeightings[2] = returnWeightingValue(1,1);
  normVal+= kernelWeightings[2];
  
  &lt;span&gt;//mid left&lt;/span&gt;
  kernelWeightings[3] = returnWeightingValue(1,0);
  normVal+= kernelWeightings[3];
  
  &lt;span&gt;//middle&lt;/span&gt;
  kernelWeightings[4] = returnWeightingValue(0,0);
  normVal+= kernelWeightings[4];
  
  &lt;span&gt;//mid right&lt;/span&gt;
  kernelWeightings[5] = returnWeightingValue(1,0);
  normVal+= kernelWeightings[5];
  
  &lt;span&gt;//bottom left&lt;/span&gt;
  kernelWeightings[6] = returnWeightingValue(1,1);
  normVal+= kernelWeightings[6];
  
  &lt;span&gt;//bottom middle&lt;/span&gt;
  kernelWeightings[7] = returnWeightingValue(0,1);
  normVal+= kernelWeightings[7];
  
  &lt;span&gt;//bottom right&lt;/span&gt;
  kernelWeightings[8] = returnWeightingValue(1,1);
  normVal+= kernelWeightings[8];
  
  &lt;span&gt;for&lt;/span&gt; (&lt;span&gt;int&lt;/span&gt; i = 0; i&amp;lt;9; i++) {
    kernelWeightings[i] = (1/normVal)*kernelWeightings[i];
  }
  
  &lt;span&gt;&lt;strong&gt;loadPixels&lt;/strong&gt;&lt;/span&gt;();
  &lt;span&gt;int&lt;/span&gt;[] pixelarray = &lt;span&gt;new&lt;/span&gt; &lt;span&gt;int&lt;/span&gt;[&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;*&lt;span&gt;height&lt;/span&gt;];
  
  &lt;span&gt;float&lt;/span&gt; redvalue, bluevalue, greenvalue;
  &lt;span&gt;float&lt;/span&gt; redIntensity, greenIntensity, blueIntensity;
  
  &lt;span&gt;color&lt;/span&gt; px;
  
  &lt;span&gt;for&lt;/span&gt; (&lt;span&gt;int&lt;/span&gt; &lt;span&gt;x&lt;/span&gt; = 1 ; &lt;span&gt;x&lt;/span&gt; &amp;lt; &lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;-1; &lt;span&gt;x&lt;/span&gt;++) {
    &lt;span&gt;for&lt;/span&gt; (&lt;span&gt;int&lt;/span&gt; &lt;span&gt;y&lt;/span&gt; = 1; &lt;span&gt;y&lt;/span&gt; &amp;lt; &lt;span&gt;height&lt;/span&gt;-1; &lt;span&gt;y&lt;/span&gt;++) {
  
    &lt;span&gt;//top left Pixel&lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[((&lt;span&gt;y&lt;/span&gt;-1)*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+(&lt;span&gt;x&lt;/span&gt;-1)];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[0];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[0];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[0];
      redIntensity = redvalue;
      greenIntensity = greenvalue;
      blueIntensity = bluevalue;
      
      &lt;span&gt;//top middle&lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[((&lt;span&gt;y&lt;/span&gt;-1)*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+&lt;span&gt;x&lt;/span&gt;];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[1];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[1];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[1];
      redIntensity += redvalue;
      greenIntensity += greenvalue;
      blueIntensity += bluevalue;
      
      &lt;span&gt;// top right &lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[((&lt;span&gt;y&lt;/span&gt;-1)*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+&lt;span&gt;x&lt;/span&gt;+1];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[2];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[2];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[2];
      redIntensity += redvalue;
      greenIntensity += greenvalue;
      blueIntensity += bluevalue;

      
      &lt;span&gt;//middle left pixel&lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[(&lt;span&gt;y&lt;/span&gt;*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+(&lt;span&gt;x&lt;/span&gt;-1)];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[3];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[3];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[3];
      redIntensity += redvalue;
      greenIntensity += greenvalue;
      blueIntensity += bluevalue;

      &lt;span&gt;//middle&lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[(&lt;span&gt;y&lt;/span&gt;*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+&lt;span&gt;x&lt;/span&gt;];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[4];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[4];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[4];
      redIntensity += redvalue;
      greenIntensity += greenvalue;
      blueIntensity += bluevalue;
      
      &lt;span&gt;//middle right&lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[(&lt;span&gt;y&lt;/span&gt;*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+&lt;span&gt;x&lt;/span&gt;+1];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[5];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[5];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[5];
      redIntensity += redvalue;
      greenIntensity += greenvalue;
      blueIntensity += bluevalue;

      
      &lt;span&gt;//bottom left&lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[((&lt;span&gt;y&lt;/span&gt;+1)*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+(&lt;span&gt;x&lt;/span&gt;-1)];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[6];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[6];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[6];
      redIntensity += redvalue;
      greenIntensity += greenvalue;
      blueIntensity += bluevalue;

      &lt;span&gt;//bottom middle&lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[((&lt;span&gt;y&lt;/span&gt;+1)*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+&lt;span&gt;x&lt;/span&gt;];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[7];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[7];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[7];
      redIntensity += redvalue;
      greenIntensity += greenvalue;
      blueIntensity += bluevalue;

      &lt;span&gt;//bottom right&lt;/span&gt;
      px = &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[((&lt;span&gt;y&lt;/span&gt;+1)*&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;)+&lt;span&gt;x&lt;/span&gt;+1];
      redvalue = &lt;span&gt;red&lt;/span&gt;(px)*kernelWeightings[8];
      bluevalue = &lt;span&gt;blue&lt;/span&gt;(px)*kernelWeightings[8];
      greenvalue = &lt;span&gt;green&lt;/span&gt;(px)*kernelWeightings[8];
      redIntensity += redvalue;
      greenIntensity += greenvalue;
      blueIntensity += bluevalue;

      pixelarray[&lt;span&gt;x&lt;/span&gt;+(&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;*&lt;span&gt;y&lt;/span&gt;)] = &lt;span&gt;color&lt;/span&gt;(redIntensity,greenIntensity,blueIntensity);              
    }
  }

 &lt;span&gt;for&lt;/span&gt;(&lt;span&gt;int&lt;/span&gt; i = 0; i&amp;lt;&lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;*&lt;span&gt;height&lt;/span&gt;;i++) {
  &lt;span&gt;&lt;strong&gt;pixels&lt;/strong&gt;&lt;/span&gt;[i] = pixelarray[i];
 }     
  
 &lt;span&gt;background&lt;/span&gt;(0);    
 &lt;span&gt;updatePixels&lt;/span&gt;();

  
  
}

&lt;span&gt;void&lt;/span&gt; &lt;span&gt;setup&lt;/span&gt; () {
  
  &lt;span&gt;size&lt;/span&gt;(375,500);
  &lt;span&gt;PImage&lt;/span&gt; img = &lt;span&gt;loadImage&lt;/span&gt;(&lt;span&gt;"richard2.jpg"&lt;/span&gt;);
  &lt;span&gt;image&lt;/span&gt;(img,0,0);
   
}

&lt;span&gt;void&lt;/span&gt; &lt;span&gt;draw&lt;/span&gt;() {
  
  &lt;span&gt;if&lt;/span&gt; (&lt;span&gt;&lt;strong&gt;mousePressed&lt;/strong&gt;&lt;/span&gt; == &lt;span&gt;true&lt;/span&gt;) {
    gaussBlur();
  }
  
}

&lt;/pre&gt;</description><link>http://bigrichardc.tumblr.com/post/39931183779</link><guid>http://bigrichardc.tumblr.com/post/39931183779</guid><pubDate>Mon, 07 Jan 2013 10:21:00 -0500</pubDate><category>image processing</category><category>gauss</category><category>gaussian blur</category><category>processing</category><category>code</category></item><item><title>Edge Detection in Processing Using the Sobel Operator (Code)</title><description>&lt;p&gt;Here is a quick run through of the code used to do an edge detection in Processing.  First up I create an array that can contain all of the values of the screen intensities, place an image on the screen and load the image pixels into the system Pixels[] array:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;  int[] pixelarray = new int[width*height];&lt;/em&gt;&lt;br/&gt;&lt;em&gt;  PImage img = loadImage(&amp;#8220;image.jpg&amp;#8221;);&lt;/em&gt;&lt;br/&gt;&lt;em&gt;  image(img,0,0);&lt;/em&gt;&lt;br/&gt;&lt;em&gt;  loadPixels();&lt;/em&gt; &lt;/p&gt;
&lt;p&gt;Iterating through each individual pixel, I get red, green and blue intensity values for that pixel add them together and depending on the values in the Sobel operator I have multiplied and added them to the overall intensity.  For example the top left pixel in the Sobel matrix:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;      px = pixels[((y-1)*width)+(x-1)];&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      redvalue = red(px);&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      bluevalue = blue(px);&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      greenvalue = green(px);&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      intensity = redvalue + greenvalue + bluevalue;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      Gx += -intensity;&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      Gy += intensity;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Once I have worked out values for all of the surrounding pixels I work out using Pythagoras the overall gradient length.   Then I normalise it so that it can be used as a output value.&lt;br/&gt;&lt;br/&gt;&lt;em&gt;      //calculate normalised length of gradient&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      glength = sqrt((Gx*Gx)+(Gy*Gy));&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      glength = (glength/4328) * 255;&lt;/em&gt;     &lt;/p&gt;
&lt;p&gt;I load this new information into the array of intensities which is used to create the image of the outline.  I have also used a threshold value to remove the detail from within the picture.&lt;/p&gt;
&lt;p&gt;   &lt;em&gt;   if (glength &amp;gt; 10)&lt;/em&gt;&lt;br/&gt;&lt;em&gt;        pixelarray[x+(width*y)] = color(glength);&lt;/em&gt;&lt;br/&gt;&lt;em&gt;      else&lt;/em&gt;&lt;br/&gt;&lt;em&gt;        pixelarray[x+(width*y)] = color(0);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Finally I load the array into the system array of pixels which is used to display the new image.&lt;br/&gt;&lt;br/&gt;&lt;em&gt;   for(int i = 0; i&amp;lt;width*height;i++) {&lt;/em&gt;&lt;br/&gt;&lt;em&gt;     pixels[i] = pixelarray[i];&lt;/em&gt;&lt;br/&gt;&lt;em&gt;   }&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;p&gt;Full code - &lt;a href="https://github.com/bigrichardc/sketchbook/blob/master/sobelImageDetection.pde"&gt;https://github.com/bigrichardc/sketchbook/blob/master/sobelImageDetection.pde&lt;/a&gt;&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/39672867616</link><guid>http://bigrichardc.tumblr.com/post/39672867616</guid><pubDate>Fri, 04 Jan 2013 14:13:00 -0500</pubDate><category>edge detectoin</category><category>sobel</category><category>sobel operator</category><category>processing</category></item><item><title>Edge Detection in Processing Using the Sobel Operator (Theory)</title><description>&lt;p&gt;I&amp;#8217;ve been doing some experiments with altering colour values of digital images and video depending upon their initial values, this led me to looking into how edge detection worked, doing a quick web search led me to pages about the Sobel operator.  Back in the mists of time I did a mathematics degree but after many years of not using any of the hard (or even easy) maths I was taught, I have forgotten it all, and so was left scratching my head looking at the various matrices and equations and words like convolution that I came across.&lt;br/&gt;&lt;br/&gt; After a bit more head scratching and considering putting on the too hard to do file, I found &lt;a href="http://www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/image-processing/edge_detection.html" title="Edge Detection"&gt;this&lt;/a&gt; Python/C++ tutorial on the which allowed me to work out what was going on and realise that the maths stuff just looked scary. &lt;/p&gt;
&lt;p&gt;In basic terms the Sobel operator is used to determine the intensity of colour of a pixel and of it&amp;#8217;s neighbours then using a method called convolution approximates the difference in intensity along the x and y axis.  A bit of a mouthfull I know but basically it does this:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Get the intensities of pixel x,y and of it&amp;#8217;s 8 surrounding pixels.&lt;/li&gt;
&lt;li&gt;Work out the change in intensity of the pixels across the x-axis.&lt;/li&gt;
&lt;li&gt;Work out intensity change in the y-axis.&lt;/li&gt;
&lt;li&gt;Use Pythagoras to work out overall change for those pixels.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;As seen in my bad diagram.&lt;/p&gt;
&lt;p&gt;&lt;img alt="image" src="http://media.tumblr.com/853cc00681b88c281dbd6e0082468b3b/tumblr_inline_mg4422uQu41qg8zg0.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;If you do this for each pixel on the screen you will get an intensity change level for each will allow you to build a picture showing the outlines like so:&lt;br/&gt;&lt;br/&gt;&lt;img alt="image" src="http://media.tumblr.com/7abe0e7896ade8edd57f28be5055ec9e/tumblr_inline_mg445sksoY1qg8zg0.jpg"/&gt;&lt;/p&gt;
&lt;p&gt;Another thing you need to know is that the Sobel operator consists of two matrices that look like this:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Sobel Operator" height="73" src="http://upload.wikimedia.org/math/3/9/5/395cc00c8df1f4c5d34aa998771c0e9c.png" width="501"/&gt;&lt;br/&gt;&lt;br/&gt;Basically these are the values you multiply the intensity of each pixel surrounding the pixel you are working out the change in intensity for, going left to right (Gx) and from top to bottom (Gy).  So when working out the change across the x-axis the position in the matrix corresponds to the value you would multiply the intensity of the pixel by, for example the pixel intensity in the top left hand corner by -1 and the intensity of the bottom right by +1.&lt;/p&gt;
&lt;p&gt;That really is all you need to know in order to be able to detect edges in an image, there are other types of operators that can be used to determine edges each with their own properties but as yet I have not looked at them.&lt;br/&gt;&lt;br/&gt;For more formal information including scary looking maths here&amp;#8217;s the Sobel operator Wiki page - &lt;a href="http://en.wikipedia.org/wiki/Sobel_operator"&gt;http://en.wikipedia.org/wiki/Sobel_operator&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;If that is not making too much sense my next post will look at the code I used to produce the above image which hopefully makes things clearer.&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/39668918856</link><guid>http://bigrichardc.tumblr.com/post/39668918856</guid><pubDate>Fri, 04 Jan 2013 13:15:00 -0500</pubDate><category>edge detection</category><category>sobel</category><category>bad diagram</category><category>theory</category><category>code</category><category>processing</category><category>image processing</category></item><item><title>Colour detection on BMX video.</title><description>&lt;img src="http://24.media.tumblr.com/9b03d5465e00b6b30e9dbc87b0ef04fb/tumblr_mg0evmYdwB1qh8l1ro1_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/c6dcf7840a46d5d36228056404c8432b/tumblr_mg0evmYdwB1qh8l1ro2_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/972aafbe63c41af345bcb92bae845d3b/tumblr_mg0evmYdwB1qh8l1ro3_500.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;p&gt;Colour detection on BMX video.&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/39484829102</link><guid>http://bigrichardc.tumblr.com/post/39484829102</guid><pubDate>Wed, 02 Jan 2013 12:50:10 -0500</pubDate></item><item><title>Experimenting with pixel colours.</title><description>&lt;img src="http://24.media.tumblr.com/e1e641426f1794ddb0018c33ead5adae/tumblr_mg09zokI611qh8l1ro1_400.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;img src="http://25.media.tumblr.com/0ff2e0e3055628bb3f972d40e5a586fc/tumblr_mg09zokI611qh8l1ro2_400.jpg"/&gt;&lt;br/&gt; &lt;br/&gt;&lt;p&gt;Experimenting with pixel colours.&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/39478713306</link><guid>http://bigrichardc.tumblr.com/post/39478713306</guid><pubDate>Wed, 02 Jan 2013 11:04:36 -0500</pubDate></item><item><title>comicsansmustdie:

z
</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_mel3vrFOtB1redfvvo1_500.gif"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;&lt;a class="tumblr_blog" href="http://comicsansmustdie.tumblr.com/post/37297668900/z"&gt;comicsansmustdie&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;z&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://bigrichardc.tumblr.com/post/37343083517</link><guid>http://bigrichardc.tumblr.com/post/37343083517</guid><pubDate>Thu, 06 Dec 2012 13:33:40 -0500</pubDate></item><item><title>Screen shot of the rotating squares sketch below.</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_memfsyCXQX1qh8l1ro1_r1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Screen shot of the rotating squares sketch below.&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/37341925644</link><guid>http://bigrichardc.tumblr.com/post/37341925644</guid><pubDate>Thu, 06 Dec 2012 13:10:00 -0500</pubDate></item><item><title>Translate, Rotate, Draw. (More Pushing and Popping)</title><description>&lt;p&gt;Experimenting a bit further with matrix co-ordinates, I realised that its quite easy to forget which order that you are supposed perform the order of things, so I (badly) drew an easy to follow diagram that shows me how to do it.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Step 1.&lt;/strong&gt;  The initial step, the matrix 0,0 co-ordinate starts at the top left hand corner of your window.  If you are using more than one it is here that you will pushMatrix().&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 2.&lt;/strong&gt; The translation step, the matrix is moved along the x and y axis to your desired spot.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 3.&lt;/strong&gt; The rotation, the matrix is rotated through the z axis.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 4.&lt;/strong&gt; Drawing, you can now draw whatever you want on the matrix.  It is here that you would call the popMatrix() if you needed to draw on another matrix.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;img alt="image" src="http://media.tumblr.com/tumblr_memfgzDWaX1qg8zg0.jpg"/&gt;&lt;br/&gt;This sketch uses the translate, rotate and push and pop matrix functions to rotate rectangles held in an ArrayList as the mouse hovers over them.&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;class&lt;/span&gt; Square {
  
  &lt;span&gt;int&lt;/span&gt; &lt;span&gt;x&lt;/span&gt;, &lt;span&gt;y&lt;/span&gt;;
  &lt;span&gt;int&lt;/span&gt; sideLength = 50;
  &lt;span&gt;int&lt;/span&gt; pen = 1;
  &lt;span&gt;int&lt;/span&gt; r = 120;
  
  
  Square() {
    &lt;span&gt;x&lt;/span&gt; = (&lt;span&gt;int&lt;/span&gt;)&lt;span&gt;random&lt;/span&gt;(&lt;span&gt;width&lt;/span&gt;-sideLength);
    &lt;span&gt;y&lt;/span&gt; = (&lt;span&gt;int&lt;/span&gt;)&lt;span&gt;random&lt;/span&gt;(&lt;span&gt;height&lt;/span&gt;-sideLength);
  }
  
  Square(&lt;span&gt;int&lt;/span&gt; x1, &lt;span&gt;int&lt;/span&gt; y1) {
    &lt;span&gt;x&lt;/span&gt;=x1;
    &lt;span&gt;y&lt;/span&gt;=y1;
  }  
    
  &lt;span&gt;void&lt;/span&gt; drawSquare() {
    &lt;span&gt;strokeWeight&lt;/span&gt;(pen);
    &lt;span&gt;fill&lt;/span&gt;(r,0,0);
    &lt;span&gt;pushMatrix&lt;/span&gt;();
      &lt;span&gt;translate&lt;/span&gt;(&lt;span&gt;x&lt;/span&gt;,&lt;span&gt;y&lt;/span&gt;);
      &lt;span&gt;rect&lt;/span&gt;(0,0,sideLength, sideLength);
      &lt;span&gt;line&lt;/span&gt;(-sideLength/2,-sideLength/2,sideLength/2,sideLength/2);
    &lt;span&gt;popMatrix&lt;/span&gt;();
  }
  
  &lt;span&gt;void&lt;/span&gt; drawRotatedSquare() {
    &lt;span&gt;strokeWeight&lt;/span&gt;(pen);
    &lt;span&gt;fill&lt;/span&gt;(r,255-r,r);
    &lt;span&gt;pushMatrix&lt;/span&gt;();
      &lt;span&gt;translate&lt;/span&gt;(&lt;span&gt;x&lt;/span&gt;,&lt;span&gt;y&lt;/span&gt;);
      &lt;span&gt;rotate&lt;/span&gt;(90*&lt;span&gt;PI&lt;/span&gt;/180);
      &lt;span&gt;rect&lt;/span&gt;(0,0,sideLength, sideLength);
      &lt;span&gt;line&lt;/span&gt;(-sideLength/2,-sideLength/2,sideLength/2,sideLength/2);
    &lt;span&gt;popMatrix&lt;/span&gt;();
  }
  
  &lt;span&gt;boolean&lt;/span&gt; mouseOver(&lt;span&gt;int&lt;/span&gt; mx,&lt;span&gt;int&lt;/span&gt; my) {
    &lt;span&gt;if&lt;/span&gt; ( mx  &amp;gt;= &lt;span&gt;x&lt;/span&gt;-sideLength/2 &amp;amp;&amp;amp; mx &amp;lt; &lt;span&gt;x&lt;/span&gt;+sideLength/2) {
      &lt;span&gt;if&lt;/span&gt; ( my  &amp;gt;= &lt;span&gt;y&lt;/span&gt;-sideLength/2 &amp;amp;&amp;amp; my &amp;lt; &lt;span&gt;y&lt;/span&gt;+sideLength/2) {
      &lt;span&gt;return&lt;/span&gt; &lt;span&gt;true&lt;/span&gt;;
      }
      &lt;span&gt;else&lt;/span&gt; &lt;span&gt;return&lt;/span&gt; &lt;span&gt;false&lt;/span&gt;;
    } &lt;span&gt;else&lt;/span&gt; &lt;span&gt;return&lt;/span&gt; &lt;span&gt;false&lt;/span&gt;;
  } 
}

Square &lt;span&gt;sq&lt;/span&gt;;
&lt;span&gt;ArrayList&lt;/span&gt; sqs = &lt;span&gt;new&lt;/span&gt; &lt;span&gt;ArrayList&lt;/span&gt;();
&lt;span&gt;int&lt;/span&gt; rotCount = 0;


&lt;span&gt;void&lt;/span&gt; &lt;span&gt;setup&lt;/span&gt;()
{
  &lt;span&gt;rectMode&lt;/span&gt;(&lt;span&gt;CENTER&lt;/span&gt;);
  &lt;span&gt;size&lt;/span&gt;(500,500);
  &lt;span&gt;for&lt;/span&gt; (&lt;span&gt;int&lt;/span&gt; &lt;span&gt;y&lt;/span&gt; = 0; &lt;span&gt;y&lt;/span&gt;&amp;lt;&lt;span&gt;height&lt;/span&gt;-50; &lt;span&gt;y&lt;/span&gt;+=100) {
    &lt;span&gt;for&lt;/span&gt; (&lt;span&gt;int&lt;/span&gt; &lt;span&gt;x&lt;/span&gt; = 0; &lt;span&gt;x&lt;/span&gt; &amp;lt; &lt;span&gt;&lt;strong&gt;width&lt;/strong&gt;&lt;/span&gt;-50; &lt;span&gt;x&lt;/span&gt;+=100)
    {
      &lt;span&gt;sq&lt;/span&gt; = &lt;span&gt;new&lt;/span&gt; Square(&lt;span&gt;x&lt;/span&gt;+50,&lt;span&gt;y&lt;/span&gt;+50);
      sqs.&lt;span&gt;&lt;strong&gt;add&lt;/strong&gt;&lt;/span&gt;(&lt;span&gt;sq&lt;/span&gt;);
    }
  }
}

&lt;span&gt;void&lt;/span&gt; &lt;span&gt;draw&lt;/span&gt;() {
  rotCount = 0;
  &lt;span&gt;background&lt;/span&gt;(190,0,0);
  &lt;span&gt;int&lt;/span&gt; listSize = (sqs.&lt;span&gt;size&lt;/span&gt;());
  Square s;
  &lt;span&gt;for&lt;/span&gt; (&lt;span&gt;int&lt;/span&gt; i = 0; i&amp;lt;listSize; i++)
  {
    s = (Square)sqs.&lt;span&gt;&lt;strong&gt;get&lt;/strong&gt;&lt;/span&gt;(i);
    &lt;span&gt;if&lt;/span&gt; (s.mouseOver(&lt;span&gt;&lt;strong&gt;mouseX&lt;/strong&gt;&lt;/span&gt;,&lt;span&gt;&lt;strong&gt;mouseY&lt;/strong&gt;&lt;/span&gt;)) {
      s.pen = 6;
      s.r = (&lt;span&gt;int&lt;/span&gt;)&lt;span&gt;random&lt;/span&gt;(255);
      s.drawRotatedSquare();
    }
    &lt;span&gt;else&lt;/span&gt; {
      s.pen = 1;
      s.drawSquare();      
    }
  }
}



&lt;/pre&gt;</description><link>http://bigrichardc.tumblr.com/post/37341834170</link><guid>http://bigrichardc.tumblr.com/post/37341834170</guid><pubDate>Thu, 06 Dec 2012 13:08:00 -0500</pubDate><category>pushMatrix</category><category>popMatrix</category><category>processing</category><category>rotation in processing</category><category>translation</category></item><item><title>Output from sketch in previous post.</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_mekey9yrnV1qh8l1ro1_500.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Output from sketch in previous post.&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/37263964678</link><guid>http://bigrichardc.tumblr.com/post/37263964678</guid><pubDate>Wed, 05 Dec 2012 10:56:33 -0500</pubDate></item><item><title>Pushing and Popping</title><description>&lt;p&gt;Being a bit lazy it&amp;#8217;s taken me quite a while to work out how pushMatrix() and popMatrix() actually work and why I would need them.  Whenever I have tried to rotate things around point before they&amp;#8217;ve just gone whizzing off around the screen and in no apparent order whatsoever so I went off in a huff and did something else instead.  Today I decided to sit down and actually see where I was going wrong.&lt;/p&gt;
&lt;p&gt;With the help of these three helpful pages:&lt;/p&gt;
&lt;p&gt;1. &lt;a href="http://www.learningprocessing.com/examples/chapter-14/example-14-12-rotating-one-square/" title="Rotating One Square"&gt;Daniel Shiffman&amp;#8217;s Learning Processing&lt;/a&gt;&lt;br/&gt;2. &lt;a href="http://btk.tillnagel.com/tutorials/rotation-translation-matrix.html" title="Rotating in Processing"&gt;Tlll Nagel&amp;#8217;s Creative Coding&lt;/a&gt;&lt;br/&gt;3. &lt;a href="http://criticalzero.co.uk/rotation-in-processing-js" title="Rotation in Processing"&gt;Critical Zero&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The rotate() function in Processing rotates the entire co-ordinate matrix which means that everything rotates around the same centre point.  A co-ordination matrix is like a glass surface with images drawn onto it which can then me moved around or rotated.  Calling the pushMatrix() function adds another co-ordinate matrix which would be similar to placing another glass surface over the original, this can also be moved and rotated and drawn on without effecting the original.  The popMatrix() function then returns you to the previous matrix and allows you to work on that.&lt;/p&gt;
&lt;p&gt;This is a simple sketch that fills the screen with rectangles and using pushing and popping rotates each of them around their centre points:&lt;/p&gt;
&lt;pre&gt;float angle = 0;

void setup () { 
  size(500,500);
  rectMode(CENTER);
}

void draw() {
  background(0);
  angle+= 0.05;
  for (int y = 0; y &amp;lt; height-50; y+=50)
  {
  
    for (int x = 0; x &amp;lt; width-50; x+=50)
    {
  
    pushMatrix(); 
    translate(50+x,50+y);
    rotate(angle);
    rect(0,0,50,50);
    popMatrix();
    }
  }
}
&lt;/pre&gt;</description><link>http://bigrichardc.tumblr.com/post/37263463992</link><guid>http://bigrichardc.tumblr.com/post/37263463992</guid><pubDate>Wed, 05 Dec 2012 10:44:00 -0500</pubDate><category>popMatrix</category><category>processing</category><category>pushMatrix</category><category>pushing and popping</category><category>rotate</category><category>translate</category><category>rotation in processing</category></item><item><title>Surreal!</title><description>&lt;iframe src="http://player.vimeo.com/video/27003856" width="400" height="225" frameborder="0"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Surreal!&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/36880377134</link><guid>http://bigrichardc.tumblr.com/post/36880377134</guid><pubDate>Fri, 30 Nov 2012 09:48:56 -0500</pubDate></item><item><title>Linked Lists in Processing</title><description>&lt;p&gt;I&amp;#8217;ve been playing around with using a linked list to create a slideshow in Processing. I know that in Java you can use the &lt;a href="http://docs.oracle.com/javase/6/docs/api/java/util/LinkedList.html"&gt;LinkedList&lt;/a&gt; item and methods to do this but I decided to experiment with using &amp;#8220;pointers&amp;#8221; (alright they don&amp;#8217;t really exist in this language) to create the data structure myself.&lt;/p&gt;
&lt;p&gt;It&amp;#8217;s very stripped down and there is not error checking but the code is fairly self explanatory:&lt;/p&gt;

&lt;pre&gt;class LLink {

// This is the object that contains the data i.e. the filename
// and the node which points to the next item in the list
  
    public String filename;
    //This will point to the next item if any in the list.
    public LLink nextLink;
  
  
  //Link Constructor
  public LLink(String fn) {
    filename = fn;
    
  }  
}


class LinkList {
  
  //This is the structure for the linked list.
  
  //This will contain the first item of the list.  As it is a
  //stack type data structure every time a new item is added
  //to the list it becomes the first item.
  private LLink first;
  
  //current here is used to point to the next item from the list
  //which can be retrieved.
  private LLink current;
  
  //create an empty list
  public LinkList() {
    first = null;
  }
  
  //add an item to the list;
  public void insert (String fn) {
    //create a new node item
    LLink llink = new LLink (fn);
    //point new node to the current first item in list
    llink.nextLink = first;
    //set new item as first item
    first = llink;
    
    //if this is the first item added then it becomes the first
    //item that can be retrieved
    if (first.nextLink == null)
      current = first;
      
  }
  
  public String getNext() {
    //as long as there more items to be retrieved
    if (current.nextLink != null)
    {
      //grab the next item
      current  = current.nextLink;
    } //otherwise grab the first item again.
    else {
      current = first;
    }
    return current.filename;
  }  
}

PImage bg;
LinkList llist = new LinkList();

void setup() {
  size(640, 480);
  
  
  //add some filenames to the list
  llist.insert("E1.jpg");
  llist.insert("E2.jpg");
  llist.insert("E3.jpg");
  
  bg = loadImage(llist.getNext());
  
  
}

void draw () {
  image (bg, 0,0);
  bg = loadImage(llist.getNext());
  delay(500);
}
&lt;/pre&gt;</description><link>http://bigrichardc.tumblr.com/post/35908992607</link><guid>http://bigrichardc.tumblr.com/post/35908992607</guid><pubDate>Sat, 17 Nov 2012 09:19:01 -0500</pubDate><category>linked lists</category><category>processing</category><category>code</category><category>slideshow</category><category>java</category></item><item><title>Animated Shigeto (GIMP changed the JPEGs to indexed colour) at...</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_mco982zyru1qh8l1ro1_500.gif"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Animated Shigeto (GIMP changed the JPEGs to indexed colour) at TodaysArt.nl&lt;/p&gt;
&lt;p&gt;&lt;a href="http://soundcloud.com/shigeto"&gt;http://soundcloud.com/shigeto&lt;/a&gt;&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/34585909791</link><guid>http://bigrichardc.tumblr.com/post/34585909791</guid><pubDate>Mon, 29 Oct 2012 16:36:02 -0400</pubDate></item><item><title>The excellent Roll the Dice at TodaysArt...</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_mco5roWd4Y1qh8l1ro1_500.gif"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;The excellent Roll the Dice at TodaysArt 2012.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://soundcloud.com/roll-the-dice"&gt;&lt;a href="http://soundcloud.com/roll-the-dice"&gt;http://soundcloud.com/roll-the-dice&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/34580684231</link><guid>http://bigrichardc.tumblr.com/post/34580684231</guid><pubDate>Mon, 29 Oct 2012 15:21:23 -0400</pubDate></item><item><title>This is another automatically uploaded file</title><description>&lt;img src="http://24.media.tumblr.com/tumblr_mcgeuhS7wv1qh8l1ro1_100.jpg"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;This is another automatically uploaded file&lt;/p&gt;</description><link>http://bigrichardc.tumblr.com/post/34297568811</link><guid>http://bigrichardc.tumblr.com/post/34297568811</guid><pubDate>Thu, 25 Oct 2012 10:56:41 -0400</pubDate></item></channel></rss>
