The above code example does not actually draw any line to my Mat. I’ve also tested this using different line colours, as well as initializing a simple black matrix and trying to draw on that - still nothing draws. I see the same behaviour using rectangle()
the code seems to be correct and I can see a blue line on a black background if I replace
imwrite(“image.jpg”, image);
waitKey(1);
with
imshow("x",image);
waitKey(0); //wait until key press
you can also print the matrix to console with cout << image; to check if all elements are still zero or if some are set to 255. I suggest to reduce the image size before you do that.