The following command causes an exception.
cv::imwrite(\"test.jpg\", diffImg);
I also tried numerous variations on this, including absolute
Before trying anything else, be sure you are setting up OpenCV and the VS project according to this answer, and be carefully not to mix OpenCV release libraries with the debug libraries.
There are a couple of things you might try:
If you are on Windows 7 64 bits, you might want to follow this or this instructions.
I noticed a similar question on javacv wiki and this is another possible solution:
Head over to this page, follow the instructions to setup opencv 2.3.1 till Step 2. (Use 32-bit mode)
Download the latest version of TBB for Windows from here.
Extract the TBB zip file and copy all .dll files inside / bin / ia32 / vc10 and all .dll files in / bin / ia32 / vc10 / irml into your C:\ OpenCV 2.3.1\ build\ x86\ vc10\ bin
Let us know how you did.