Commit Graph

128 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 1fca69f0b3 actually find nearest point of shape (#889)
For any shape with a dimension smaller than 2*epsilon, there can be
multiple potential points to select from. In practice this resulted
in e.g. the top right corner being highlighted when the cursor was
placed below the bottom right corner.
2022-06-12 10:03:14 -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
tzutalin 0f111e643a Change locale.getlocale() to locale.getdefaultlocale() 2022-03-07 17:54:53 -08:00
Paul Anton Letnes ca3a3accdd remove unused import statements (#845)
To reduce clutter, all unused imports were removed. On the affected
files, imports were also reordered to be PEP8 sorted.
2022-02-17 11:18:21 -08:00
Aditya Kumar 276f40f5e5 Modified the default label text box into a drop down (#824)
* Modified the default label text box into a drop down

* Unchecked the box at startup

* Removed commented code

* Removed unnecessary update method for the combobox

* Changed naming style for class
2022-01-26 08:18:13 -08: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
tzutalin 1ab8241d0e bump version to 1.8.6 2021-10-11 13:15:19 -07: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
ngc92 58406b578a adds a utility function to hide a QT5/QT4 discrepancy (#765)
Co-authored-by: erik <ersre>
2021-07-25 09:09:01 -07:00
WEN Hao 91c23d0a9d Use webbrowser instead of get_available_screencast_viewer (#745)
* improve opening tutorial

* improve show_tutorial_dialog

* improve show_tutorial_dialog

* remove not implemented

* remove unncessary package QtWebEngineWidgets

* remove commented import of QtWebEngineWidgets
2021-05-11 09:20:54 -07:00
tzutalin 0c09c7c5d1 Bump to 1.8.5 2021-04-11 22:36:08 -07:00
Denis 62585531ca Fix incorrect path handling (#731)
* Fix incorrect save dir path handling for ML format.

Save dir path was split by incorrect os.dependent separator '/'
which was the cause of labels being saved to parent folder.

* Implement path normalization for command arguments.

Renamed 'predefined_classes_file' parameter to 'class_file'.
2021-04-07 22:01:55 -07:00
Denis 0573a39ec3 Fix rounding issue that caused 1px box shift for YOLO format. (#730) 2021-04-06 16:38:48 -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
tzutalin e1c67fc0c3 Bump to 1.8.4 2020-11-14 23:17:25 -08:00
enicck 31463497c8 Adds create-ml format support (#651)
* adds createMl reader & writer class

* adds getFormatMeta function to support more than two save_format

* adds CreateML read & write support

* adds format CreateML icon

* fixes negative height/width

* removes type hints

* fixes coordinate calculation

* adds unit test

* removes typehint
2020-10-02 06:56:07 -07:00
EuihyunLee 058d7a7e80 Read via QImageReader (#650)
* Now read via QImageReader

* Remove comment-out unused lines
2020-09-26 11:03:04 -07:00
Chris Rapson (AT) 544cfb9e3c adjust position of popup labelDialog to make sure it is within edge of main window 2020-09-12 00:15:20 -07:00
Chris Rapson (AT) 5a7e3f8f4e allow panning by clicking and dragginng outside existing boxes 2020-09-12 00:15:20 -07:00
tzutalin f387c5932b use enum for label file formats 2020-08-02 00:14:18 -07:00
Laszlo Treszkai 196bd46828 Save used labeling format in settings 2020-08-01 23:44:36 -07:00
stephi 7cc5241664 strip string of detection values 2020-07-01 17:13:52 -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 a1a32f6230 Update README.md and setup.py 2019-05-25 21:15:17 -07:00
tzutalin 5b9d2bf9b6 Update setup.py 2019-05-25 14:29:16 -07:00
tzutalin 8689a16f3d By default, use py3 qt5 to build 2019-05-25 14:14:49 -07:00
tzutalin ca28daddec Rename lib.py to utils.py and add test cases for natural sort 2019-01-26 23:16:21 -08:00
Joakim Eriksson c2aca6e1d3 added float parsing before int conversion to enable support of VOC files that specify coordinates in float 2019-01-05 00:33:54 -08:00
Lieven Govaerts 4bb6be6986 Ensure a vertex always stays within the boundaries of the canvas. 2019-01-03 22:48:13 -08:00
yangjiangjie a0fa187eff Update ustr.py 2019-01-03 22:06:57 -08:00
tzutalin d27e6a5dfa fix the crash when providing invalid locale in env 2018-12-28 10:07:59 -08:00
tzutalin 3f14cbf451 Update the version to v1.8.1 2018-12-02 21:21:00 -08:00
tzutalin 255afca1b3 Fix empty locale on windows platform 2018-12-02 21:10:15 -08:00
tzutalin eaac031404 Move icons to resource folder, fix the unicode issue, support zh-tw lang 2018-12-01 00:45:50 -08:00
tzutalin 699125aa5c workaroud for failure of loading setting 2018-11-18 09:51:24 -08:00
tzutalin 2df7b6e402 Fix issue serializing qstring in pscal_voc_io.py 2018-11-18 09:28:38 -08:00
tzutalin f563c164d0 Create a const for encoding and fix an issue in yolo format according to pr#387 2018-11-04 20:13:34 -08:00
tzutalin d14d3b06df Update v1.8.0 2018-10-21 21:39:14 -07:00
Antoine Broyelle 4e278bb511 feature: draw square bounding boxes 2018-10-19 23:32:18 -07:00
ap193uee c88eb28e7c Added offset to label's y-pos so that the label does not overflow the image (#324) 2018-07-09 19:48:57 -07:00
vdalv 4f84f68b96 Fix issue #287 and a typo 2018-06-23 01:14:30 -07:00
wenliwyan 5f9f17f9b4 Add item single click slot in labelDialog.py (#312)
* Add item single click slot in labelDialog.py

In the original code, double clicking a list item will set the text property and automatically validate afterwards, with the label dialog window disappearing.

In this revised version, double click behavior is unchanged, while single click is added. When single clicking a list item, it will only set text in the QLineEdit. Users can change the text by clicking other items before validating themselves by clicking yes.
2018-06-13 21:13:28 -07:00