I do not know of any client-side (JS) solution that can do this kind of functionality with a decent degree of accuracy.
You can, however, use a server-side solution.
One of the possibilities is OpenCV , a multiplatform opensource library (BSD) developed by Intel that has several interesting modules for processing images. In your specific case, the cvMatchTemplate module can be a viable solution. This is an example of detection via OpenCV::cvMatchTemplate
:
Original:
Target:
Standard Version: