I am trying to create a video maker to make test videos for my project. In which I should be able to change the background of the image, create a rectangular object on top of it and move the object in a straight, circular or sine path trajectory. I also want to change the speed of the object.
For now, I have selected background and created a rectangular object and overlayed it on my background image.
I don't know how to go about moving the image. I am giving an initialX
and initialY
position. To move it I have to change these values. But how to move it in a defined manner and change speed.
I am using OpenCV, c++ in QT creator on Ubuntu.
void MainWindow::on_pushButton_Generate_clicked()
{
int height=ui->lineEdit_Height->text().toInt();
int width=ui->lineEdit_Width->text().toInt();
int intensity= ui->lineEdit_Intensity->text().toInt();
int initialX=ui->lineEdit_initialX->text().toInt();
int initialY=ui->lineEdit_initialY->text().toInt();
imageBack= imread(filename);
cvtColor(imageBack, imageBack, cv::COLOR_RGB2GRAY);
rectangle(imageBack,Point(initialX,initialY),Point(initialX+width,initialY+height),Scalar(intensity),-1,8,0);
imshow("image",imageBack);
}