Gradient detect mode
This commit is contained in:
parent
978bd41386
commit
aa4dbc15f6
7
src/common/enums/anti-gradient-mode.enum.js
Normal file
7
src/common/enums/anti-gradient-mode.enum.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
var AntiGradientMode = Object.freeze({
|
||||||
|
Disabled: 0,
|
||||||
|
Lax: 1,
|
||||||
|
Strict: 2
|
||||||
|
});
|
||||||
|
|
||||||
|
export default EdgeDetectPrimaryDirection;
|
@ -9,7 +9,7 @@ var Debug = {
|
|||||||
// debug: false,
|
// debug: false,
|
||||||
// keyboard: true,
|
// keyboard: true,
|
||||||
// debugResizer: true,
|
// debugResizer: true,
|
||||||
debugArDetect: true,
|
// debugArDetect: true,
|
||||||
// debugStorage: false,
|
// debugStorage: false,
|
||||||
// debugStorage: true,
|
// debugStorage: true,
|
||||||
// comms: false,
|
// comms: false,
|
||||||
@ -18,7 +18,7 @@ var Debug = {
|
|||||||
// flushStoredSettings: true,
|
// flushStoredSettings: true,
|
||||||
flushStoredSettings: false,
|
flushStoredSettings: false,
|
||||||
// playerDetectDebug: true,
|
// playerDetectDebug: true,
|
||||||
periodic: true,
|
// periodic: true,
|
||||||
// videoRescan: true,
|
// videoRescan: true,
|
||||||
// mousemove: true,
|
// mousemove: true,
|
||||||
arDetect: {
|
arDetect: {
|
||||||
|
@ -3,6 +3,7 @@ import currentBrowser from './BrowserDetect';
|
|||||||
import VideoAlignment from '../../common/enums/video-alignment.enum';
|
import VideoAlignment from '../../common/enums/video-alignment.enum';
|
||||||
import Stretch from '../../common/enums/stretch.enum';
|
import Stretch from '../../common/enums/stretch.enum';
|
||||||
import ExtensionMode from '../../common/enums/extension-mode.enum';
|
import ExtensionMode from '../../common/enums/extension-mode.enum';
|
||||||
|
import AntiGradientMode from '../../common/enums/anti-gradient-mode.enum';
|
||||||
|
|
||||||
if(Debug.debug)
|
if(Debug.debug)
|
||||||
console.log("Loading: ExtensionConf.js");
|
console.log("Loading: ExtensionConf.js");
|
||||||
@ -61,6 +62,8 @@ var ExtensionConf = {
|
|||||||
// the last pixel that's darker than our treshold, and position of the first pixel that's
|
// the last pixel that's darker than our treshold, and position of the first pixel that's
|
||||||
// brighter than our image treshold. If positions are more than this many pixels apart,
|
// brighter than our image treshold. If positions are more than this many pixels apart,
|
||||||
// we assume we aren't looking at letterbox and thus don't correct the aspect ratio.
|
// we assume we aren't looking at letterbox and thus don't correct the aspect ratio.
|
||||||
|
gradientSampleSize: 8, // How far do we look to find the gradient
|
||||||
|
antiGradientMode: AntiGradientMode.Strict,
|
||||||
},
|
},
|
||||||
variableBlackbarTresholdOptions: { // In case of poor bitrate videos, jpeg artifacts may cause us issues
|
variableBlackbarTresholdOptions: { // In case of poor bitrate videos, jpeg artifacts may cause us issues
|
||||||
// FOR FUTURE USE
|
// FOR FUTURE USE
|
||||||
|
@ -140,19 +140,29 @@ class EdgeDetect{
|
|||||||
const res_bottom = [];
|
const res_bottom = [];
|
||||||
|
|
||||||
for (let item of res_top_preliminary) {
|
for (let item of res_top_preliminary) {
|
||||||
if (!item.image) {
|
if (this.settings.active.arDetect.blackbar.antiGradientMode === AntiGradientMode.Disabled) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (item.image > -1 && item.image <= item.black + this.settings.active.arDetect.blackbar.gradientTreshold) {
|
|
||||||
res_top.push({top: item.image, col: item.col});
|
res_top.push({top: item.image, col: item.col});
|
||||||
|
} else if (this.settings.active.arDetect.blackbar.antiGradientMode === AntiGradientMode.Lax) {
|
||||||
|
if (item.image === undefined || item.image <= item.black + this.settings.active.arDetect.blackbar.gradientTreshold) {
|
||||||
|
res_top.push({top: item.image, col: item.col});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ( item.image !== undefined && item.image <= item.black + this.settings.active.arDetect.blackbar.gradientTreshold) {
|
||||||
|
res_top.push({top: item.image, col: item.col});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let item of res_bottom_preliminary) {
|
for (let item of res_bottom_preliminary) {
|
||||||
if (!item.image) {
|
if (!item.image) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (item.image >= item.black - this.settings.active.arDetect.blackbar.gradientTreshold) {
|
if (this.settings.active.arDetect.blackbar.antiGradientMode === AntiGradientMode.Disabled) {
|
||||||
res_bottom.push({bottom: item.image, col: item.col});
|
res_bottom.push({bottom: item.image, col: item.col});
|
||||||
|
} else {
|
||||||
|
if ( (item.image !== undefined || this.settings.active.arDetect.blackbar.antiGradientMode === AntiGradientMode.Lax)
|
||||||
|
&& item.image >= item.black - this.settings.active.arDetect.blackbar.gradientTreshold) {
|
||||||
|
res_bottom.push({bottom: item.image, col: item.col});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -551,7 +561,6 @@ class EdgeDetect{
|
|||||||
colsOut[c].black = (i / this.conf.canvasImageDataRowLength) - 1;
|
colsOut[c].black = (i / this.conf.canvasImageDataRowLength) - 1;
|
||||||
colsOut[c].col = colsIn[c].value;
|
colsOut[c].col = colsIn[c].value;
|
||||||
colsIn[c].blackFound = 1;
|
colsIn[c].blackFound = 1;
|
||||||
console.log("BLACK FOUND AT COL:", colsIn[c].value, '|', colsOut[c].col, "LINE:", colsOut[c].black, colsOut, colsOut[c])
|
|
||||||
|
|
||||||
// prisili, da se zanka izvede še enkrat ter preveri,
|
// prisili, da se zanka izvede še enkrat ter preveri,
|
||||||
// ali trenuten piksel preseže tudi imageTreshold
|
// ali trenuten piksel preseže tudi imageTreshold
|
||||||
@ -562,7 +571,7 @@ class EdgeDetect{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (colsIn[c].blackFound++ > this.settings.active.arDetect.blackbar.gradientTreshold) {
|
if (colsIn[c].blackFound++ > this.settings.active.arDetect.blackbar.gradientSampleSize) {
|
||||||
colsIn[c].imageFound = true;
|
colsIn[c].imageFound = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -605,7 +614,6 @@ class EdgeDetect{
|
|||||||
colsOut[c].black = (i / this.conf.canvasImageDataRowLength);
|
colsOut[c].black = (i / this.conf.canvasImageDataRowLength);
|
||||||
colsOut[c].col = colsIn[c].value;
|
colsOut[c].col = colsIn[c].value;
|
||||||
colsIn[c].blackFound = true;
|
colsIn[c].blackFound = true;
|
||||||
console.log("BLACK FOUND AT COL:", colsIn[c].value, '|', colsOut[c].col, "LINE:", colsOut[c].black, colsOut, colsOut[c])
|
|
||||||
|
|
||||||
// prisili, da se zanka izvede še enkrat ter preveri,
|
// prisili, da se zanka izvede še enkrat ter preveri,
|
||||||
// ali trenuten piksel preseže tudi imageTreshold
|
// ali trenuten piksel preseže tudi imageTreshold
|
||||||
@ -616,7 +624,7 @@ class EdgeDetect{
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (colsIn[c].blackFound++ > this.settings.active.arDetect.blackbar.gradientTreshold) {
|
if (colsIn[c].blackFound++ > this.settings.active.arDetect.blackbar.gradientSampleSize) {
|
||||||
colsIn[c].imageFound = true;
|
colsIn[c].imageFound = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user