40 Commits

Author SHA1 Message Date
Stefan Breunig
981be1f9c4
consider scale when panning image (#892)
The previous variant calculates the delta by checking how many
"image pixels" the cursor was moved, and then emit an absolute
scrollbar move based on that. However, when zoomed in a single
image pixel can be multiple scroll bar units.

The effect was that panning a zoomed in image was very slow,
giving a rubber band kind of effect. Wiggling the mouse would emit
more deltas, eventually moving the image below the cursor again.

This PR uses the absolute coordinates instead, which keeps the
image closer to the cursor. There is still a slight rubber band
effect, probably due to slight differences between painter and
scroll bar positions/units.

The result is that panning a zoomed in image feels less sluggish.
2022-06-12 10:09:22 -07:00
Stefan Breunig
efd90a481b
also clear highlights when loading a new image (#891)
This fixes a crash with the following steps to reproduce:
1. highlight a vertex or shape with the cursor
2. swap image using keyboard controls (i.e. press D)
3. left click on image without moving cursor. No shape may be below
   cursor.

What happens is that the canvas will emit a selection signal for
the shape from the previous image, which then can't be found anymore
in `shapes_to_items`, causing this error:

```
Traceback (most recent call last):
  File "/home/stefan/code/labelImg/./labelImg.py", line 806, in shape_selection_changed
    self.shapes_to_items[shape].setSelected(True)
KeyError: <libs.shape.Shape object at 0x7fdb281d06a0>
```

This builds upon the fix from #858, which fixed the issue for
selected shapes, but not highlights.
2022-06-12 10:05:42 -07:00
Stefan Breunig
9e06d10b94
prefer selected shape when highlighting vertexes or shapes (#890)
The use case is adjusting shapes by moving their vertexes, even if
they are adjacent or overlapping another shape. Currently always
the "later drawn" shape wins, making it impossible to adjust an
earlier shape without re-creating it. Adjusting existing shapes is
common for review scenarios.

I have experimented with preferring the highlighted shape, but
I found it finicky and less clear as to how the vertex preference
works. JOSM (and OpenStreetMap editor) also uses the "prefer
selected" approach and it works well there.
2022-06-12 10:05:06 -07:00
Stefan Breunig
e2d758f540
add brightness controls (#888)
Closes #860
2022-06-12 10:01:41 -07:00
Zhang Ch. N
861fbe9a2b
UX: Increase size of vertex controls around shape (#863)
* Increase shape vertex control size

* Increase canvas epsilon
2022-04-29 23:38:55 -07:00
Sam.An
5c38b6bcdd
Fix draw annotations error (#833) 2021-12-27 19:05:21 -08:00
Stefan Breunig
9f2765e97b
fix h_vertex being kept after deleting shape, causing a crash if used (#832)
Steps to reproduce this particular issue:

1. draw a box
2. select the box
3. hover over one of the corners as if you want to resize the box (no click needed)
4. press DEL to delete the box
5. left click on the canvas

Note there are two more destructive operations on the canvas' `shape` in
`undo_last_line` and `reset_all_lines`, but former is dead code and latter
I don't know how to trigger. Thus I can't be sure un-highlighting will not
lead to visual glitches.

There are other potential fixes, e.g. checking in `selected_vertex`. I can
rework the patch, but then again, the fix is so straight forward that telling
me is probably more effort than just rewriting it.

See #750
See #605
2021-12-26 20:48:39 -08:00
Tiger Nie
3f53dce960
display bbox width and height while resizing, moving and hovering over (#798)
shape.
2021-10-11 13:04:40 -07:00
Cerno_b
c35f09747a
Pep 8 (#720)
* rename local variables in main file

* additional renaming of functions and variables

* Rename main file functions

* Rename functions and variables in canvas.py

* Rename functions and locals for remaining files

* Rename non-Qt derived class' members

* Rename members of Qt-derived classes

* Fix paint label issue
2021-03-14 16:56:14 -07:00
chenghsiung
5d6557f994
Adaptively adjust label size (#678)
* Adjust label font size based on image size

* Adjust the upper boundary of the painted label

* Set font size based on both image width & height
2021-01-01 11:54:27 -08:00
Chris Rapson (AT)
5a7e3f8f4e allow panning by clicking and dragginng outside existing boxes 2020-09-12 00:15:20 -07:00
tzutalin
500367c550 update strings and removed intersectingEdges 2020-05-18 08:52:42 -07:00
Adwait Bhope
9bebf84986 Change mouse event behaviour for point outside canvas 2020-05-18 08:43:05 -07:00
BIASUTTI Pierre
45078ac670 Added annotation width and height in toolbar while drawing. 2020-02-15 13:48:28 -08:00
tzutalin
ca28daddec Rename lib.py to utils.py and add test cases for natural sort 2019-01-26 23:16:21 -08:00
Lieven Govaerts
4bb6be6986 Ensure a vertex always stays within the boundaries of the canvas. 2019-01-03 22:48:13 -08:00
Antoine Broyelle
4e278bb511 feature: draw square bounding boxes 2018-10-19 23:32:18 -07:00
Tomas Raila
0b20e5c929 Show cursor coordinates in status bar 2018-01-25 12:04:47 +02:00
tzutalin
6cf04adfa5 Assign different labels with different colors 2017-10-23 16:27:40 +08:00
Jaewoo Choi
91a830e01b fix a minor cursor restore bug 2017-09-05 21:39:43 +09:00
Jaewoo Choi
dd09ffb497 Added a feature to draw a box easier 2017-08-30 03:33:07 +09:00
darrenl
79f736139b Merge pull request #151 from jaewchoi/create
Fix a bug: creating a box with one point
2017-08-25 13:47:46 +08:00
Jaewoo Choi
835af44c3a Prevent from creating a zero sized box 2017-08-22 21:28:36 +09:00
Jaewoo Choi
95ff5062fe fix a bug: creating a box with one point 2017-08-22 20:57:05 +09:00
Jaewoo Choi
7b8519f50e fix a bug to select a small bounding box 2017-08-22 14:59:40 +09:00
tzutalin
14edc88a64 Fix runtime errors for py3qt5 2017-07-25 16:43:04 +08:00
tzutalin
26a50c36bc Update README 2017-05-25 09:51:47 +08:00
RegisWANG
2560085e2c Add using arrow key to move the box. 2017-05-24 23:50:32 +08:00
JNKielmann
965f358bfb Fix moving RectBox with right click 2017-05-19 16:21:36 +02:00
darrenl
634fc0c637 Merge pull request #65 from yjmade/master
fix some bugs when running on Mac with PyQT5
2017-03-09 13:07:45 +08:00
Jay Young
3778c43fad [IMP] For PyQt5, make scroll can happen on vertical and horizontal at the same time 2017-03-08 12:35:33 +08:00
Jay Young
f631ce9339 [FIX]in PyQT5, scroll does not work, because PyQT5 deprecated the orientation and delte method under QWheelEvent and replaced by angleDelta, so I add some code to detect what version of qt and use the correspond method to get delta 2017-03-08 12:30:12 +08:00
Thibaut Mattio
3abd685a8d Implement verified feature
When pressing space, the user can flag the image as verified, a green background will appear.
This is used when creating a dataset automatically, the user can then through all the pictures and flag them instead of annotate them.
2017-03-08 11:01:36 +08:00
tzutalin
5a9439be80 Fix the issue about undefined pos variable 2017-03-01 20:13:02 +08:00
Thibaut Mattio
6600f9fe30 Annotate on release mouse 2017-02-28 13:29:56 +08:00
Thibaut Mattio
c5c2a34a39 Apply PEP recommendation on formatting
Running pylint to make the code complient with PEP recommendations on lintage.
2017-02-28 11:50:15 +08:00
Ryan Flynn
2beed27cf2 add support for QT5, fallback to QT4 2017-01-02 21:55:30 -05:00
Ryan Flynn
67a8583e22 conservative conversion of some python2-isms to py3-compatible code 2016-12-31 14:48:17 -05:00
tzutalin
4da87bd622 Avoid to be deformed while resizing it 2015-12-17 13:33:13 +08:00
TzuTa Lin
8d81647864 mv some of python files to libs 2015-09-17 15:22:58 +08:00