opencvライブラリで与えられたshape.cからコードを取り出して少し修正した。私はいつでも私は刻み、古い数字が除去されなければならないし、唯一の新しい数字は私が取得しています何drawn.Butする必要があることを望むOPENCV:新しいシェイプが描画されるたびに、古いシェイプをループから取り除いて基本シェイプを描きたい。
#include <stdio.h>
#include "cv.h"
#include "highgui.h"
int main(int argc, char** argv)
{
int i = 0;
for(i=0;i<3 ;i++)
{
/* create an image */
IplImage *img = cvCreateImage(cvSize(200, 100), IPL_DEPTH_8U, 3);
/* draw a green line */
cvLine(img, /* the dest image */
cvPoint(10 +i*10, 10), /* start point */
cvPoint(150, 80), /* end point */
cvScalar(0, 255, 0, 0), /* the color; green */
1, 8, 0); /* thickness, line type, shift */
/* draw a blue box */
cvRectangle(img, /* the dest image */
cvPoint(20, 15+i*10), /* top left point */
cvPoint(100, 70), /* bottom right point */
cvScalar(255, 0, 0, 0), /* the color; blue */
1, 8, 0); /* thickness, line type, shift */
/* draw a red circle */
cvCircle(img, /* the dest image */
cvPoint(110, 60), 35+i*10, /* center point and radius */
cvScalar(0, 0, 255, 0), /* the color; red */
1, 8, 0); /* thickness, line type, shift */
/* display the image */
cvNamedWindow("img", CV_WINDOW_AUTOSIZE);
cvShowImage("img", img);
cvWaitKey(0);
cvDestroyWindow("img");
cvReleaseImage(&img);
}
return 0;
}
はあなたが私助けてくださいpresent.Can新しいフィギュアと一緒に古い数字でもある、ありますか? 。
おそらく問題はありませんが、毎回新しいウィンドウを開いています。 – Blender