[SOLVED]Rotation of ROI
Hello my friends...
I have drawn a rectangle in one image which is loaded on qgraphicsView.
I got all of the dimensions from user and drew this rectangle.Now I am going to rotate this rectangle with respect to angle which is given by user...
How can I do that?
thanks in advance
hmmm, use QGraphicsItem::setRotation ?
excuse me ...can you guide me a little more? I am new comer in Qt and opencv world...
this is my code...I want to rotate these drawn rectangles as much as angle which is given by user...
QGraphicsScene* scene = new QGraphicsScene();
scene->clear(); //for cleaning the qgraphicsview and loading the image again
img = imread(filename.toAscii().data());
QImage img1 = QImage((const unsigned char*)(img.data), img.cols, img.rows, img.step, QImage::Format_RGB888);
QGraphicsPixmapItem* item = new QGraphicsPixmapItem(QPixmap::fromImage(img1));
QGraphicsItem* i=new QGraphicsItem() ;
ui->View->setScene(scene); //"View" is the name of object that I have on my .ui file(form)
I am puzzled what you are trying to achieve.
All of your image manipulation is being done with OpenCV, which has nothing to do with Qt. If you want OpenCV to draw a rotated rectangle on top of the image you load from a file then you need to refer to the OpenCV documentation as to how you do that.
If you want to rotate the entire image after you place it into the QGraphicsScene then you use QGraphicsItem::setRotation() on the QGraphicsPixmapItem you create as vidar suggested.
All of this can be done without OpenCV.