bubucar
1
Hi, i would like to ask if there any example can show how to map the unwrapped image with calibration parameter to show its height/reconstruct to 3d?
unwrap example is from sinusoidal pattern here
https://docs.opencv.org/3.4/d0/de8/tutorial_capture_sinusoidal_pattern.html
berak
2
you could write a .ply
file from the unwrapped image (make a pointcloud) and throw that at blender / meshlab.
void ply2(const Mat &m, const Mat &col) {
cout << m.size << " " << m.type() << " " << m.channels() << endl;
string ply_header = format("ply\nformat ascii 1.0\nelement vertex %d\nproperty float x\nproperty float y\nproperty float z\nproperty uchar red\nproperty uchar green\nproperty uchar blue\nend_header", m.total());
ofstream of("sinus2.ply");
of << ply_header << endl;
for (int r=0; r<m.rows; r++) {
for (int c=0; c<m.cols; c++) {
Vec3b pix = col.at<Vec3b>(r,c);
of << format("%5.4f %5.4f %5.4f %d %d %d\n", float(c),float(r),m.at<float>(r,c), pix[0], pix[1], pix[2]);
}
}
of.close();
}
// load this seperately, so we can use color info
Mat color = imread("phase1.png");
Mat depthMap;
unwrappedPhaseMap.convertTo(depthMap, CV_32F, 1.0/16); // scaling magic, adjust to your needs
ply2(depthMap, color);
2 Likes
bubucar
3
Thank you so much for the reply!!I appreciated
May i know why after the scaling magic the unwrapped phase map will convert to depth map??
berak
4
the magic is only in the naming
bubucar
5
may i know why after the scaling it will become depth map??
it sounds like disparity map but as i know unwrapped image is not disparity map, or are they somehow same??
berak
6
depth ~ 1 / disparity
(also, disparity usually comes from block-matching)
but yes, closely related
bubucar
7
ahh which mean unwrapped phase image = disparity map??
Thank you so much for the replies!