MCPcopy Create free account
hub / github.com/PDAL/PDAL / createZInet

Method createZInet

filters/SMRFilter.cpp:523–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

521}
522
523std::vector<double> SMRFilter::createZInet(std::vector<double> const& ZImin,
524 std::vector<int> const& isNetCell)
525{
526 // "To accommodate the removal of [very large buildings on highly
527 // differentiated terrain], we implemented a feature in the published SMRF
528 // algorithm which is helpful in removing such features. We accomplish this
529 // by introducing into the initial minimum surface a "net" of minimum values
530 // at a spacing equal to the maximum window diameter, where these minimum
531 // values are found by applying a morphological open operation with a disk
532 // shaped structuring element of radius (2*wkmax)."
533 std::vector<double> ZInetV = ZImin;
534 if (m_args->m_cut > 0.0)
535 {
536 std::vector<double> dilated = ZImin;
537 int v = ceil<int>(m_args->m_cut / m_args->m_cell);
538 math::erodeDiamond(dilated, m_rows, m_cols, 2 * v);
539 math::dilateDiamond(dilated, m_rows, m_cols, 2 * v);
540 for (auto c = 0; c < m_cols; ++c)
541 {
542 for (auto r = 0; r < m_rows; ++r)
543 {
544 if (isNetCell[c * m_rows + r] == 1)
545 {
546 ZInetV[c * m_rows + r] = dilated[c * m_rows + r];
547 }
548 }
549 }
550 }
551
552 if (!m_args->m_dir.empty())
553 {
554 std::string fname =
555 FileUtils::toAbsolutePath("zinet.tif", m_args->m_dir);
556 MatrixXd ZInet = Map<MatrixXd>(ZInetV.data(), m_rows, m_cols);
557 math::writeMatrix(ZInet, fname, "GTiff", m_args->m_cell, m_bounds, m_srs);
558 }
559
560 return ZInetV;
561}
562
563std::vector<double> SMRFilter::createZIpro(PointViewPtr view,
564 std::vector<double> const& ZImin,

Callers

nothing calls this directly

Calls 6

erodeDiamondFunction · 0.85
dilateDiamondFunction · 0.85
toAbsolutePathFunction · 0.85
writeMatrixFunction · 0.85
emptyMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected