EdgeDetect: respect minimum number of samples
This commit is contained in:
parent
98413534be
commit
72dc5ed372
@ -386,6 +386,7 @@ class EdgeDetect{
|
|||||||
edgesTop = edgesTop.sort((a,b) => {return a.distance - b.distance});
|
edgesTop = edgesTop.sort((a,b) => {return a.distance - b.distance});
|
||||||
edgesBottom = edgesBottom.sort((a,b) => {return a.distance - b.distance});
|
edgesBottom = edgesBottom.sort((a,b) => {return a.distance - b.distance});
|
||||||
|
|
||||||
|
|
||||||
// če za vsako stran (zgoraj in spodaj) poznamo vsaj enega kandidata, potem lahko preverimo nekaj
|
// če za vsako stran (zgoraj in spodaj) poznamo vsaj enega kandidata, potem lahko preverimo nekaj
|
||||||
// stvari
|
// stvari
|
||||||
|
|
||||||
@ -403,6 +404,7 @@ class EdgeDetect{
|
|||||||
var blackbarWidth = edgesTop[0].distance > edgesBottom[0].distance ?
|
var blackbarWidth = edgesTop[0].distance > edgesBottom[0].distance ?
|
||||||
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) {
|
||||||
return {
|
return {
|
||||||
status: EdgeStatus.AR_KNOWN,
|
status: EdgeStatus.AR_KNOWN,
|
||||||
blackbarWidth: blackbarWidth,
|
blackbarWidth: blackbarWidth,
|
||||||
@ -413,6 +415,7 @@ class EdgeDetect{
|
|||||||
bottom: edgesBottom[0].distance
|
bottom: edgesBottom[0].distance
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// torej, lahko da je na sliki watermark. Lahko, da je slika samo ornh črna. Najprej preverimo za watermark
|
// torej, lahko da je na sliki watermark. Lahko, da je slika samo ornh črna. Najprej preverimo za watermark
|
||||||
// it could be watermark. It could be a dark frame. Let's check for watermark first.
|
// it could be watermark. It could be a dark frame. Let's check for watermark first.
|
||||||
@ -434,6 +437,7 @@ class EdgeDetect{
|
|||||||
var blackbarWidth = edgesTop[i].distance > edgesBottom[0].distance ?
|
var blackbarWidth = edgesTop[i].distance > edgesBottom[0].distance ?
|
||||||
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) {
|
||||||
return {
|
return {
|
||||||
status: EdgeStatus.AR_KNOWN,
|
status: EdgeStatus.AR_KNOWN,
|
||||||
blackbarWidth: blackbarWidth,
|
blackbarWidth: blackbarWidth,
|
||||||
@ -447,6 +451,7 @@ class EdgeDetect{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (edgesBottom[0].distance < edgesTop[0].distance &&
|
if (edgesBottom[0].distance < edgesTop[0].distance &&
|
||||||
edgesBottom[0].count < edgesTop[0].count &&
|
edgesBottom[0].count < edgesTop[0].count &&
|
||||||
edgesBottom[0].count < this.conf.sampleCols.length * this.settings.active.arDetect.edgeDetection.logoThreshold){
|
edgesBottom[0].count < this.conf.sampleCols.length * this.settings.active.arDetect.edgeDetection.logoThreshold){
|
||||||
@ -462,11 +467,12 @@ class EdgeDetect{
|
|||||||
var blackbarWidth = edgesBottom[i].distance > edgesTop[0].distance ?
|
var blackbarWidth = edgesBottom[i].distance > edgesTop[0].distance ?
|
||||||
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) {
|
||||||
return {
|
return {
|
||||||
status: EdgeStatus.AR_KNOWN,
|
status: EdgeStatus.AR_KNOWN,
|
||||||
blackbarWidth: blackbarWidth,
|
blackbarWidth: blackbarWidth,
|
||||||
guardLineTop: edgesTop[0].distance,
|
guardLineTop: edgesTop[0].distance,
|
||||||
guardLineBottom: edgesBottom[0].absolute,
|
guardLineBottom: edgesBottom[i].absolute,
|
||||||
|
|
||||||
top: edgesTop[0].distance,
|
top: edgesTop[0].distance,
|
||||||
bottom: edgesBottom[i].distance
|
bottom: edgesBottom[i].distance
|
||||||
@ -476,6 +482,7 @@ class EdgeDetect{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// zgornjega ali spodnjega roba nismo zaznali. Imamo še en trik, s katerim lahko poskusimo
|
// zgornjega ali spodnjega roba nismo zaznali. Imamo še en trik, s katerim lahko poskusimo
|
||||||
// določiti razmerje stranic
|
// določiti razmerje stranic
|
||||||
|
Loading…
Reference in New Issue
Block a user