How to crop a CvMat in OpenCV?

OpenCV has region of interest functions which you may find useful. If you are using the cv::Mat then you could use something like the following. // You mention that you start with a CVMat* imagesource CVMat * imagesource; // Transform it into the C++ cv::Mat format cv::Mat image(imagesource); // Setup a rectangle to define your … Read more

Why OpenCV Using BGR Colour Space Instead of RGB

“The reason why the early developers at OpenCV chose BGR color format is probably that back then BGR color format was popular among camera manufacturers and software providers. E.g. in Windows, when specifying color value using COLORREF they use the BGR format 0x00bbggrr. BGR was a choice made for historical reasons and now we have … Read more

sift = cv2.xfeatures2d.SIFT_create() not working even though have contrib installed

I had the same problem. It seems that SIRF and SURF are no longer available in opencv > 3.4.2.16. I chose an older opencv-python and opencv-contrib-python versions and solved this problem. Here is the history version about opencv-python, and I use the following code : pip install opencv-python==3.4.2.16 pip install opencv-contrib-python==3.4.2.16 Edit For Anaconda User … Read more

Computing x,y coordinate (3D) from image point

Given your configuration, errors of 20-40mm at the edges are average. It looks like you’ve done everything well. Without modifying camera/system configuration, doing better will be hard. You can try to redo camera calibration and hope for better results, but this will not improve them alot (and you may eventually get worse results, so don’t … Read more

How to define the markers for Watershed in OpenCV?

First of all: the function minMaxLoc finds only the global minimum and global maximum for a given input, so it is mostly useless for determining regional minima and/or regional maxima. But your idea is right, extracting markers based on regional minima/maxima for performing a Watershed Transform based on markers is totally fine. Let me try … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)