Photogrammetry Booth

I recently joined a group interested in photogrammetry, it is worth saying that I have been exploring this technology for the past three years. I believe that there is a huge ground yet to be covered and also that it has a huge potential for VR, AR, and game development industries.

A month ago, I had the opportunity to attend a quite interesting meeting held at CSM where a research team shared their experience in building a portable photogrammetry booth that could be used by both museums and similar organizations interested in documenting their collections.

I was really impressed by the array of 7 DSLR cameras, all reacting to the synchronized movement of a rotating platform holding the 3D Model. This project inspired me to create a low-cost alternative using Raspberry Pys as I already knew you could use them as cheap DSLR cameras.

I started my research by looking at the Raspberry Pi camera features and I was lucky enough to have access to both 5MP and 8MP versions so it was easy for me to run a series of tests using both cameras.

First, I learned how to take a single image using a python script that was executed from the Raspberry Pi. On the first two lines, it just calls some libraries needed to take the photo, the third line calls the camera object and the forth activates it, from there, all the consecutive lines set different parameters for the camera. Next, ” camera.capture” saves the image in a specific folder and the last line shuts the camera off.

from picamera import PiCamera
from time import sleep

camera = PiCamera()

camera.start_preview()
sleep(3)
camera.iso = 100
camera.shutter_speed =8000
camera.sharpness = 10
camera.resolution = camera.MAX_RESOLUTION
camera.capture('/home/pi/Desktop/test3.jpg')
camera.stop_preview ()

It worked!

Next, I wanted to create a code that would allow me to take simultaneous photographs of an object from 8 different angles. As I did not have a rotating platform, I was aware that I needed enough time to manually rotate the object up to 45 degrees each time in order to achieve a full 360 rotation in 8 steps.

And this is the code I managed to create, it is basically the single image code duplicated eight times and separated by a small delay (sleep (X)).

from picamera import PiCamera
from time import sleep

camera = PiCamera()

camera.start_preview()
sleep(3)
camera.iso = 150
camera.shutter_speed =7000
camera.sharpness = 100
camera.capture('/home/pi/Desktop/imagesP4/imageA1.jpg')
camera.stop_preview ()
sleep(5)
camera.start_preview()
camera.iso = 150
camera.shutter_speed =7000
camera.sharpness = 100
camera.capture('/home/pi/Desktop/imagesP4/imageA2.jpg')
camera.stop_preview ()
sleep(5)
camera.start_preview()
camera.iso = 150
camera.shutter_speed =7000
camera.sharpness = 100
camera.capture('/home/pi/Desktop/imagesP4/imageA3.jpg')
camera.stop_preview ()
sleep(5)
camera.start_preview()
camera.iso = 150
camera.shutter_speed =7000
camera.sharpness = 100
camera.capture('/home/pi/Desktop/imagesP4/imageA4.jpg')
camera.stop_preview ()
sleep(5)
camera.start_preview()
camera.iso = 150
camera.shutter_speed =7000
camera.sharpness = 100
camera.capture('/home/pi/Desktop/imagesP4/imageA5.jpg')
camera.stop_preview ()
sleep(5)
camera.start_preview()
camera.iso = 150
camera.shutter_speed =7000
camera.sharpness = 100
camera.capture('/home/pi/Desktop/imagesP4/imageA6.jpg')
camera.stop_preview ()
sleep(5)
camera.start_preview()
camera.iso = 150
camera.shutter_speed =7000
camera.sharpness = 100
camera.capture('/home/pi/Desktop/imagesP4/imageA7.jpg')
camera.stop_preview ()
sleep(5)
camera.start_preview()
camera.iso = 150
camera.shutter_speed =7000
camera.sharpness = 100
camera.capture('/home/pi/Desktop/imagesP4/imageA8.jpg')
camera.stop_preview ()

I also managed to create a proper setup using two sidelights and a lightbox to fade shadows as much as possible. I also managed to create a quite practical camera tripod by using a flexible desk light I had around.

Continue on page two.

Heat meter – Arduino

This is another basic exercise form the arduino starter kit, in this case I am using a temperature sensor to measure room temperature, as the temperature rises (by touching the sensor), lights are turned on.

This is the code:

/*We set two constants, one with the name of the analog pin and
 another for the ambient temperature
 */
const int sensorPin =A0;
/* to adjust the right temperature, you should check the initial 
value that the micropocessor sends back in the variable volts
 */
const float tempAmbient = 22.0;
 
void setup() {
  Serial.begin(9600);
 //with this loop, we set ports 2 to 4 to work as output and make shure the lights are off
  for(int pinNumber = 2; pinNumber<5; pinNumber ++){
      pinMode(pinNumber, OUTPUT);
      digitalWrite(pinNumber,LOW);
  }
  }

void loop() {
  /*with this loop we constantly check and print the values returned from the temperature 
 sensor, the volts (with a little math) on that pin and the temperature.
   */
  int sensorVal = analogRead(sensorPin);
  Serial.print("Value of the sensor: ");
  Serial.print(sensorVal);
  float volts = (sensorVal/1024.0)*5;
  Serial.print(", Volts: ");
  Serial.print(volts);
  Serial.print(", Degrees C: ");
  /*the values used for this equation are particular to the sensor provided in the kit,
  this is how whe calculate the temperature.
   */
  float temperature = (volts- .5)*100;
  Serial.println(temperature);
  //this conditional structure allows to determine mow many lights need to be turned on
if(temperature < tempAmbient){
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  }
  else if(temperature >= tempAmbient+1 && temperature < tempAmbient+2){
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);  
    }
   else if(temperature >= tempAmbient+2 && temperature < tempAmbient+3){
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);  
    }
    else if(temperature >= tempAmbient+3){
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);  
    }
    delay(1);
}

This is how it looks on the monitor

This is how the circuit works

Button and lights – Arduino

Today  started working whit Arduino (again), but this time I have a good excuse to use it so I hope this will be integrated with future work, around march this year I did a couple of tutorials using Arduino, but I did not document them, now I am going to do it as an exercise for my memory and also to tidy up mi knowledge on this matter, it is worth to mention that recently I started to study C# and my goal is to be able to connect both VR and Arduino through Unity.

This first example is just a simple circuit that allows me to change the order for the lights to turn on, so I am using a push button to do this, if the button is not pressed (LOW), the lights will be turned on in an specific order, otherwise, if the button is pressed (HIGH) the order will change (this is an exercise form the Arduino starter kit)

This is the code:

//this is te variable that is going to store the two values for the bush button
int switchState=0;
void setup() {
  //we use the pinMode function to set the pins to be either for input or for output
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(2,INPUT);

}

void loop() {
  //we loop to check if the button is pressed
  switchState = digitalRead(2);
  //if the button is not pressed then the lights get turned on in this sequence
  if(switchState == LOW){
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(250); //wait for a quarter of a second
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  delay(250); //wait for a quarter of a second
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  delay(250); //wait for a quarter of a second
  //if the button is pressed then the lights are turned on in this sequence
} else {
  
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  delay(250); //wait for a quarter of a second
  digitalWrite(3, LOW);
  digitalWrite(4, HIGH);
  digitalWrite(5, LOW);
  delay(250); //wait for a quarter of a second
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, HIGH);
  delay(250); //wait for a quarter of a second
  }
}

This is the circuit being tested