| 173 | } |
| 174 | |
| 175 | sibr::ImageRGB::Ptr MeshTexturing::getTexture(uint options) const { |
| 176 | |
| 177 | ImageRGB32F output; |
| 178 | if (options & Options::FLOOD_FILL) { |
| 179 | output = floodFill(_accum, _mask)->clone(); |
| 180 | } |
| 181 | else if (options & Options::POISSON_FILL) { |
| 182 | output = poissonFill(_accum, _mask)->clone(); |
| 183 | } |
| 184 | else { |
| 185 | output = _accum.clone(); |
| 186 | } |
| 187 | |
| 188 | // Convert as-is to uchar. |
| 189 | ImageRGB::Ptr result(new ImageRGB()); |
| 190 | const cv::Mat3f outputF = output.toOpenCV(); |
| 191 | const cv::Mat3b outputB = cv::Mat3b(outputF); |
| 192 | result->fromOpenCV(outputB); |
| 193 | |
| 194 | /// \todo For extra large images, this might crash because of internal openCV indexing limitations. |
| 195 | if (options & Options::FLIP_VERTICAL) { |
| 196 | result->flipH(); |
| 197 | } |
| 198 | |
| 199 | return result; |
| 200 | } |
| 201 | |
| 202 | sibr::ImageRGB32F::Ptr MeshTexturing::poissonFill(const sibr::ImageRGB32F & image, const sibr::ImageL8 & mask) { |
| 203 | SIBR_LOG << "[Texturing] Poisson filling..." << std::endl; |
no test coverage detected