Template matching program to find an image within an image
This code seems very straightforward and easy to read, making it relatively easy to maintain. Here are some ways you could improve it further.
Naming
I would suggest working a bit on your member variable and local variable names. While in math we often use M and N as matrix width and height, it can be confusing which is which, and it can be difficult to communicate which you're talking about when speaking because they sound so similar. I would recommend using width and height as the variable names instead.
Using i and j for loop counters is a well-understood convention and just fine. I would caution against using ii (or iii and iiii as you had in an earlier version of the code) because it's too easy to confuse it with i or make a typo and end up with a subtle bug in your code. (I've done that before!)
Using const
The arguments to almost all of your methods remain unchanged in the method. When that happens, they should be marked as const to let a reader know they won't change. It also helps the compiler in a number of ways.
Performance
You mentioned that it's taking a long time to run. The best way to figure out why is to profile it and see where the slowdown is. I have a guess that it's probably due to the large numbers of copies that the code makes, particularly in getBlock(). I can see 2 ways to improve them:

Don't make a function-call per element you need to copy. Instead use a block copy function like the standard-C library memcpy() function for each row or sub-row you need to copy. This will be much faster than what you're currently doing.
Don't copy anything at all. You could modify the Matrix class to keep track of the width of a row separate from the number of elements in the row. This would allow you to create a new Matrix that just indexed into a current one. You would also need to make sure not to delete the array from that type of matrix, so you'd need another member variable - a bool that says whether it owns the array or not. It's slightly more housekeeping, but the result is that your copies now become a pointer assignment and a little bit of housekeeping instead of actual copies. They almost disappear!