0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

M1MAC環境でProcessingでAR導入メモ

Last updated at Posted at 2022-05-13

はじめに

 この記事は、ProcessingのP3Dモードで表示されない問題に、
frameRate(30);
を追加することで、解決するというメモです。ARToolKitを使う際にハマりました。

環境

M1 Mac
OS 12.2.1
Processing 3.5.3
Video Library 2.0(ライブラリマネージャからインストール)
nyar4psg 3.0.7(ライブラリマネージャからインストール)

Processing.orgからProcessing 3.5.3のリンクが消えましたが、下記URLから辿ることが出来ます。
Windows32bit版
Windows64bit版
Mac版

コード

サンプルのsimpleLiteをいじりました。
camera_para.datとpatt.hiroはARTOOLKIT導入の際に入りますが、自分のフォルダにコピーしています。

AR100.pde
import processing.video.*;
import jp.nyatla.nyar4psg.*;

Capture cam;
MultiMarker ar;

void setup() {
  size(640, 480, P3D);
  frameRate(30);//これで解決!
  cam = new Capture(this, 640, 480);
  ar = new MultiMarker(this, width, height, "camera_para.dat", NyAR4PsgConfig.CONFIG_PSG);
  ar.addARMarker("patt.hiro", 80);
  cam.start();
}

void draw(){
  if (!cam.available()) {
    return;
  }
  cam.read();
  ar.detect(cam);
  background(0);
  ar.drawBackground(cam);//frustumを考慮した背景描画
  if ((!ar.isExist(0))) {
    return;
  }
  ar.beginTransform(0);
  fill(0, 0, 255);
  translate(0, 0, 20);
  box(40);
  ar.endTransform();
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?