@@ -14,14 +14,14 @@ import { matchImages } from "./match-image.function";
14
14
import { scaleImage } from "./scale-image.function" ;
15
15
import { scaleLocation } from "./scale-location.function" ;
16
16
17
- const loadNeedle = async ( image : Image ) : Promise < cv . Mat > = > {
17
+ async function loadNeedle ( image : Image ) : Promise < cv . Mat > {
18
18
if ( image . hasAlphaChannel ) {
19
19
return ImageProcessor . fromImageWithAlphaChannel ( image ) ;
20
20
}
21
21
return ImageProcessor . fromImageWithoutAlphaChannel ( image ) ;
22
- } ;
22
+ }
23
23
24
- const loadHaystack = async ( matchRequest : MatchRequest ) : Promise < cv . Mat > = > {
24
+ async function loadHaystack ( matchRequest : MatchRequest ) : Promise < cv . Mat > {
25
25
const searchRegion = determineScaledSearchRegion ( matchRequest ) ;
26
26
if ( matchRequest . haystack . hasAlphaChannel ) {
27
27
return ImageProcessor . fromImageWithAlphaChannel (
@@ -34,9 +34,9 @@ const loadHaystack = async (matchRequest: MatchRequest): Promise<cv.Mat> => {
34
34
searchRegion ,
35
35
) ;
36
36
}
37
- } ;
37
+ }
38
38
39
- const debugImage = ( image : cv . Mat , filename : string , suffix ?: string ) => {
39
+ function debugImage ( image : cv . Mat , filename : string , suffix ?: string ) {
40
40
const parsedPath = path . parse ( filename ) ;
41
41
let fullFilename = parsedPath . name ;
42
42
if ( suffix ) {
@@ -45,20 +45,20 @@ const debugImage = (image: cv.Mat, filename: string, suffix?: string) => {
45
45
fullFilename += parsedPath . ext ;
46
46
const fullPath = path . join ( parsedPath . dir , fullFilename ) ;
47
47
cv . imwriteAsync ( fullPath , image ) ;
48
- } ;
48
+ }
49
49
50
- // const debugResult = (image: cv.Mat, result: MatchResult, filename: string, suffix?: string) => {
50
+ // function debugResult(image: cv.Mat, result: MatchResult, filename: string, suffix?: string) {
51
51
// const roiRect = new cv.Rect(
52
52
// Math.min(Math.max(result.location.left, 0), image.cols),
53
53
// Math.min(Math.max(result.location.top, 0), image.rows),
54
54
// Math.min(result.location.width, image.cols - result.location.left),
55
55
// Math.min(result.location.height, image.rows - result.location.top));
56
56
// debugImage(image.getRegion(roiRect), filename, suffix);
57
- // };
57
+ // }
58
58
59
- const isValidSearch = ( needle : cv . Mat , haystack : cv . Mat ) : boolean => {
59
+ function isValidSearch ( needle : cv . Mat , haystack : cv . Mat ) : boolean {
60
60
return ( needle . cols <= haystack . cols ) && ( needle . rows <= haystack . rows ) ;
61
- } ;
61
+ }
62
62
63
63
export class TemplateMatchingFinder implements FinderInterface {
64
64
private initialScale = [ 1.0 ] ;
0 commit comments