Ask Your Question

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

asked 2013-07-07 10:08:10 -0600

kpcamota gravatar image

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;
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-07 11:07:17 -0600

unxnut gravatar image

This simply means that your code is unable to find the opencv library that contains the function inpaint. You will need to provide the location of library to visual studio. Check the linker settings in project properties.

edit flag offensive delete link more


I think linker settings was correct since I already used opencv functions like resize etc... so which file does the inpaint method belongs?

kpcamota gravatar imagekpcamota ( 2013-07-07 20:41:43 -0600 )edit

it works. I added the opencv_photo245d.lib :D

kpcamota gravatar imagekpcamota ( 2013-07-07 22:05:13 -0600 )edit

Question Tools


Asked: 2013-07-07 10:08:10 -0600

Seen: 4,468 times

Last updated: Jul 07 '13