For a long time, I have tried to write a very simple OpenCV application, using variations of the code below. I prefer the PNG graphics format, but the code works erratically: sometimes I get a line, sometimes I get a black (empty) rectangle. If I use JPG or BMP, the program works fine.
TIA,
-Ramon
ps: My current version is OpenCV 2.1
include <opencv cv.h="">
include <opencv highgui.h="">
IplImage* image = cvCreateImage(cvSize(int(8.572), 1172), IPL_DEPTH_16U, 4); cvLine(image, cvPoint(22, 44), cvPoint(456, 700), CV_RGB(255, 0, 0)); cvSaveImage("my_image.bmp", image);