diff --git a/src/ext/conf/ExtensionConf.js b/src/ext/conf/ExtensionConf.js index b7ae85d..1565777 100644 --- a/src/ext/conf/ExtensionConf.js +++ b/src/ext/conf/ExtensionConf.js @@ -111,8 +111,8 @@ var ExtensionConf = { edgeDetection: { sampleWidth: 8, // we take a sample this wide for edge detection detectionThreshold: 4, // sample needs to have this many non-black pixels to be a valid edge - confirmationThreshold: 0, // - singleSideConfirmationThreshold: 0.3, // we need this much edges (out of all samples, not just edges) in order + confirmationThreshold: 1, // + singleSideConfirmationThreshold: 4, // we need this much edges (out of all samples, not just edges) in order // to confirm an edge in case there's no edges on top or bottom (other // than logo, of course) logoThreshold: 0.15, // if edge candidate sits with count greater than this*all_samples, it can't be logo diff --git a/src/ext/lib/ar-detect/edge-detect/EdgeDetect.js b/src/ext/lib/ar-detect/edge-detect/EdgeDetect.js index 6f8872d..ce82805 100644 --- a/src/ext/lib/ar-detect/edge-detect/EdgeDetect.js +++ b/src/ext/lib/ar-detect/edge-detect/EdgeDetect.js @@ -404,7 +404,8 @@ class EdgeDetect{ var blackbarWidth = edgesTop[0].distance > edgesBottom[0].distance ? edgesTop[0].distance : edgesBottom[0].distance; - if (edgesTop[0].count + edgesBottom[0].count > this.settings.active.arDetect.edgeDetection.detectionThreshold) { + if (edgesTop[0].count + edgesBottom[0].count > this.settings.active.arDetect.edgeDetection.singleSideConfirmationThreshold + || ( edgesTop[0].count > this.settings.active.arDetect.edgeDetection.confirmationThreshold && edgesBottom[0].count > this.settings.active.arDetect.edgeDetection.confirmationThreshold) ){ return { status: EdgeStatus.AR_KNOWN, blackbarWidth: blackbarWidth, @@ -437,7 +438,8 @@ class EdgeDetect{ var blackbarWidth = edgesTop[i].distance > edgesBottom[0].distance ? edgesTop[i].distance : edgesBottom[0].distance; - if (edgesTop[i].count + edgesBottom[0].count > this.settings.active.arDetect.edgeDetection.detectionThreshold) { + if (edgesTop[i].count + edgesBottom[0].count > this.settings.active.arDetect.edgeDetection.singleSideConfirmationThreshold + || (edgesTop[i].count > this.settings.active.arDetect.edgeDetection.singleSideConfirmationThreshold && edgesBottom[0].count > this.settings.active.arDetect.edgeDetection.confirmationThreshold) ) { return { status: EdgeStatus.AR_KNOWN, blackbarWidth: blackbarWidth, @@ -467,7 +469,8 @@ class EdgeDetect{ var blackbarWidth = edgesBottom[i].distance > edgesTop[0].distance ? edgesBottom[i].distance : edgesTop[0].distance; - if (edgesTop[0].count + edgesBottom[i].count > this.settings.active.arDetect.edgeDetection.detectionThreshold) { + if (edgesTop[0].count + edgesBottom[i].count > this.settings.active.arDetect.edgeDetection.singleSideConfirmationThreshold + || (edgesTop[0].count > this.settings.active.arDetect.edgeDetection.singleSideConfirmationThreshold && edgesBottom[i].count > this.settings.active.arDetect.edgeDetection.confirmationThreshold)) { return { status: EdgeStatus.AR_KNOWN, blackbarWidth: blackbarWidth, @@ -489,7 +492,7 @@ class EdgeDetect{ // either the top or the bottom edge remains undetected, but we have one more trick that we // can try. It also tries to work around logos. - var edgeDetectionThreshold = this.conf.sampleCols.length * this.settings.active.arDetect.edgeDetection.singleSideConfirmationThreshold; + const edgeDetectionThreshold = this.settings.active.arDetect.edgeDetection.singleSideConfirmationThreshold; if (edges.edgeCandidatesTopCount == 0 && edges.edgeCandidatesBottomCount != 0){ for(var edge of edgesBottom){ diff --git a/src/options/AutodetectionSettings.vue b/src/options/AutodetectionSettings.vue index 9cb4db1..aa99843 100644 --- a/src/options/AutodetectionSettings.vue +++ b/src/options/AutodetectionSettings.vue @@ -330,10 +330,11 @@ Sample width — In a bid to detect "false" edges, we take two samples this many pixels wide near the point of our potential edge. One sample must be completely black, the other must contain a set amount of non-black pixels.
Detection threshold — non-black sample mentioned above needs to contain at least this many non-black pixels.
- Single side confirmation threshold — quorum needed to establish aspect ratio in case we manage to detect an edge only on one side of the video. (0-0.5)
+ Thickness quorum (per edge) — amount of samples that agree on the thincknes of the blackbar that we need in order to establish aspect ratio. Every edge needs to have at least this many. Values higher than {{~~(settings.active.arDetect.edgeDetection.singleSideConfirmationThreshold / 2)}} (quorum (total)/2) are pointless.
+ Thickness quorum (total) — amount of samples that agree on the thinckess of the blackbar that we need in order to establish aspect ratio in case one of the edges doesn't contain enough samples to achieve quorum.
Logo threshold — if edge candidate sits with count greater than this*all_samples, it can't be a logo or a watermark.
Ignore middle area — When trying to detect area, ignore area between middle and canvasHeight * {this value} pixels towards the edge.
- Detect limit — stop search after finding a potential candidate in this many sample columns (%, 0-1)
+ Detect limit — stop search after finding a potential candidate in this many sample columns
@@ -358,7 +359,17 @@
- Single side confirmation threshold: + Thickness quorum (per edge): +
+
+ +
+
+
+
+ Thicnkess quorum (total):