顯示具有 [其它互動技術] 標籤的文章。 顯示所有文章
顯示具有 [其它互動技術] 標籤的文章。 顯示所有文章

2013年9月13日 星期五

Processing連接Camera

http://processing.org/learning/libraries/gettingstartedcapture.html

以下為官網的程式

import processing.video.*;

Capture cam;

void setup() {
  size(640, 480);

  // If no device is specified, will just use the default.
  cam = new Capture(this, 320, 240);

  // To use another device (i.e. if the default device causes an error),
  // list all available capture devices to the console to find your camera.
  //String[] devices = Capture.list();
  //println(devices);
 
  // Change devices[0] to the proper index for your camera.
  //cam = new Capture(this, width, height, devices[0]);

  // Opens the settings page for this capture device.
  //camera.settings();
}


void draw() {
  if (cam.available() == true) {
    cam.read();
    image(cam, 160, 100);
    // The following does the same, and is faster when just drawing the image
    // without any additional resizing, transformations, or tint.
    //set(160, 100, cam);
  }
}



=============

看起來好像可以接連到camera

但後來發現會出現VDIG的error

於是到 http://www.eden.net.nz/7/20071008/  下載VDIG來安裝

安裝前有先裝完了quicktime 因為好像需要

下載1.0.5版的好像不能使用@~@

後來抓了1.0.1版本後 就正常可以連接上camera了

OpenCV與Dev C++的安裝

1. 在工具->編譯器選項->編譯器->在連結器命令列中加入以下命令 -lhighgui -lcv -lcxcore -lcvaux -lcvcam 2. 工具->編譯器選項->目錄->函式庫加入OpenCV的lib資料夾路 C:\Program Files\OpenCV\lib 3. 工具->編譯器選項->目錄->C引入檔(include) C:\Program Files\OpenCV\cxcore\include C:\Program Files\OpenCV\cv\include C:\Program Files\OpenCV\otherlibs\highgui C:\Program Files\OpenCV\cvaux\include C:\Program Files\OpenCV\otherlibs\cvcam\include 4. 工具->編譯器選項->目錄->C++引入檔(include) C:\Program Files\OpenCV\cxcore\include C:\Program Files\OpenCV\cv\include C:\Program Files\OpenCV\otherlibs\highgui C:\Program Files\OpenCV\cvaux\include C:\Program Files\OpenCV\otherlibs\cvcam\include VISTA 工具 -> 編譯器選項 -> 目錄 -> 二進位檔 加入 C:\Dev-Cpp\libexec\gcc\mingw32\3.4.2 工具 -> 編譯器選項 -> 目錄 -> 外部程式 每一個程式名稱前面加入這個C:\Dev-Cpp\bin\

Arduino連接Flash

首先我們要先把程式燒進Arduino裡頭

而網路找的程式有部份要修改

原本的程式compile會卡在printByte這裡 把這都改成Serial.print就可以compile過燒進arduino裡頭

所以正常的pde程式為
==============================================
int activeLED ;
int switchState = 0;
int lastSwitchState = 0;
int switchPin = 13;
void setup()
{
  Serial.begin(19200);
  pinMode(switchPin, INPUT);
  for (int i = 2; i <= 9; i++) {
    pinMode(i, OUTPUT);
  }
}
void loop ()
{
  switchState = digitalRead(switchPin);
  if (switchState != lastSwitchState) {
    if (switchState == 1){
  sendStringToFlash("switchOn");
    } else if (switchState == 0){
  sendStringToFlash("switchOff");
    }
  }
  lastSwitchState = switchState;
  if(Serial.available() > 0) {
    activeLED = Serial.read();
  }   
  if(activeLED >= 50 && activeLED <= 57) {
    int outputPort = activeLED - 48;
    Serial.print("LED port ");
    Serial.println(outputPort);
    if(outputPort >= 2 && outputPort <= 9) {
  for (int i = 2; i <= 10; i++) {
    digitalWrite(i,LOW);
  }
  digitalWrite(outputPort, HIGH);
    }
    activeLED = 0;
  } else if (activeLED) {
    Serial.print("Invalid LED port ");
    Serial.println(activeLED,BYTE);
  }
  delay(50);
}
void sendStringToFlash (char *s)
{
  while (*s) {
    Serial.print(*s ++);
  }
  Serial.print(0);
}

===============================================

再來要開啟serproxy的程式

連接flash中 這個程式都要一直開啟

有正常就會出現wait client..

接下來連接成功arduino後

要記得看你的COM是多少

在控制台連接埠可以看

我們是COM3的話Flash裡頭的程式var port:Number = 5333;後面就為5333

記得import的.as檔也要修改成5333

再接好你的arduino的LED後

發佈Flash  就可以由Flash來控制你的LED亮燈在哪幾顆 // comment http://code.google.com/p/as3glue/downloads/list 可以改用as3glue 比較沒問題

AS3漸進公式

漸進公式 移動值=(目標值-現在值)/漸進係數; 現在值=現在值+移動量; → 現在值=現在值+(目標值-現在值)/漸進係數 →現在值+=(目標值-現在值)/漸進係數

2010年10月8日 星期五

laser marker 找不到javax.vecmath library問題(May 23, 2010 )

感謝有人在背後為我打氣

讓我有動力去解決一些問題:)

如果去找雷射塗鴉的processing程式 ( http://blog.graffitiresearchlab.at/ )

會發現抓下來的programe會無法compile

會出現 javax.vecmath library missing的問題

這個原因就是少了java 3d的library

先到sun抓java3d

抓完安裝後 會發現還是無法compile

我用windows平台

我們到C:\Program Files\Java\Java3D\1.4.0_01\lib\ext 裡頭 將.jar 檔copy起來

再到processing的程式

processing-1.0.7\libraries\vecmath\library

如果你的libraries裡沒有vecmath的資料夾 就自己建一個

把剛才copy的 .jar檔通通丟到library裡

再將processing重新開

就可以順利run laser marker的program 囉:)

good lucky

OpenCV與Dev C++的安裝(October 3, 2009 )

1. 在工具->編譯器選項->編譯器->在連結器命令列中加入以下命令
-lhighgui -lcv -lcxcore -lcvaux -lcvcam
2. 工具->編譯器選項->目錄->函式庫加入OpenCV的lib資料夾路
C:\Program Files\OpenCV\lib
3. 工具->編譯器選項->目錄->C引入檔(include)
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\otherlibs\cvcam\include
4. 工具->編譯器選項->目錄->C++引入檔(include)
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\otherlibs\cvcam\include


VISTA

工具 -> 編譯器選項 -> 目錄 -> 二進位檔 加入 C:\Dev-Cpp\libexec\gcc\mingw32\3.4.2

工具 -> 編譯器選項 -> 目錄 -> 外部程式 每一個程式名稱前面加入這個C:\Dev-Cpp\bin\