Face Detect Library / ¾ó±¼ ÀÎ½Ä ¶óÀ̺귯¸®
ÇÁ·Î¼¼½Ì¿ë ¾ó±¼ ÀÎ½Ä ¶óÀ̺귯¸®(ÀÎÅÚ ¸Æ)
openCV¸¦ ÀÌ¿ë
June 8, 2008 8:30 AM | Permalink | Comments (0)
ÇÁ·Î¼¼½Ì¿ë ¾ó±¼ ÀÎ½Ä ¶óÀ̺귯¸®(ÀÎÅÚ ¸Æ)
openCV¸¦ ÀÌ¿ë
June 8, 2008 8:30 AM | Permalink | Comments (0)
0. PFont() : ÆùÆ® ¼±¾ð
PFont´Â ÇÁ·Î¼¼½Ì¿¡¼ »ç¿ëÇÏ´Â ÆùÆ® Ŭ·¡½ºÀÔ´Ï´Ù. ÆùÆ®¸¦ »ç¿ëÇϱâ À§Çؼ´Â ¹Ýµå½Ã ÆùÆ® Ŭ·¡½º¸¦ ¼±¾ðÇØ¾ß ÇÕ´Ï´Ù.
PFont name

1. loadFont() : vlw ÆùÆ® »ç¿ë
ȸ鿡 ÅØ½ºÆ®¸¦ Ç¥½ÃÇϱâ À§Çؼ´Â loadFont()ÇÔ¼ö·Î ¿ì¼± ÆùÆ®¸¦ ·ÎµåÇØ¾ß ÇÕ´Ï´Ù.
ÇÁ·Î¼¼½Ì¿¡¼ ±âº»ÀûÀ¸·Î »ç¿ëÇÒ ¼ö ÀÖ´Â ÆùÆ®´Â vlw¶ó´Â È®ÀåÀÚ¸¦ °¡Áø ÆùÆ®ÀÔ´Ï´Ù.
ÀÌ ÆùÆ®´Â ÇÁ·Î¼¼½Ì¿¡¼ ¹Û¿¡ »ç¿ëÇÒ ¼ö ¾ø´Â ºñÆ®¸Ê ÆùÆ®·Î ÇÁ·Î¼¼½ÌÀ» ÀνºÅçÇØµµ ¼³Ä¡µÇÁö ¾Ê±â ¶§¹®¿¡ »ç¿ëÀÚ°¡ Á÷Á¢ ¸¸µé¾î¾ß ÇÕ´Ï´Ù. Tools > Create Font ¸Þ´º¸¦ ¼±ÅÃÇÏ¸é ½Ã½ºÅÛ¿¡ ¼³Ä¡µÈ ÆùÆ®¸®½ºÆ®(À§ ±×¸²)°¡ ³ª¿É´Ï´Ù. ¸®½ºÆ®¿¡¼ »ç¿ëÇÒ ÆùÆ®¿Í »çÀÌÁ Á¤Çϰí OK¸¦ ´©¸£¸é dataÆú´õ¿¡ .vlw ÆùÆ®°¡ »ý¼ºµË´Ï´Ù.
loadFont("fontname.vlw")
2. createFont() : ttf, otf ÆùÆ® »ç¿ë
createFont()ÇÔ¼ö¸¦ ÀÌ¿ëÇØ¼ vlwÆùÆ®À̿ܿ¡ ½Ã½ºÅÛÀ̳ª dataÆú´õ¿¡ ¼³Ä¡µÈ ttf, otfÆùÆ®¸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
createFont("fontname", size)
createFont("fontname", size, smooth)
void setup() {
size(200, 200);
// Uncomment the following two lines to see the available fonts
//String[] fontList = PFont.list();
//println(fontList);
myFont = createFont("FFScala", 32);
textFont(myFont);
text("!@#$%", 10, 50);
}
3. textFont() : ÆùÆ® ¼±ÅÃ, »çÀÌÁî ÁöÁ¤
textFont(font, size)
font : »ç¿ëÇÒ ÆùÆ®¸¦ ÁöÁ¤
size : ÆùÆ® »çÀÌÁî ÁöÁ¤
4. text() : ÅØ½ºÆ® Ç¥½Ã
text(data, x, y)
data : Ç¥½ÃÇÒ ÅØ½ºÆ®
x, y : ÅØ½ºÆ®¸¦ Ç¥½ÃÇÒ ÁÂÇ¥ÁöÁ¤
5. fill() : ÅØ½ºÆ® »ö ÁöÁ¤
October 17, 2007 7:36 PM | Permalink | Comments (0)
import JMyron.*;
JMyron m;//a camera object
void setup(){
size(320,240);
m = new JMyron();//make a new instance of the object
m.start(40,30);//start a capture at 320x240
m.findGlobs(0);//disable the intelligence to speed up frame rate
println("Myron " + m.version());
noStroke();
}
void draw(){
m.update();//update the camera view
int[] img = m.image(); //get the normal image of the camera
int i = 0;
for(int y = 0; y< 30;y++) {
for(int x = 0; x< 40; x++) {
fill(color(img[i]));
rect(x*8,y*8,8,8);
i++;
}
}
}
void mousePressed(){
m.settings();//click the window to get the settings
}
public void stop(){
m.stop();//stop the object
super.stop();
}
August 30, 2007 2:53 PM | Permalink | Comments (0)
import JMyron.*;
JMyron m;//a camera object
void setup(){
size(320,240);
m = new JMyron();//make a new instance of the object
m.start(width,height);//start a capture at 320x240
m.findGlobs(0);//disable the intelligence to speed up frame rate
println("Myron " + m.version());
}
void draw(){
m.update();//update the camera view
int[] img = m.image(); //get the normal image of the camera
loadPixels();
for (int i = 0;i < img.length;i++) {
int grey = (int)brightness(img[i]);
pixels[i] = color(grey,grey,grey);
// int grey = ((img[i] >> 16 & 0xff) + (img[i] >> 8 & 0xff) + (img[i] & 0xff))/3;
// pixels[i] = (int)(0xff000000 | grey << 16 | grey << 8 | grey);
}
updatePixels();
}
void mousePressed(){
m.settings();//click the window to get the settings
}
public void stop(){
m.stop();//stop the object
super.stop();
}
August 30, 2007 2:52 PM | Permalink | Comments (0)
import JMyron.*;
JMyron m;//a camera object
int threshold;
void setup(){
size(320,240);
m = new JMyron();//make a new instance of the object
m.start(width,height);//start a capture at 320x240
m.findGlobs(0);//disable the intelligence to speed up frame rate
println("Myron " + m.version());
threshold = 100;
}
void draw(){
m.update();//update the camera view
int[] img = m.image(); //get the normal image of the camera
for (int i = 0;i < img.length;i++) {
if (brightness(img[i]) > threshold) img[i] = 0xffffffff;
else img[i] = 0xff000000;
}
loadPixels();
arraycopy(img,pixels); //draw each pixel to the screen
updatePixels();
}
void mousePressed(){
m.settings();//click the window to get the settings
}
public void stop(){
m.stop();//stop the object
super.stop();
}
August 30, 2007 2:50 PM | Permalink | Comments (0)
ÇöÀç ÇÁ·¹ÀÓ°ú ¹Ù·Î ¾Õ ÇÁ·¹ÀÓÀÇ Â÷À̸¦ º¸¿©ÁÖ´Â ¿¹Á¦ÀÔ´Ï´Ù.
/**
* Frame Differencing
* by Golan Levin.
*/
import JMyron.*;
int numPixels;
int[] previousFrame;
JMyron m;
void setup() {
size(320,240); // Change size to 320 x 240 if too slow at 640 x 480
m = new JMyron();
m.start(width, height);
numPixels = width * height;
previousFrame = new int[numPixels];
m.findGlobs(0);
}
void draw() {
m.update();//update the camera view
int[] img = m.image(); //get the normal image of the camera
loadPixels();
int movementSum = 0; // Amount of movement in the frame
for (int i = 0; i < numPixels; i++) { // For each pixel in the video frame...
color currColor = img[i];
color prevColor = previousFrame[i];
// Extract the red, green, and blue components from current pixel
int currR = (int)red(currColor);//(currColor >> 16) & 0xFF; // Like red(), but faster
int currG = (int)green(currColor);//(currColor >> 8) & 0xFF;
int currB = (int)blue(currColor);//currColor & 0xFF;
// Extract red, green, and blue components from previous pixel
int prevR = (int)red(prevColor);//(prevColor >> 16) & 0xFF;
int prevG = (int)green(prevColor);//(prevColor >> 8) & 0xFF;
int prevB = (int)blue(prevColor);//prevColor & 0xFF;
// Compute the difference of the red, green, and blue values
int diffR = abs(currR - prevR);
int diffG = abs(currG - prevG);
int diffB = abs(currB - prevB);
// Add these differences to the running tally
movementSum += diffR + diffG + diffB;
// Render the difference image to the screen
pixels[i] = color(diffR, diffG, diffB);
previousFrame[i] = currColor;
}
// To prevent flicker from frames that are all black (no movement),
// only update the screen if the image has changed.
if (movementSum > 0) {
updatePixels();
println(movementSum); // Print the total amount of movement to the console
}
}
August 30, 2007 2:47 PM | Permalink | Comments (0)
import JMyron.*;
JMyron m;//a camera object
color trackColor;
void setup()
{
size(320, 240);
m = new JMyron();//make a new instance of the object
m.start(width,height);//start a capture at 320x240
m.findGlobs(0);//disable the intelligence to speed up frame rate
println("Myron " + m.version());
trackColor = color(255); // Start off tracking for white
noFill();
strokeWeight(4.0);
stroke(0);
}
void draw()
{
m.update();//update the camera view
int[] img = m.image(); //get the normal image of the camera
loadPixels();
arraycopy(img,pixels);
updatePixels();
float closestDiff = 500.0f;
int closestX = 0;
int closestY = 0;
for ( int x = 0; x < width; x++) {
for ( int y = 0; y < height; y++) {
int loc = x + y*width;
color currentColor = img[loc];
float r1 = red(currentColor);
float g1 = green(currentColor);
float b1 = blue(currentColor);
float r2 = red(trackColor);
float g2 = green(trackColor);
float b2 = blue(trackColor);
float d = dist(r1,g1,b1,r2,g2,b2);
if (d < closestDiff) {
closestDiff = d;
closestX = x;
closestY = y;
}
}
}
ellipse(closestX,closestY,16,16);
}
void mousePressed() {
int loc = mouseX + mouseY*width;
trackColor = pixels[loc];
}
August 21, 2007 10:04 PM | Permalink | Comments (0)
/*
a very simple example that draws the camera pixels
to the screen using the pixel[] array.
last tested to work in Processing 0090
JTNIMOY
*/
import JMyron.*;
JMyron m;//a camera object
void setup(){
size(320,240);
m = new JMyron();//make a new instance of the object
m.start(width,height);//start a capture at 320x240
m.findGlobs(0);//disable the intelligence to speed up frame rate
println("Myron " + m.version());
}
void draw(){
m.update();//update the camera view
int[] img = m.image(); //get the normal image of the camera
loadPixels();
arraycopy(img,pixels); //draw each pixel to the screen
updatePixels();
}
void mousePressed(){
m.settings();//click the window to get the settings
}
public void stop(){
m.stop();//stop the object
super.stop();
}
August 21, 2007 6:27 PM | Permalink | Comments (0)