一、SKY1僅需步進馬達驅動程式,其他都由免費軟體程行。SKY2從影像截取、分析到3D坐標轉換都要己來,下面是影像截取程式。
二、開發工具:PROCESSING 2.1
下載:https://processing.org/download/
CAM控制:JMyron 0025
下載: http://webcamxtra.sourceforge.net/download.shtml
三、影像截取程式
import JMyron.*;
//objects
PFont f;
JMyron cam;
PrintWriter output;
int FileCount=1;
//colors
color black=color(0);
color white=color(255);
//scanner parameters
float Steps = 271; //number steps of motor per revolution
float AngleLaserCamera = 30*PI/180; //angle between laser and camera [radian]
float AngleTwoStep=2*PI/Steps; //angle between 2 step [radian]
//================= CONFIG ===================
void setup() {
size(640,480);
strokeWeight(1);
smooth();
background(0);
//fonts
f=createFont("Arial",16,true);
cam = new JMyron();
cam.start(width, height);
cam.findGlobs(0);
}
//============== MAIN PROGRAM =================
void draw() {
PImage RealImage=createImage(width,height,RGB);
cam.update();
delay(1000);
cam.update();
RealImage.loadPixels();
int[] currFrame = cam.image();
loadPixels();
for (int n=0;n<RealImage.width*RealImage.height;n++){
RealImage.pixels[n]=currFrame[n];
pixels[n] = currFrame[n];
}
RealImage.updatePixels();
updatePixels();
String RealImageFileName="RealImage-"+nf(FileCount, 3)+".png";
RealImage.save(RealImageFileName);
println(FileCount);
if (FileCount == Steps ) {
println("End getting image......");
//println("End processing.........");
noLoop();
} else {
FileCount=FileCount+1;
}
}
四、部分結果
(準備統測中,其他部分有空再補)
沒有留言:
張貼留言