MCPcopy Create free account
hub / github.com/alicevision/AliceVision / writeFloat3Map

Function writeFloat3Map

src/aliceVision/depthMap/depthMapUtils.cpp:108–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void writeFloat3Map(int rc,
109 const mvsUtils::MultiViewParams& mp,
110 const mvsUtils::TileParams& tileParams,
111 const ROI& roi,
112 const CudaDeviceMemoryPitched<float3, 2>& in_map_dmp,
113 const mvsUtils::EFileType fileType,
114 int scale,
115 int step,
116 const std::string& name)
117{
118 const ROI downscaledROI = downscaleROI(roi, scale * step);
119 const int width = int(downscaledROI.width());
120 const int height = int(downscaledROI.height());
121
122 // copy map from device pitched memory to host memory
123 CudaHostMemoryHeap<float3, 2> map_hmh(in_map_dmp.getSize());
124 map_hmh.copyFrom(in_map_dmp);
125
126 // copy map from host memory to an Image
127 image::Image<image::RGBfColor> map(width, height, true, {0.f, 0.f, 0.f});
128
129 for (size_t x = 0; x < size_t(width); ++x)
130 {
131 for (size_t y = 0; y < size_t(height); ++y)
132 {
133 const float3& rgba_hmh = map_hmh(x, y);
134 image::RGBfColor& rgb = map(int(y), int(x));
135 rgb.r() = rgba_hmh.x;
136 rgb.g() = rgba_hmh.y;
137 rgb.b() = rgba_hmh.z;
138 }
139 }
140
141 // write map from the image buffer
142 mvsUtils::writeMap(rc, mp, fileType, tileParams, roi, map, scale, step, (name.empty()) ? "" : "_" + name);
143}
144
145void writeDeviceImage(const CudaDeviceMemoryPitched<CudaRGBA, 2>& in_img_dmp, const std::string& path)
146{

Callers 2

writeNormalMapFunction · 0.70
writeNormalMapFilteredFunction · 0.70

Calls 9

downscaleROIFunction · 0.85
gMethod · 0.80
bMethod · 0.80
writeMapFunction · 0.50
widthMethod · 0.45
heightMethod · 0.45
getSizeMethod · 0.45
copyFromMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected