I am using OpenCV with python, and more specifically the findTransformECC fonction of cv2 to perform image registration. This function can throw errors if the algorithm does not converge. I catch the error with a simple try ... except instruction, and I handle the error. However the OpenCV error message is still displayed in my terminal, and I would like to hide it. How should I do?
Here is a simple exemple
try:
    cc, warp_matrix = cv2.findTransformECC(img1, img2, warp_matrix)
except cv2.error:
    cc = 15;
    print("An error occured but it does not matter")
If the findTrnaformECC function throws am error my program correctly outputs my custom error message (An error occured but it does not matter) but ALSO the OpenCV error (OpenCV Error: Iterations do not converge (The algorithm stopped before its convergence. The correlation is going to be minimized. Images may be uncorrelated or non-overlapped) in findTransformECC, file /home/travis/miniconda/conda-bld/conda_1485299288502/work/opencv-3.2.0/modules/video/src/ecc.cpp, line 530) and I would like to prevent that.
