Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

error LNK2019: unresolved external symbol "void __cdecl cv::inpaint

Hello, I am trying to filter my depth data captured from kinect. Look at the image below. unknown values are colored with black: image description

Now I want to use the cv::inpaint function but still I have no luck. I followed this article: but I am using different kinect drivers. I am using Kinect SDK.

here are my code:

int drawDepth(HANDLE h, IplImage* depth)
const NUI_IMAGE_FRAME * pImageFrame = NULL;
HRESULT hr = NuiImageStreamGetNextFrame( h, 0, &pImageFrame );

Mat depthMat(Size(640,480), CV_16UC1);
Mat depthf(Size(640,480), CV_8UC1);

if( FAILED(hr))
cout<<"Get Image Frame Failed"<<endl;
return -1;

INuiFrameTexture * pTexture = pImageFrame->pFrameTexture;
pTexture->LockRect( 0, &LockedRect, NULL, 0 );

if( LockedRect.Pitch != 0 )
BYTE *pBuffer = (BYTE*)LockedRect.pBits;
cvSetData(depth, pBuffer, LockedRect.Pitch);
//cvShowImage("Depth Image", depth); // show normal depth maps

depthMat = depth;
depthMat.convertTo(depthf, CV_8UC1, 255.0/2048.0);

Mat _tmp, _tmp1;
Mat (depthMat-400.0).convertTo(_tmp1, CV_64FC1);

Point minLoc; double minval,maxval;
minMaxLoc(_tmp1, &minval, &maxval, NULL,NULL);
_tmp1.convertTo(depthf, CV_8UC1, 255.0/maxval);

//use a smaller version of the image
Mat small_depthf; 
resize(depthf, small_depthf, Size(), 0.2, 0.2);

//inpaint only the "unknown" pixels
cv::inpaint(small_depthf,( small_depthf == 255), _tmp1, 5.0, INPAINT_TELEA);

resize(_tmp1, _tmp, depthf.size());
_tmp.copyTo(depthf, (depthf==255));

cv::imshow("test", depthf); // show inpainted depth maps
NuiImageStreamReleaseFrame(h, pImageFrame);
return 0;