Such a function should have a signature as follows

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ion (r,c) in the image im, and should then compare the entire template from that point. In other words, the function should consider a sub- image of im, with the bottom- left corner being (r,c) and the width and height being equal to tempWidth and tempHeight respectively. These were the width and height of the template image, remember? You should test whether or not the template is exactly the same as the specified sub- image of im. To do this, you must iterate over all the pixels in the rectangular sub- image, and then compare them with the corresponding pixels in the template image. The function should return true if the template matches with the image at location (r,c) and should return false otherwise. And here’s the magic: You don’t need to get into arrays in this function at all! You’ve already made a nice function to compare two pixels in Task 1, remember? Plus, it’s a boolean function, and that makes your life so much easier! J༄ Let’s revisit our basic if- condition: if (condition) { // C++ statements. } Let’s view this in a slightly different, but equivalent, way: if (boolean expression) { // C++ statements } The C++ statements are only executed if the boolean expression evaluates to true. The...
View Full Document

Ask a homework question - tutors are online