[detectionview] simplify indexing
This commit is contained in:
parent
5758cf61c6
commit
c0a7631acd
@ -128,20 +128,20 @@ class DetectionView(QWidget):
|
||||
del it
|
||||
|
||||
def updateDetections(self, keypoint=-1):
|
||||
logging.info("DetectionView.updateDetections!")
|
||||
self.clearDetections()
|
||||
if self._data is None:
|
||||
return
|
||||
frames = self._data.selectedData("frame")
|
||||
tracks = self._data.selectedData("track")
|
||||
ids = self._data.selectedData("index")
|
||||
coordinates = self._data.coordinates(selection=True)
|
||||
centercoordinates = self._data.centerOfGravity(selection=True)
|
||||
userlabeled = self._data.selectedData("userlabeled")
|
||||
|
||||
indices = self._data.selectionIndices
|
||||
|
||||
image_rect = self._pixmapitem.boundingRect() if self._pixmapitem is not None else QRectF(0,0,0,0)
|
||||
|
||||
for i, idx in enumerate(indices):
|
||||
t = tracks[i]
|
||||
for i, (id, f, t, l) in enumerate(zip(ids, frames, tracks, userlabeled)):
|
||||
c = Tracks.fromValue(t).toColor()
|
||||
if keypoint >= 0:
|
||||
x = coordinates[i, keypoint, 0]
|
||||
@ -151,10 +151,11 @@ class DetectionView(QWidget):
|
||||
y = centercoordinates[i, 1]
|
||||
|
||||
item = Detection(image_rect.left() + x, image_rect.top() + y, 20, 20, brush=QBrush(c))
|
||||
item.setData(DetectionData.TRACK_ID.value, tracks[i])
|
||||
item.setData(DetectionData.ID.value, idx)
|
||||
item.setData(DetectionData.TRACK_ID.value, t)
|
||||
item.setData(DetectionData.ID.value, id)
|
||||
item.setData(DetectionData.COORDINATES.value, coordinates[i, :, :])
|
||||
item.setData(DetectionData.FRAME.value, frames[i])
|
||||
item.setData(DetectionData.FRAME.value, f)
|
||||
item.setData(DetectionData.USERLABELED.value, l)
|
||||
item = self._scene.addItem(item)
|
||||
|
||||
def fit_image_to_view(self):
|
||||
|
Loading…
Reference in New Issue
Block a user