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