You will have some algorithm programmed to extract feature vector or matrix from one image. You will run that for each training image and store the resulting calculated feature vectors or matrices. Then you will use that data to create a classification algorithm. Then your main program will take any test image and will apply your feature extraction algorithm to it and then your classifier algorithm will decide if the current test image is what you are looking for, or not.
You get to find out what types of features and what type of classifier will work the best, for your images, and your application.