| 106 | } |
| 107 | |
| 108 | void 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 | |
| 145 | void writeDeviceImage(const CudaDeviceMemoryPitched<CudaRGBA, 2>& in_img_dmp, const std::string& path) |
| 146 | { |