OpenNI的安装问题

问题描述:Kinect买了好久了,今天终于空下来,有机会来研究下。按照教程安装OpenNI、Sensor、NITE后,然后启动as3-server,报openNI.dll丢失的错误。

问题分析:查看C:\Program Files\OpenNI\bin64;C:\Program Files (x86)\OpenNI\Bin目录,有openNI.dll文件。

问题解决:系统环境变量从
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files (x86)\ICBCEbankTools\Gemplus\GemSafe Libraries\BIN\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\OpenNI\bin64;C:\Program Files (x86)\OpenNI\bin;C:\Program Files (x86)\PrimeSense\NITE\bin
改为
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files (x86)\ICBCEbankTools\Gemplus\GemSafe Libraries\BIN\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\OpenNI\bin64;C:\Program Files (x86)\OpenNI\Bin;C:\Program Files (x86)\PrimeSense\NITE\Bin
一切ok了!

条形码 for iOS

  • Kaywa Reader is one of the most impressive commercial readers. Notably, it can recognize codes in a video stream from the phone's camera. The user never needs to press a button to take a picture.
  • Libdmtx* is an open source (LGPL) library for decoding Datamatrix codes. It is designed to be highly portable, and it is written in C. It was recently made available again after a year-long break.
  • ZXing* is an open source (Apache 2.0) application recently released by Google that aims to "support decoding of QR Codes, Data Matrix, and the UPC family of 1D barcodes."
  • Open Source QR Code Library* - This is an open source decoding library from Japan.

 

Kinect hardware

Electric motor

3 sections of mainboard

Cooling fan

Two cameras

IR projector

4 microphones

Four different kinds of screws

15 chips including:

Wolfson Stereo ADC with microphone preamp

Fairchild N-Channel PowerTrench MOSFET

NEC USB 2.0 hub controller

Unidentified SAP package chip

Camera interface controller

Marvell SoC camera interface controller

Hynix 512Mb DDR2 SDRAM

Analog Devices CMOS Rail-to-Rail Output Operational Amplifier

TI 8-bit, 8-channel Sampling A/D converter

Allegro low voltage stepper and single/dual motor driver

ST 8Mbit NV flash memory

PrimeSense image sensor processor

TI USB audio controller

Kionix accelerometer

iOS录音问题

问题描述
AD的iPad版有一个鼓掌互动的应用。换了前后三套类库,如下:
SCListener:https://gist.github.com/72914
AVAudioRecorder:http://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioRecorder_ClassReference/Reference/Reference.html
SpeakHere:http://developer.apple.com/library/ios/#samplecode/SpeakHere/Introduction/Intro.html

问题分析
首先使用SCListener,发现模拟器上正常使用,但是真机不能监听声音。再使用AVAudioRecorder,发现还是有以上真机不能监听的问题。
最后使用SpeakHere,可以监听,但是有一个bug。就是:真机上,声音监听过就不能播放video,而模拟器上一切正常。

问题解决
原来录音和播放使用的是一个通道,需要手动设置当前通道的状态。而模拟器上就可以忽略这种限制。
修改通道为录音的代码如下:
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryRecord error:nil];

修改通道为播放的代码如下:
AVAudioSession *session = [AVAudioSession sharedInstance];
[session setCategory:AVAudioSessionCategoryPlayback error:nil];

播放前修改为播放,录音前修改为录音,一切OK了。

PS:后来发现只要修改对应的通道,AVAudioRecorder在真机上也可以用了。

Kinect驱动

驱动有三种:
OpenNI:Open Natural Interface,没有电驱模块。

Libfreenect:OpenKinect,由号称第一个破解Kinect的Hector Martin发起,有很多geek簇拥Mac,所以本来的目标平台是Linux和Mac,现在有Windows移植。

CLNUL:由NUI的大神AlexP (开发过PS3的Windows驱动),目标平台是Windows7,搭配OpenCV。

cocos2d多个CCSprite同时运行带CCCallFuncN的Action后会造成调用丢失

问题描述
昨天晚上通宵改Geely iPad的bug,这个bug改了8个小时。问题是程序会泄露导致崩溃。

问题分析
项目使用的是cocos2d,所以也不能使用Instruments做性能测试。一步一步发现一个CCLayer没有dealloc,于是进去一步一步查,一段段的注释和启用。最后发现有了这段代码就会出现泄露崩溃:

[vBackground stopAllActions];

[vMenu stopAllActions];

id backgroundFaceAction=[CCFadeOut actionWithDuration:0.7];

id backgroundCallAction=[CCCallFuncN actionWithTarget:self selector:@selector(removeNode:)];

id backgroundSequenceAction=[CCSequence actions:backgroundFaceAction, backgroundCallAction, nil];

id menuFaceAction=[CCFadeOut actionWithDuration:0.7];

id menuCallAction=[CCCallFuncN actionWithTarget:self selector:@selector(removeNode:)];

id menuSequenceAction=[CCSequence actions:menuFaceAction, menuCallAction, nil];

[vBackground runAction:backgroundSequenceAction];

[vMenu runAction:menuSequenceAction];

其中调用的removeNode函数如下:

-(void) removeNode:(id)vNode

{

CCNode *node=vNode;

if (node.parent!=nil)

{

[self removeChild:node cleanup:YES];

}

}

改成直接removeChild掉两个CCSprite,就不崩溃了:

[self removeNode:vBackground];

[self removeNode:vMenu];

问题解决:猜想是两个CCSprite同一时间开始的两个CCAction后同时调用removeNode函数,但是一个调到了,一个调用不到。想来这个是一个cocos2d的bug。