본문 바로가기

Computer195

[node.js] 스트림을 이용한 Read/Write * Readable Stream 이용var readable stream_byte= ...readable stream_byte.on('data',function(data){//data 는 byte buffer}); var readable stream_string=...readable stream_string.setEncoding('utf8');readable stream_string.on('data',function(data){//data 는 string buffer}); - stream.pause(); 및 stream.resume(); 으로 스트림에서 데이터를 받는 것을 중지하거나 재게 할 수 있다.- stream의 끝을 공지 var readable stream = ...readable stream.on.. 2013. 1. 31.
[node.js] 외부 프로세스를 생성하고 제어하기 1. child_process 모듈, exec 함수exec 함수에 다음과 같은 option 을 설정 가능하다. cwd : 현재의 작업 디렉토리 encoding : child output에 대한 encoding (기본적으로 utf8로 ascii, ucs2, base64등으로 변경 가능하다) timeout : 하위 프로세스의 실행 대기 시간(기본적으로 0, 무한 기다림) maxBuffer : output(stdout/stderr)의 버퍼(기본적으로 200*1024) killSignal : timeout 또는 output 버퍼가 다 찼을 경우에 하위 프로세스에 보낼 시그널(기본은 SIGTERM) env : 하위 프로세스에 전달할 환경 변수(기본적으로 null)예를 들어var exec=require('child.. 2013. 1. 30.
[kinect] Minority Report Photos 2 다음은 3장의 그림을 손으로 이동하거나 확대할 수 있는 예제이다. SimpleOpenNI.*;SimpleOpenNI kinect; int closestValue; int closestX; int closestY; float lastX;float lastY;float image1X;float image1Y; //이미지 크기 변환 float image1scale; int image1width = 100; int image1height = 100; float image2X; float image2Y; float image2scale; int image2width = 100; int image2height = 100; float image3X; float image3Y; float image3scale; int.. 2013. 1. 21.
[kinect] Minority Report Photos 1 다음은 Kinect센서에서 가까운 포인트를 찾아서 그림을 이동 시키는 예제이다. import SimpleOpenNI.*; SimpleOpenNI kinect; int closestValue; int closestX; int closestY; float lastX; float lastY; // 이미지의 X,Y좌표를 위한 변수 float image1X; float image1Y; // 이미지가 움직이는지 확인하는 변수 boolean imageMoving; // 프로세싱에서 이미지를 처리하기 위한 변수 PImage image1; void setup() { size(640, 480); kinect = new SimpleOpenNI(this);kinect.enableDepth();//초기에는 이미지가 움직이도록 .. 2013. 1. 21.
[kinect] Invisible Pencil import SimpleOpenNI.*;SimpleOpenNI kinect; int closestValue;int closestX;int closestY;float lastX;float lastY; void setup(){ size(640, 480); kinect = new SimpleOpenNI(this); kinect.enableDepth();}void draw(){ closestValue = 8000; kinect.update(); int[] depthValues = kinect.depthMap(); for(int y=0;y 2013. 1. 20.
[kinect] 가장 가까운 지점 구하기 import SimpleOpenNI.*;SimpleOpenNI kinect;int closestValue;int closestX;int closestY;void setup(){size(640, 480);kinect = new SimpleOpenNI(this);kinect.enableDepth();}void draw(){closestValue = 8000;kinect.update();int[] depthValues = kinect.depthMap();for(int y = 0; y < 480; y++){// look at each pixel in the rowfor(int x = 0; x < 640; x++){int i = x + y * 640; int currentDepthValue = depthValue.. 2013. 1. 15.