HumanSignal / labelImg

LabelImg is now part of the Label Studio community. The popular image annotation tool created by Tzutalin is no longer actively being developed, but you can check out Label Studio, the open source data labeling tool for images, text, hypertext, audio, video and time-series data.
https://youtu.be/p0nR2YsCY_U
MIT License
22.51k stars 6.27k forks source link

Bounding box move down (in the y axis) by one pixel when mouse is released to draw #458

Open yxchng opened 5 years ago

yxchng commented 5 years ago

Using latest master code

meatball-guy commented 5 years ago

I am also facing this issue. It is quite frustrating to use. It happens randomly. Sometimes it is ok and sometimes it just does it EDIT 2: I also realised that the box also moves after moving to the next page, also by 1 pixel.

yxchng commented 5 years ago

@meatball-guy Any suggestion for better tools?

duming commented 5 years ago

I also got this problem. When you want to label some small objects, the box will shift down or shift right by one pixel. Steps to reproduce:

  1. Using Crtl + Wheel zoom in to max scale.
  2. Using Crtl + Wheel zoom out 9 times.
  3. Press "w" to draw a box.
  4. When you release the mouse you should see the shift.

And I traced the bug a little bit. I think it may caused by different drawing functions labelimg using while/after creating the box. Before you release your mouse left button, the shape is not add to canvas.shapes list yet. So canvas class draws the box using p.drawRect(leftTop.x(), LeftTop.y(), rectWidth, rectHeight) However after the the mouse is released, the shape is inserted to canvas.shapes. And canvas will call each shape's own paint() function to draw the box. In shape.paint(), it using QpainterPath API to draw the the vertexes and lines separately. These two functions may have different behaviors.

I hope somebody familiar with QT can look into this issue.

sunnyzhong812 commented 3 years ago

@tzutalin Is there a solution later? I download from July's version.

sunnyzhong812 commented 3 years ago

I found that this happens when the viewing ratio ends at 1, 2, 6 and 7. But I don't know how can solve this problem.

sunnyzhong812 commented 3 years ago

I found that this happens when the viewing ratio ends at 1, 2, 6 and 7. But I don't know how can solve this problem.

I think it's ok.

def addZoom(self, increment=10):
    zoom_adj=str(self.zoomWidget.value() + increment)
    if zoom_adj[-3]=='1' or zoom_adj[-3]=='2' or zoom_adj[-3]=='6' or zoom_adj[-3]=='7':
        self.setZoom(self.zoomWidget.value() + increment + 1)
    else:
        self.setZoom(self.zoomWidget.value() + increment)