mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-03 10:00:23 +08:00
util3d::mergeTextures() added interface with single calibrations for convenience
This commit is contained in:
@@ -194,6 +194,24 @@ pcl::PolygonMesh::Ptr RTABMAP_EXP assemblePolygonMesh(
|
|||||||
* Merge all textures in the mesh into "textureCount" textures of size "textureSize".
|
* Merge all textures in the mesh into "textureCount" textures of size "textureSize".
|
||||||
* @return merged textures corresponding to new materials set in TextureMesh (height=textureSize, width=textureSize*materials)
|
* @return merged textures corresponding to new materials set in TextureMesh (height=textureSize, width=textureSize*materials)
|
||||||
*/
|
*/
|
||||||
|
cv::Mat RTABMAP_EXP mergeTextures(
|
||||||
|
pcl::TextureMesh & mesh,
|
||||||
|
const std::map<int, cv::Mat> & images, // raw or compressed, can be empty if memory or dbDriver should be used
|
||||||
|
const std::map<int, CameraModel> & calibrations, // Should match images
|
||||||
|
const Memory * memory = 0, // Should be set if images are not set
|
||||||
|
const DBDriver * dbDriver = 0, // Should be set if images and memory are not set
|
||||||
|
int textureSize = 4096,
|
||||||
|
int textureCount = 1,
|
||||||
|
const std::vector<std::map<int, pcl::PointXY> > & vertexToPixels = std::vector<std::map<int, pcl::PointXY> >(), // needed for parameters below
|
||||||
|
bool gainCompensation = true,
|
||||||
|
float gainBeta = 10.0f,
|
||||||
|
bool gainRGB = true, //Do gain compensation on each channel
|
||||||
|
bool blending = true,
|
||||||
|
int blendingDecimation = 0, //0=auto depending on projected polygon size and texture size
|
||||||
|
int brightnessContrastRatioLow = 0, //0=disabled, values between 0 and 100
|
||||||
|
int brightnessContrastRatioHigh = 0, //0=disabled, values between 0 and 100
|
||||||
|
bool exposureFusion = false, //Exposure fusion can be used only with OpenCV3
|
||||||
|
const ProgressState * state = 0);
|
||||||
cv::Mat RTABMAP_EXP mergeTextures(
|
cv::Mat RTABMAP_EXP mergeTextures(
|
||||||
pcl::TextureMesh & mesh,
|
pcl::TextureMesh & mesh,
|
||||||
const std::map<int, cv::Mat> & images, // raw or compressed, can be empty if memory or dbDriver should be used
|
const std::map<int, cv::Mat> & images, // raw or compressed, can be empty if memory or dbDriver should be used
|
||||||
|
|||||||
@@ -640,10 +640,10 @@ pcl::texture_mapping::CameraVector createTextureCameras(
|
|||||||
cam.depth = cv::Mat(depthIter->second, cv::Range(0, depthIter->second.rows), cv::Range(subWidth*i, subWidth*(i+1)));
|
cam.depth = cv::Mat(depthIter->second, cv::Range(0, depthIter->second.rows), cv::Range(subWidth*i, subWidth*(i+1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
UWARN("%f", cam.focal_length);
|
UDEBUG("%f", cam.focal_length);
|
||||||
UWARN("%f", cam.height);
|
UDEBUG("%f", cam.height);
|
||||||
UWARN("%f", cam.width);
|
UDEBUG("%f", cam.width);
|
||||||
UWARN("cam.pose=%s", t.prettyPrint().c_str());
|
UDEBUG("cam.pose=%s", t.prettyPrint().c_str());
|
||||||
|
|
||||||
cameras.push_back(cam);
|
cameras.push_back(cam);
|
||||||
}
|
}
|
||||||
@@ -1362,6 +1362,50 @@ double sqr(uchar v)
|
|||||||
return double(v)*double(v);
|
return double(v)*double(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cv::Mat mergeTextures(
|
||||||
|
pcl::TextureMesh & mesh,
|
||||||
|
const std::map<int, cv::Mat> & images,
|
||||||
|
const std::map<int, CameraModel> & calibrations,
|
||||||
|
const Memory * memory,
|
||||||
|
const DBDriver * dbDriver,
|
||||||
|
int textureSize,
|
||||||
|
int textureCount,
|
||||||
|
const std::vector<std::map<int, pcl::PointXY> > & vertexToPixels,
|
||||||
|
bool gainCompensation,
|
||||||
|
float gainBeta,
|
||||||
|
bool gainRGB,
|
||||||
|
bool blending,
|
||||||
|
int blendingDecimation,
|
||||||
|
int brightnessContrastRatioLow,
|
||||||
|
int brightnessContrastRatioHigh,
|
||||||
|
bool exposureFusion,
|
||||||
|
const ProgressState * state)
|
||||||
|
{
|
||||||
|
std::map<int, std::vector<CameraModel> > calibVectors;
|
||||||
|
for(std::map<int, CameraModel>::const_iterator iter=calibrations.begin(); iter!=calibrations.end(); ++iter)
|
||||||
|
{
|
||||||
|
std::vector<CameraModel> m;
|
||||||
|
m.push_back(iter->second);
|
||||||
|
calibVectors.insert(std::make_pair(iter->first, m));
|
||||||
|
}
|
||||||
|
return mergeTextures(mesh,
|
||||||
|
images,
|
||||||
|
calibVectors,
|
||||||
|
memory,
|
||||||
|
dbDriver,
|
||||||
|
textureSize,
|
||||||
|
textureCount,
|
||||||
|
vertexToPixels,
|
||||||
|
gainCompensation,
|
||||||
|
gainBeta,
|
||||||
|
gainRGB,
|
||||||
|
blending,
|
||||||
|
blendingDecimation,
|
||||||
|
brightnessContrastRatioLow,
|
||||||
|
brightnessContrastRatioHigh,
|
||||||
|
exposureFusion,
|
||||||
|
state);
|
||||||
|
}
|
||||||
cv::Mat mergeTextures(
|
cv::Mat mergeTextures(
|
||||||
pcl::TextureMesh & mesh,
|
pcl::TextureMesh & mesh,
|
||||||
const std::map<int, cv::Mat> & images,
|
const std::map<int, cv::Mat> & images,
|
||||||
|
|||||||
Reference in New Issue
Block a user