nikolaseu / neuvision

Structured Light based 3D scanner
GNU General Public License v3.0
287 stars 81 forks source link

Scan function problem #43

Open omarcin96 opened 5 years ago

omarcin96 commented 5 years ago

Hello, I have three problems:

First problem and second problem isn't critical, because MultiCameraCalibration save calibration in tmp directory. I try resolved third problem. I think problem is in this section:

` Z3D::ZPointCloudPtr ZStereoSystemImpl::triangulate(const cv::Mat &leftColorImage, const cv::Mat &leftDecodedImage, const cv::Mat &rightDecodedImage) { //! TODO compute this once and keep in memory? cv::Mat rmap[2][2]; for (size_t k = 0; k < 2; k++) { cv::initUndistortRectifyMap(m_calibration->cameraMatrix[k], m_calibration->distCoeffs[k], m_R[k], m_P[k], m_imageSize, CV_16SC2, rmap[k][0], rmap[k][1]); }

cv::Mat leftColorRemapedImage;
cv::remap(leftColorImage, leftColorRemapedImage, rmap[0][0], rmap[0][1], cv::INTER_LINEAR);
cv::Mat leftRemapedImage;
cv::remap(leftDecodedImage, leftRemapedImage, rmap[0][0], rmap[0][1], cv::INTER_LINEAR);

cv::Mat rightRemapedImage;
cv::remap(rightDecodedImage, rightRemapedImage, rmap[1][0], rmap[1][1], cv::INTER_LINEAR);

qDebug("%i %i %i", leftColorImage.type(), leftDecodedImage.type(), rightDecodedImage.type());

switch (leftRemapedImage.type()) {
case CV_32F: // float
    return process<float>(leftColorRemapedImage, m_Q, leftRemapedImage, rightRemapedImage);
default:
    qWarning() << "unkwnown image type:" << leftRemapedImage.type();
}

return nullptr;

} `

Because, leftColorRemapedImage has invalid format type. It should be CV_32F and it is CV_8U. So, process function isn't call.

My Hardware:

nikolaseu commented 5 years ago

Hi, yes, some things are not finished and it's certainly possible that there are also some bugs.

About the data type and the code not handling CV_8U: I will try to test/fix it tomorrow with the binary patterns, because yes, it seems it only handles float (used for other non-open-source plugins that are better than binary). Or maybe you already tried/fixed it? PRs welcome ;)

nikolaseu commented 5 years ago

Hi, you can try the branch chore-bugfixes, it should fix the scanning with binary patterns

omarcin96 commented 5 years ago

Ok, thank you