36 using Pointer = std::shared_ptr<OpticalFlowSegmentation>;
45 template <
typename... Args>
48 return std::make_shared<OpticalFlowSegmentation>(
49 std::forward<Args>(args)...);
164 -> std::vector<Voxel>;
175 int interpStart,
int interpEnd,
int startChain,
int startResegChain)
176 -> std::vector<std::vector<Voxel>>;
195 std::
size_t& iteration,
197 const filesystem::path& debugDir)
198 -> std::tuple<std::vector<std::vector<Voxel>>,
Status>;
Base class for segmentation algorithms that propagate a collected chain of points.
std::vector< cv::Vec3d > Chain
std::shared_ptr< ChainSegmentationAlgorithm > Pointer
Fits a curve to a set of points for resampling.
Optical Flow Segmentation.
std::uint32_t opticalFlowDisplacementThreshold_
void setOFDispThreshold(std::uint32_t ofDispThrs)
Set the maximum single pixel optical flow displacement before interpolating a pixel region.
void setTargetZIndex(int z)
Set the target z-index.
void setMaterialThickness(double m)
Set the estimated thickness of the substrate (in um)
auto run_ofs_(Chain currentVs, int startChainIndex, int anchorEndIdx, int targetIndex, int stepAdjustment, std::size_t &iteration, bool backwards, const filesystem::path &debugDir) -> std::tuple< std::vector< std::vector< Voxel > >, Status >
Run the optical flow segmentation in one direction.
auto getInterpolationWindow() const -> std::uint32_t
Get how wide the interpolation window should be.
void setEdgeJumpDistance(std::uint32_t distance)
Set the minimum jump distance for edge detection.
double materialThickness_
OpticalFlowSegmentation()=default
Default constructor.
auto interpolate_(int interpStart, int interpEnd, int startChain, int startResegChain) -> std::vector< std::vector< Voxel > >
Blend the re-segmentation run into the forward run over an interpolation window.
auto compute() -> PointSet override
Compute the segmentation.
void setEdgeBounceDistance(std::uint32_t distance)
Set the maximum bounce distance for edge detection.
std::uint32_t edgeJumpDistance_
void resetMaxThreads()
Clear the maximum number of threads.
void setReSegmentationChain(Chain c)
Set the input chain of re-segmentation points.
static auto New(Args... args) -> Pointer
auto compute_curve_(const FittedCurve ¤tCurve, int zIndex) const -> std::vector< Voxel >
Compute the curve for z + 1 given a curve on z using the optical flow between the two slices.
void setMaxThreads(std::uint32_t t)
Set the maximum number of threads.
void setEnableEdgeDetection(bool enable)
Set whether to enable edge detection.
void setEnableSmoothOutliers(bool enable)
Set whether to enable outlier points smoothening.
std::uint32_t edgeBounceDistance_
auto getStartZIndex() const -> int
Get the start z-index.
bool enableSmoothenOutlier_
void setStartZIndex(int z)
Set the start z-index.
void setOutsideThreshold(std::uint8_t outside)
Set the threshold of what pixel brightness is considered inside a sheet (higher as threshold) and out...
void setVisualize(bool b)
void setSmoothBrightnessThreshold(std::uint8_t brightness)
Set the threshold for what pixel brightness is considered as being outside the sheet....
void setMasterCloud(PointSet masterCloud)
Set the already computed masterCloud OrderedPointSet.
std::uint32_t interpWindow_
std::uint8_t smoothByBrightness_
std::uint8_t opticalFlowPixelThreshold_
void setOFThreshold(std::uint8_t ofThr)
Set the threshold of what pixel brightness is considered while calculating optical flow,...
void setInterpolate(bool b)
Set whether to interpolate against the master cloud.
void setInterpolationDistance(std::uint32_t distance)
Set how many slices the interpolation center is away from the start slice.
Chain resegStartingChain_
std::uint32_t interpDist_
~OpticalFlowSegmentation() override=default
auto progressIterations() const -> std::size_t override
Returns the maximum progress value.
auto getTargetZIndex() const -> int
Get the target z-index.
std::uint8_t outsideThreshold_
std::optional< std::uint32_t > maxThreads_
auto getInterpolationDistance() const -> std::uint32_t
Get how many slices the interpolation center is away from the start slice.
void setInterpolationWindow(std::uint32_t window)
Set how wide the interpolation window should be.
Segmentation algorithms and utilities library