"un-mirror" an image
              in 
             Programming Questions 
              •  
              2 years ago    
            
 
           
             This is probably the easiest/most obvious answer, but I've been stuck on this for a bit anyway.
            
             
            
            
             
            
            
             
            
            
             
              
            
            
             
            
            
             
            
            
             
            
            
 
            
           
             I'm playing with Processing + a Kinect, and I'm looking at Daniel Shiffman's released code, specifically the AveragePointTracking example. In it, he grabs the depth map, flips it so it will appear the right way on a screen, and then colors certain pixels red. I understand the majority of the code, but for the life of me I can't figure out how to get it to not flip the image (I'm using a projector, so don't want it flipped).
            
            
             Here is the code:
            
            - void display() {
 - PImage img = kinect.getDepthImage();
 - // Being overly cautious here
 - if (depth == null || img == null) return;
 - // Going to rewrite the depth image to show which pixels are in threshold
 - // A lot of this is redundant, but this is just for demonstration purposes
 - display.loadPixels();
 - for(int x = 0; x < kw; x++) {
 - for(int y = 0; y < kh; y++) {
 - // mirroring image
 - int offset = kw-x-1+y*kw;
 - // Raw depth
 - int rawDepth = depth[offset];
 - int pix = x+y*display.width;
 - if (rawDepth < threshold) {
 - // A red color instead
 - display.pixels[pix] = color(150,50,50);
 - }
 - else {
 - display.pixels[pix] = img.pixels[offset];
 - }
 - }
 - }
 - display.updatePixels();
 - // Draw the image
 - image(display,0,0);
 - }
 
             here's a link to his whole code set, if more information is required:
            
            
            
             thanks so much in advance..
            
 
            
              
              1  
            
 
            