So my shape from the txt file (annotation file) is :
shapes from the file: [('Object_A', [(14, 134), (816, 134), (816, 458), (14, 458)], None, None, False)]
Then in the file canvas.py a function is written for moveMouseEvent() which includes the panning of the shape, moving of the shape and is as follows:
if Qt.LeftButton & ev.buttons():
if self.selectedVertex():
self.boundedMoveVertex(pos)
self.shapeMoved.emit()
self.repaint()
elif self.selectedShape and self.prevPoint:
self.overrideCursor(CURSOR_MOVE)
self.boundedMoveShape(self.selectedShape, pos)
self.shapeMoved.emit()
self.repaint()
print(f'selected shape prev point: {self.selectedShape.points}')
I added the print statement just to output the coordinates of the shape when moved and the output is as follows:
selected shape prev point: [PyQt5.QtCore.QPointF(14.0, 133.0), PyQt5.QtCore.QPointF(816.0, 133.0), PyQt5.QtCore.QPointF(816.0, 457.0), PyQt5.QtCore.QPointF(14.0, 457.0)]
selected shape prev point: [PyQt5.QtCore.QPointF(17.0, 131.0), PyQt5.QtCore.QPointF(819.0, 131.0), PyQt5.QtCore.QPointF(819.0, 455.0), PyQt5.QtCore.QPointF(17.0, 455.0)]
selected shape prev point: [PyQt5.QtCore.QPointF(23.0, 131.0), PyQt5.QtCore.QPointF(825.0, 131.0), PyQt5.QtCore.QPointF(825.0, 455.0), PyQt5.QtCore.QPointF(23.0, 455.0)]
selected shape prev point: [PyQt5.QtCore.QPointF(33.0, 131.0), PyQt5.QtCore.QPointF(835.0, 131.0), PyQt5.QtCore.QPointF(835.0, 455.0), PyQt5.QtCore.QPointF(33.0, 455.0)]
I am trying to save all these points in a concatenated list and then just use the last list of QPointF to compare with the shapes from the file. To compare I want to convert QPointF points as shown above in a list like [[(1, 2), (3, 4), (5, 6), (7, 8)], [(9, 10), (11, 12), (13, 14), (15, 16)]] . I can do this part but how do I convert the QPointF to list of lists and where can I access these points in the file labelImg.py?