@@ -14,14 +14,14 @@ import { matchImages } from "./match-image.function";
1414import { scaleImage } from "./scale-image.function" ;
1515import { scaleLocation } from "./scale-location.function" ;
1616
17- const loadNeedle = async ( image : Image ) : Promise < cv . Mat > = > {
17+ async function loadNeedle ( image : Image ) : Promise < cv . Mat > {
1818 if ( image . hasAlphaChannel ) {
1919 return ImageProcessor . fromImageWithAlphaChannel ( image ) ;
2020 }
2121 return ImageProcessor . fromImageWithoutAlphaChannel ( image ) ;
22- } ;
22+ }
2323
24- const loadHaystack = async ( matchRequest : MatchRequest ) : Promise < cv . Mat > = > {
24+ async function loadHaystack ( matchRequest : MatchRequest ) : Promise < cv . Mat > {
2525 const searchRegion = determineScaledSearchRegion ( matchRequest ) ;
2626 if ( matchRequest . haystack . hasAlphaChannel ) {
2727 return ImageProcessor . fromImageWithAlphaChannel (
@@ -34,9 +34,9 @@ const loadHaystack = async (matchRequest: MatchRequest): Promise<cv.Mat> => {
3434 searchRegion ,
3535 ) ;
3636 }
37- } ;
37+ }
3838
39- const debugImage = ( image : cv . Mat , filename : string , suffix ?: string ) => {
39+ function debugImage ( image : cv . Mat , filename : string , suffix ?: string ) {
4040 const parsedPath = path . parse ( filename ) ;
4141 let fullFilename = parsedPath . name ;
4242 if ( suffix ) {
@@ -45,20 +45,20 @@ const debugImage = (image: cv.Mat, filename: string, suffix?: string) => {
4545 fullFilename += parsedPath . ext ;
4646 const fullPath = path . join ( parsedPath . dir , fullFilename ) ;
4747 cv . imwriteAsync ( fullPath , image ) ;
48- } ;
48+ }
4949
50- // const debugResult = (image: cv.Mat, result: MatchResult, filename: string, suffix?: string) => {
50+ // function debugResult(image: cv.Mat, result: MatchResult, filename: string, suffix?: string) {
5151// const roiRect = new cv.Rect(
5252// Math.min(Math.max(result.location.left, 0), image.cols),
5353// Math.min(Math.max(result.location.top, 0), image.rows),
5454// Math.min(result.location.width, image.cols - result.location.left),
5555// Math.min(result.location.height, image.rows - result.location.top));
5656// debugImage(image.getRegion(roiRect), filename, suffix);
57- // };
57+ // }
5858
59- const isValidSearch = ( needle : cv . Mat , haystack : cv . Mat ) : boolean => {
59+ function isValidSearch ( needle : cv . Mat , haystack : cv . Mat ) : boolean {
6060 return ( needle . cols <= haystack . cols ) && ( needle . rows <= haystack . rows ) ;
61- } ;
61+ }
6262
6363export class TemplateMatchingFinder implements FinderInterface {
6464 private initialScale = [ 1.0 ] ;
0 commit comments