Mac OS LionでのOpenCV 2.3.1 のサンプル実行
ひさびさに書いてみる。半年以上ぶり。
問題
OpenCVのサンプル実行までの手順をどうするか
解決
とりあえずできたのでメモ。
$ cd /OpenCV-2.3.1/sample $ g++ imagelist_creator.cpp -o imagelist_creator `pkg-config --libs --cflags opencv` $ ./imagelist_creator imagelist.yaml left01.jpg left02.jpg left03.jpg $ g++ calibration.cpp -o calibration `pkg-config --libs --cflags opencv` $ ./calibration -w 9 -h 6 -s 0.025 -o camera.yml -op -oe imagelist.yaml
openFrameworks
macでopenFrameworks動いた!
Lionで動かなくて多少手こずる。
何だかアートな感じ(^^
NyAR4psgを試す
Processing + NyARToolkit という組合せもあるとのことで試す。
一通りサンプルを動かしてみた。
- 非常に簡単
- 短いコードでできる
- グラフィックが派手
- OpenGLを使って色々できる
- 3Dモデルを用意する手間を省ける
とりあえずアイディアを試すには最高の組合せでは。
Processing良いな〜
ウニを浮かせてみる。
タスクリスト
・設計
・アプリモデルのバリエーションを考える
・調査
・競合の価格・表現力を調べる
・開発
・モジュールを整理する
・jar化する
OpenCVをVC++2008で実行時エラー
問題
error LNK2019: 未解決の外部シンボル _cvReleaseImage が関数 _main で参照されました。
解決
「プロジェクト」→「○×△のプロパティ」→「構成プロパティ」→「リンカ」→「入力」→「追加の依存ファイル」に
cv210.lib cxcore210.lib highgui210.lib
を書く
Project Eueler: problem22
問題
Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the list to obtain a name score.
For example, when the list is sorted into alphabetical order, COLIN, which is worth 3 + 15 + 12 + 9 + 14 = 53, is the 938th name in the list. So, COLIN would obtain a score of 938 53 = 49714.
What is the total of all the name scores in the file?
回答
abcstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" names = [] File.open("names.txt", "r") do |file| lines = file.read names = lines.split(/,/).map{|x| x.gsub("\"","")} end names.sort! total = 0 names.each_with_index do |x,i| words = x.split(//) ws = 0 words.each do |x| ws += abcstr.index(x) + 1 end total += ws * (i+1) end p total