2

これは完全に単純なように思えますが、何らかの理由で私の線が中央に配置されていません。

これが私のコードです:

static const int width = 240;
static const int height = 320;

VideoCapture cap(0);
cap.set(CV_CAP_PROP_FRAME_WIDTH, width);
cap.set(CV_CAP_PROP_FRAME_HEIGHT, height);

//Set points for center line
CvPoint mid_bottom, mid_top;
mid_bottom.x = width/2;
mid_bottom.y = 0;
mid_top.x = width/2;
mid_top.y = height;

//for purposes not related to this issue, I have to use IplImages instead of Mats
Mat frame; //(edit - forgot this declaration before, sorry!)
cap >> frame;
IplImage frame_ipl = frame;

//drawing the line
cvLine(&frame_ipl, mid_bottom, mid_top, RED, 2);

結果:

なぜこれがうまくいかないのかについて何か考えはありますか?

4

1 に答える 1