Skip to content

Commit cda97f1

Browse files
committed
shift for text is calculated
1 parent d9257ec commit cda97f1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

v2/blob/kalman_blob.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (b *KalmanBlobie) DrawTrack(mat *gocv.Mat, optionalText ...string) {
228228
for i := range b.Track {
229229
gocv.Circle(mat, b.Track[i], b.drawingOptions.CentroidColor.Radius, b.drawingOptions.CentroidColor.Color, b.drawingOptions.CentroidColor.Thickness)
230230
}
231-
shiftTextY := 10
231+
shiftTextY := 0
232232
for i := len(optionalText) - 1; i >= 0; i-- {
233233
text := optionalText[i]
234234
if text != "" {
@@ -237,6 +237,7 @@ func (b *KalmanBlobie) DrawTrack(mat *gocv.Mat, optionalText ...string) {
237237
textRect := image.Rectangle{Min: image.Point{X: anchor.X, Y: anchor.Y - textSize.Y}, Max: image.Point{X: anchor.X + textSize.X, Y: anchor.Y}}
238238
gocv.Rectangle(mat, textRect, b.drawingOptions.BBoxColor.Color, b.drawingOptions.BBoxColor.Thickness)
239239
gocv.PutText(mat, text, anchor, b.drawingOptions.TextColor.Font, b.drawingOptions.TextColor.Scale, b.drawingOptions.TextColor.Color, b.drawingOptions.TextColor.Thickness)
240+
shiftTextY = textSize.Y
240241
}
241242
}
242243
}

v2/blob/simple_blob.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (b *SimpleBlobie) DrawTrack(mat *gocv.Mat, optionalText ...string) {
216216
for i := range b.Track {
217217
gocv.Circle(mat, b.Track[i], b.drawingOptions.CentroidColor.Radius, b.drawingOptions.CentroidColor.Color, b.drawingOptions.CentroidColor.Thickness)
218218
}
219-
shiftTextY := 10
219+
shiftTextY := 0
220220
for i := len(optionalText) - 1; i >= 0; i-- {
221221
text := optionalText[i]
222222
if text != "" {
@@ -225,6 +225,7 @@ func (b *SimpleBlobie) DrawTrack(mat *gocv.Mat, optionalText ...string) {
225225
textRect := image.Rectangle{Min: image.Point{X: anchor.X, Y: anchor.Y - textSize.Y}, Max: image.Point{X: anchor.X + textSize.X, Y: anchor.Y}}
226226
gocv.Rectangle(mat, textRect, b.drawingOptions.BBoxColor.Color, b.drawingOptions.BBoxColor.Thickness)
227227
gocv.PutText(mat, text, anchor, b.drawingOptions.TextColor.Font, b.drawingOptions.TextColor.Scale, b.drawingOptions.TextColor.Color, b.drawingOptions.TextColor.Thickness)
228+
shiftTextY = textSize.Y
228229
}
229230
}
230231
}

0 commit comments

Comments
 (0)