CPPxDIC
C++ Digital Image Correlation library for fingertip 3D reconstruction
Loading...
Searching...
No Matches
mask_seed_setup.h
Go to the documentation of this file.
1
17#ifndef STEPSABC_MASK_SEED_SETUP_H
18#define STEPSABC_MASK_SEED_SETUP_H
19
20#include "parameters.h"
21#include <opencv2/opencv.hpp>
22#include <string>
23#include <vector>
24
25namespace cppxdic {
26namespace stepsABC {
27
32 cv::Mat mask; // uint8 ROI mask (0 outside, 255 inside)
33 std::vector<cv::Point> polygon; // polygon vertices defining the mask (pixel coords)
34 std::vector<SeedPoint> seeds; // one or more seed points (pixel world coords)
35 bool valid = false; // true when mask + at least one seed are set
36};
37
52public:
66 static MaskSeedResult runGui(const cv::Mat& reference_image, int num_seeds,
67 std::string& error_message);
68
79 static MaskSeedResult loadFromFiles(const std::string& polygon_or_mask_path,
80 const std::string& seed_path, const cv::Size& image_size,
81 std::string& error_message);
82
87 static bool save(const MaskSeedResult& result, const std::string& out_prefix,
88 std::string& error_message);
89
91 static cv::Mat polygonToMask(const std::vector<cv::Point>& polygon, const cv::Size& image_size);
92
94 static std::vector<cv::Point> readPolygonFile(const std::string& path,
95 std::string& error_message);
96
98 static std::vector<SeedPoint> readSeedFile(const std::string& path, std::string& error_message);
99
101 static bool guiAvailable();
102};
103
104} // namespace stepsABC
105} // namespace cppxdic
106
107#endif // STEPSABC_MASK_SEED_SETUP_H
static MaskSeedResult loadFromFiles(const std::string &polygon_or_mask_path, const std::string &seed_path, const cv::Size &image_size, std::string &error_message)
Non-interactive setup: load mask polygon (or mask image) and seed points from files.
static MaskSeedResult runGui(const cv::Mat &reference_image, int num_seeds, std::string &error_message)
Interactive GUI setup using OpenCV highgui.
static cv::Mat polygonToMask(const std::vector< cv::Point > &polygon, const cv::Size &image_size)
Rasterise a polygon into an 8-bit (0/255) mask of the given size.
static std::vector< cv::Point > readPolygonFile(const std::string &path, std::string &error_message)
Read a ".poly" polygon file.
static std::vector< SeedPoint > readSeedFile(const std::string &path, std::string &error_message)
Read a ".seed" file.
static bool guiAvailable()
Returns true if this binary was compiled with GUI support.
static bool save(const MaskSeedResult &result, const std::string &out_prefix, std::string &error_message)
Persist a result to disk.
DataSerializer - Abstract base class for format-agnostic DIC data I/O.
Result of a mask/seed setup operation.
std::vector< cv::Point > polygon
std::vector< SeedPoint > seeds