I'm working on writing a Windows emotion sensitive game in Unity3D using the affdex SDK by Affectiva. The CameraDetector finds a face consistently. When I use the FrameDetector a face is rarely found. Intense lighting seems to help, but even when a face is found it seems to be detecting a smile when I frown. I'm getting the pixels from WebCamTexture.GetPixels32. The pixels are ordered Left to right and Bottom to top (just like Windows BitMaps).
public void ProcessFrame(Frame frame)
{
if (!_initialized)
{
Initialize(false);
}
byte[] bytes = new byte[frame.rgba.Length * 3];
for(int i = 0, idx=0; i < frame.rgba.Length; i++, idx+=3)
{
bytes[idx] = frame.rgba[i].b;
bytes[idx+1] = frame.rgba[i].g;
bytes[idx+2] = frame.rgba[i].r;
}
nativePlatform.ProcessFrame(bytes, frame.w, frame.h, frame.timestamp);
}
I read through the Affectiva documentation, but couldn't find anything about pixel order.