MAS.131 : Computational Camera and Photography  
 
  ABOUT ASSIGNMENT1     ASSIGNMENT2   ASSIGNMENT3 ASSIGNMENT4 FINAL PROJECT      
 
    [assignment1]
   
 

 

   
COLOR SWAP

The original photos in this project were taken by Nikon Coolpix P80 camera with 10.1 megapixel sensor. The objective was to combine multiple photos of a scene with different parameters such as light settings, exposure, focus, etc by blending color channels. The programming for the image processing was done using C++ in openFrameworks.
Figure4 Original photo captured with Nikon Coolpix P80  
   
 
 
Figure5 Original photos captured with Nikon Coolpix P80    
   
Figure6 Color Swap intermediate result_mixing channels and alpha    
   
Figure7 Color Swap final output image capture    
   
Figure8 Color Swap final output video capture | vimeo link    
 

main.cpp

#include "testApp.h"
#include "ofAppGlutWindow.h"

//========================================================================
int main( ){

ofAppGlutWindow window;
ofSetupOpenGL(&window, 1024,768, OF_WINDOW);
ofRunApp( new testApp());

}

 

//========================================================================
testApp.h

#pragma once

#include "ofMain.h"

class testApp : public ofBaseApp{

public:
void setup();
void update();
void draw();

ofImage img1;
ofImage img2;
ofImage img3;
ofImage img2small;
ofImage img3small;
ofImage img4small;
ofImage img5small;
ofImage img4;
ofImage img4dots;
ofImage img5;

};

//========================================================================
testApp.cpp

#include "testApp.h"

//--------------------------------------------------------------
void testApp::setup(){



img1.loadImage("images/img1.jpg");
img2.loadImage("images/img2.jpg");
img3.loadImage("images/img3.jpg");
img4.loadImage("images/img4.jpg");
img5.loadImage("images/img5.jpg");

img4dots.loadImage("images/img4.jpg");

img2small.loadImage("images/img2.jpg");
img2small.resize(img2small.width, img2small.height*4);
img2small.setImageType(OF_IMAGE_GRAYSCALE);

img3small.loadImage("images/img3.jpg");
img3small.resize(img3small.width*4, img3small.height*4);
img3small.setImageType(OF_IMAGE_GRAYSCALE);


img4small.loadImage("images/img4.jpg");
img4small.resize(img4small.width*5, img4small.height*7);
//img4small.setImageType(OF_IMAGE_GRAYSCALE);

img5small.loadImage("images/img5.jpg");
img5small.resize(img5small.width*3.6, img5small.height*3.6);
img5small.setImageType(OF_IMAGE_GRAYSCALE);



}

 

//--------------------------------------------------------------
void testApp::update(){
ofBackground(255);

}

//--------------------------------------------------------------
void testApp::draw(){

ofEnableAlphaBlending();


ofSetColor(50, 50, 220);
img3small.draw(0, 0);

ofSetColor(50, 50, 220,80);
img5small.draw(0, 0);

ofSetColor(255, 0, 0, 42);
img2small.draw(0, 0);

ofSetColor(255,255, 0, 95);
img2.draw(0, 5);

ofSetColor(0,0,255, 40);
img1.draw(0, 0);


ofSetColor(0,0, 115, 30);
img2.draw(10, 0);



ofSetColor(255,0,0,80);
img3.draw(20, 10);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);

ofSetColor(0,255,0,20);
img4.draw(30, 0);



ofSetColor(255,255,0,90);
img5.draw(30, 0);

ofSetColor(255, 0 ,0, 100);
img2.draw(50, 0);
glDisable(GL_BLEND);
ofDisableAlphaBlending();
ofEnableAlphaBlending();



ofSetColor(0,0,255, 20);
img1.draw(0, 100);


ofSetColor(0,0, 115, 20);
img2.draw(10, 200);


//ofEnableAlphaBlending();
ofSetColor(255,0,0,10);
img3.draw(200, 10);


ofSetColor(255,0,0,45);
img4.draw(30, 80);


ofSetColor(255,255,0,20);
img5.draw(30, 40);

glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR);
ofSetColor(255,0,0,42);
float wave = sin(ofGetElapsedTimef());
img4dots.draw(20, 500 + (wave * 100));
glDisable(GL_BLEND);
ofDisableAlphaBlending();
ofEnableAlphaBlending();
ofSetColor(255,255,0, 35);
img4.draw(20, 300 + (wave *50));

ofSetColor(0,0,255, 40);
img3.draw(20, 250 +(wave*30));

ofSetColor(0,0,255, 50);
img3.draw(20, 200 +(wave*20));

ofDisableAlphaBlending();

}

     
sourcecode was developed in openFrameworks platform   PREV TOP NEXT
   
   

 

     
 
2011 ©
Instructors: Ramesh Raskar, Douglas Lanman, cameraculture.media.mit.edu
MIT Media Lab Lecture: F1-4 (E14-525), assignments done by Austin S. Lee austinslee.com