void OnRenderObject() { int rectX = (int)foregroundImgRect.xMin; //int rectY = (int)foregroundImgRect.yMax; int rectY = (int)foregroundImgRect.yMin; float scaleX = foregroundImgRect.width / depthImageWidth; float scaleY = foregroundImgRect.height / depthImageHeight; // draw grid //DrawGrid(); // display blob rectangles int bi = 0; foreach (var b in blobs) { float x = (depthScale.x >= 0f ? b.minx : depthImageWidth - b.maxx) * scaleX; // b.minx * scaleX; float y = (depthScale.y >= 0f ? b.miny : depthImageHeight - b.maxy) * scaleY; // b.maxy * scaleY; Rect rectBlob = new Rect(rectX + x, rectY + y, (b.maxx - b.minx) * scaleX, (b.maxy - b.miny) * scaleY); KinectInterop.DrawRect(rectBlob, 2, Color.white); Vector3 blobCenter = b.GetBlobCenter(); x = (depthScale.x >= 0f ? blobCenter.x : depthImageWidth - blobCenter.x) * scaleX; // blobCenter.x * scaleX; y = (depthScale.y >= 0f ? blobCenter.y : depthImageHeight - blobCenter.y) * scaleY; // blobCenter.y* scaleY; // Vector3 blobPos = new Vector3(rectX + x, rectY + y, 0); KinectInterop.DrawPoint(blobPos, 3, Color.green); bi++; } }