aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2019-12-15 14:02:59 -0500
committerFranklin Wei <franklin@rockbox.org>2019-12-15 14:02:59 -0500
commit0ab44fded43696d9ec1de41247b0ba821a148a22 (patch)
treeee4646e5cdab97bcf255c73047f08bba956c8e1d
parent6590d16e77c40123a72cdf02f60eb23c6de4b9bb (diff)
downloadsloreg-0ab44fded43696d9ec1de41247b0ba821a148a22.zip
sloreg-0ab44fded43696d9ec1de41247b0ba821a148a22.tar.gz
sloreg-0ab44fded43696d9ec1de41247b0ba821a148a22.tar.bz2
sloreg-0ab44fded43696d9ec1de41247b0ba821a148a22.tar.xz
Filter out central saturation region
-rw-r--r--gabor.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/gabor.cpp b/gabor.cpp
index d50f7b5..05efac4 100644
--- a/gabor.cpp
+++ b/gabor.cpp
@@ -235,6 +235,13 @@ void floodFill(int x, int y, Mat map, Mat visited, unsigned char target, unsigne
}
}
+Mat removeSatRegion(Mat mask, Mat orig) {
+ Rect roi = selectROI("select saturation region", orig);
+
+ rectangle(mask, roi, Scalar(0), FILLED);
+ return mask;
+}
+
// flood fill in from the border to isolate the center region
// in visited, != 0 means not visited, 0 means visited
void borderFlood(Mat map, Mat visited) {
@@ -358,6 +365,9 @@ int main()
// clean up mask -- remove islands and holes
Mat mask = cleanMask(threshed);
+ // remove saturation region from mask
+ mask = removeSatRegion(mask, img);
+
imshow("mask", mask);
// if you want a magenta background