java - How do I do matchTemplate by iterating all image in a folder? -
i want match character image cropped image set of template image of alphabets folder. used template matching opencv match them. can cropped image mapped first image template folder , go next image image.
my question how can iterate through template folder cropped image find correct character match to. , using matchtemplate correct way use or need use other function?
is want? here iterate on directory , break loop if template_matching()
returns true
import java.io.file; file dir = new file("folder-with-images"); file[] files = dir.listfiles(); for( int i=0; < files.length; i++ ){ string path = files[i].getabsolutepath(); // check file type , work jpg/png files if( path.tolowercase().endswith(".jpg") || path.tolowercase().endswith(".png") ) { pimage image = loadimage( path ); // if template_match(image), break } } }
Comments
Post a Comment