Here is what I see when press the key after the 1st imshow() appears
C:\LiuJun\Code\C\SUW1\x64\Debug\SUW1.exe (process 21348) exited with code -1073741819.
The part of A#pragma is done by my coworker when we work with the code using 32bit library.
Thank you for suggestion regarding #pragma!