Whenever I try to draw a line in OpenCV, it is drawn very thick. I ask for 1 pixel wide and get 40 pixels wide. If I draw CV_RGB(255,0,0) I get a fat red line. If I draw CV_RGB(0,255,0) I get a fat green line. If I draw CV_RGB(0,0,255) the program crashes. It doesn't matter whether I'm drawing on an image created with cvCaptureFromCam or by cvLoadImage. It doesn't matter whether I'm using cvLine or cvRectangle.
I suspect it's the usual clash-of-versions problem that I always run up against when I try to use Linux. It looks to me like the Pascal wrapper doesn't match the code in the the OpenCV library.
I'm using Raspberry Pi 3B+, Raspbian 9.9, Lazarus 2.0.0, Pi Camera.
I got a pre-compiled version of OpenCV from "
https://github.com/jabelone/OpenCV-for-Pi/raw/master/latest-OpenCV.deb". Python assures me I'm using version 3.4.4 of OpenCV. I've no idea how to find what Lazarus thinks it's connected to. I presume it's the same version.
OpenCV works fine under Python. I was doing Haar face detection which works well. It draws lines just like it's been told to.
I got a Pascal wrapper for OpenCV from "
https://github.com/t-edson/MiOpenCV". It was the only wrapper I could find that compiled, linked and ran for Raspberry Pi.
I did the same sort of face detection in Lazarus. Once again, the face detection works well. It finds faces and draws boxes round them. The miOpenCv library contains a sample program called "Demo4_FaceDetect". The output is shown in the attached image. You can see how wide the lines are.
A typical call is:
cvRectangle(temp, pt1, pt2, CV_RGB(255, 0, 0), 3, 8, 0);
I've also written a face detection program that works with live images for the camera with the same result: fat lines.
These are exactly the symptoms I've had in the past when writing Delphi wrappers for C libraries and you get the function parameters wrong. Clearly, an awful lot of OpenCV is working but line drawing goes wrong.
Any thoughts as to what might be happening? What wrappers do you use?
Peter