Support openPrevious function

This commit is contained in:
tzutalin 2015-11-21 17:39:40 +08:00
parent db2a223cc3
commit 76b610aa6d
3 changed files with 41 additions and 7 deletions

View File

@ -17,7 +17,7 @@ In order to build the resource and assets, you need to install pyqt4-dev-tools:
`$ sudo apt-get install pyqt4-dev-tools`
## Usage
After cloning the code, you should run `make` to generate the resource file.
After cloning the code, you should run `make all` to generate the resource file.
You can then start annotating by running `./labelImg.py`. For usage
instructions you can see [Here](https://youtu.be/p0nR2YsCY_U)
@ -30,6 +30,18 @@ You can also see [ImageNet Utils](https://github.com/tzutalin/ImageNet_Utils) to
You can edit the [data/predefined_classes.txt](https://github.com/tzutalin/labelImg/blob/master/data/predefined_classes.txt) to load pre-defined classes
### General steps from scratch
* Build and launch. `make all; python labelImg.py`
* Click 'Change default saved annotation folder' in Menu/File
* Click 'Open Dir'
* Click 'Create RectBox'
The annotation will be saved to the folder you specifiy
### Hotkeys
* Ctrl + r : Change the defult target dir which saving annotation files
@ -39,3 +51,5 @@ You can edit the [data/predefined_classes.txt](https://github.com/tzutalin/label
* Ctrl + s : Save
* n : Next image
* p : Previou image

View File

@ -142,6 +142,9 @@ class MainWindow(QMainWindow, WindowMixin):
openNextImg = action('&Next Image', self.openNextImg,
'n', 'next', u'Open Next')
openPrevImg = action('&Prev Image', self.openPrevImg,
'p', 'prev', u'Open Prev')
save = action('&Save', self.saveFile,
'Ctrl+S', 'save', u'Save labels to file', enabled=False)
saveAs = action('&Save As', self.saveFileAs,
@ -278,7 +281,7 @@ class MainWindow(QMainWindow, WindowMixin):
self.tools = self.toolbar('Tools')
self.actions.beginner = (
open, opendir, openNextImg, save, None, create, copy, delete, None,
open, opendir, openNextImg, openPrevImg, save, None, create, copy, delete, None,
zoomIn, zoom, zoomOut, fitWindow, fitWidth)
self.actions.advanced = (
@ -347,10 +350,6 @@ class MainWindow(QMainWindow, WindowMixin):
self.populateModeActions()
#self.firstStart = True
#if self.firstStart:
# QWhatsThis.enterWhatsThisMode()
## Support Functions ##
def noShapes(self):
@ -822,6 +821,19 @@ class MainWindow(QMainWindow, WindowMixin):
if not self.mayContinue():
return
if len(self.mImgList) <= 0:
return
if self.filename is None:
return
currIndex = self.mImgList.index(self.filename)
if currIndex -1 >= 0:
filename = self.mImgList[currIndex-1]
if filename:
self.loadFile(filename)
def openNextImg(self, _value=False):
# Proceding next image without dialog if having any label
@ -834,7 +846,14 @@ class MainWindow(QMainWindow, WindowMixin):
if len(self.mImgList) <= 0:
return
filename = self.mImgList.pop(0)
if self.filename is None:
filename = self.mImgList[0]
else:
currIndex = self.mImgList.index(self.filename)
if currIndex + 1 < len(self.mImgList):
filename = self.mImgList[currIndex+1]
if filename:
self.loadFile(filename)

View File

@ -26,6 +26,7 @@
<file alias="zoom-out">icons/zoom-out.png</file>
<file alias="delete">icons/cancel.png</file>
<file alias="next">icons/next.png</file>
<file alias="prev">icons/prev.png</file>
</qresource>
</RCC>