Hi!
I get an exception from within the core libs when using the gesture detector in combination with custom depth images.
The exception only occurs on certain combinations of confidence map values and depth values. When I set the distance far away it works (e.g. offset = 500 + some distance..) and when I exchange the confidence values it works also. Are the confidence values normalized? And what is the value for high confidence (1 or 32767)?
It seems that something is triggered within the algorithm when my hand performs a swipe action, because the exception happens reproducible more often..
I wonder also about the image options IMAGE_OPTION_NO_CONFIDENCE_MAP and IMAGE_OPTION_NO_UV_MAP. If I use the confidance map option it is still necessary to set the planes[1] pointer. So the map is used always regardless of the option parameter?
Thanks for any help on this!
This is the stack trace and code:
> CILib.dll!10064d0e()
[Frames below may be incorrect and/or missing, no symbols loaded for CILib.dll]
CILib.dll!10009762()
CILib.dll!1000136c()
libpxcgesture_ci2.dll!0f4c2d8e()
libpxcgesture_ci2.dll!0f4c3706()
libpxcgesture_ci2.dll!0f4c3cf2()
libpxccore.dll!0f93fad4()
tbb.dll!017d5369()
10064CE3 movaps xmm3,xmm0
10064CE6 mov dword ptr [esp+14h],ecx
10064CEA inc ecx
10064CEB add ebx,4
10064CEE cmp ecx,edi
10064CF0 jb 10064C70
10064CF6 mov eax,dword ptr [esp+14h]
10064CFA jmp 10064CFE
10064CFC mov eax,ecx
10064CFE mov edx,dword ptr [esp+18h]
10064D02 mov ecx,dword ptr [edx+4]
10064D05 mov eax,dword ptr [ecx+eax*4]
10064D08 mov edx,dword ptr [esi+0D0h]
10064D0E movzx edi,byte ptr [edx+eax] -> read access violation
void CMyGestureViewer::LoadImageFromDepth(PXCImage **dst_img, pxcBYTE* distData)
{
IppStatus stat;
Ipp16s max16;
int idx;
for (int i = 0; i < m_width*m_height; i++)
{
if (((unsigned short*)distData)[i] == 32767) //if it's a bad pixel
{
((unsigned short*)m_confidenceMap)[i] = 1; //set to poor? confidence
((unsigned short*)distData)[i] = 0; //zeroing invalid pixel for maximum calc
}
else
((unsigned short*)m_confidenceMap)[i] = 32767;//set to the best? value
}
stat = ippsMaxIndx_16s((Ipp16s*)distData, (m_width * m_height), &max16, &idx);
for (int i = 0; i < m_width*m_height; i++)
{
if (((unsigned short*)m_distData)[i] == 0)
((unsigned short*)m_distData)[i] = 32767; //set invalid pixels far away
else //offset of 20cm + measured depth
((unsigned short*)m_distData)[i] = 100 + (max16 - ((unsigned short*)distData)[i]);
}
PXCImage::ImageInfo info;
memset(&info, 0, sizeof(info));
info.height = m_height;
info.width = m_width;
info.format = PXCImage::COLOR_FORMAT_DEPTH;
PXCImage::ImageData data;
memset(&data, 0, sizeof(data));
data.format = PXCImage::COLOR_FORMAT_DEPTH;
data.planes[0] = (pxcBYTE*)m_distData;
data.planes[1] = (pxcBYTE*)m_confidenceMap;
data.planes[2] = 0; //no uv map
data.pitches[0] = m_width*2; // bytes between image lines
pxcStatus sts = m_accelerator->CreateImage(&info, PXCImage::IMAGE_OPTION_NO_CONFIDENCE_MAP | PXCImage::IMAGE_OPTION_NO_UV_MAP, &data, dst_img);
}
BOOL CMyGestureViewer::ProcessFrame(BYTE *pData, unsigned short* distData, long lDataLen)
{
PXCSmartSPArray sps(1);
pxcStatus sts;
PXCImage* imageDepth;
LoadImageFromDepth(&imageDepth, (pxcBYTE*)distData);
sts=m_gestureDetector->ProcessImageAsync(&imageDepth,&sps[0]);
if (sts<PXC_STATUS_NO_ERROR && sts!=PXC_STATUS_EXEC_ABORTED) return FALSE;
sps.SynchronizeEx();
m_colorRender->RenderFrame(imageDepth, m_gestureDetector, &g_gdata, 0);
g_nframes++;
delete imageDepth;
return TRUE;
}



