I merged the 2_user_synchronous.cpp into my own project, I modified the input and processing part of the it (just cout the keypoint coordinates) and use it to get the pose keypoints of every color frame (format cv::Mat) produced by Kinect.
But every time I run my project, an exeption window jumps out, saying something like bad things happened at memory address xxx, with an arrow pointing at line 124:
floatImage[floatImageOffsetY + x] = float(originFramePtr[(originFramePtrOffsetY + x) * channels + c]); in function uCharCvMatToFloatPtr() in openCV.hpp.
The exception comes from opWrapper.exec() and I followed it to see who calls the uCharCvMatToFloatPtr() function. I found it has something to do with thread.hpp?
Does anyone know what should I do? Or is there any other way or some hint to use the wrapper in my
own project?
Operating system : win8.1, vs2015
CUDA version : 8
cuDNN version: 5.1
GPU model (nvidia-smi): Geforce GTX 1050Ti
Caffe version: Default from OpenPose.
OpenCV version: OpenCV3.1.
Is it working fine in the OpenPoseDemo.exe? If so, it is definitively some problem with the integration or your project itself (I just wanna know where the error is coming from to isolate possible causes).
The error is from uCharCvMatToFloatPtr(): Can you check the input image has the expect size? (e.g. it's not empty, the cols and rows are the expected, it is a continuous-on-memory cv::Mat?)
Now I find that when I read an image as parameter like openPoseTutorialWrapper2(cv::Mat inputImage) I get the mentioned error; but when I firstly save the same image to local and then read it from its path, it works fine, which seems that the size is correct? I don't know what's the difference between read and first-write-then-read, they are the same image right?
OK I know where the error comes from. the input image has to be a 3 channel Mat. I convert the original 4 channel image to 3 channel one, then everything goes right. And note that the cv::convertTo() function doesn't work, cv::cvtColor() works. Thank you anyway!!! @gineshidalgo99
@WilliamRuRu15 Thank you for the feed-back. I've just added a new exception with the proper message if images with other than 3 channels (BGR) are used, so at least people can find easily this error.
Just to be sure you are doing it properly, OpenCV uses BGR, so we are using BGR format (not RBG). Accuracy would decrease a little bit if you use RGB instead.
Best