Skip to content

Commit

Permalink
Merge pull request #4 from labadze/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
labadze authored Oct 30, 2022
2 parents 3038f52 + d727f05 commit b4d3381
Show file tree
Hide file tree
Showing 5 changed files with 650 additions and 739 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Annotation Tool V 0.0.1

This is very simple annotation tool, with minimum 3rd party libraries, based on HTML/CSS/JS & Python (Flask).

For annotation manipulations used `interact.js`.
This is very simple annotation tool, with minimum 3rd party libraries, based on CANVAS HTML/CSS/JS & Python (Flask).

To generate image list place your images to `static/img` it's much better to keep unix type file names (snake_case without special symbols).
Right now `.PNG`, `JPG`, `JPEG` formats are supported.
Expand All @@ -11,7 +9,7 @@ Make sure that `data.json` exists in the project root.

You can view detailed video presentation here.

## One time setup
## First and One time setup

To run application you need one time setup per machine.

Expand Down Expand Up @@ -80,10 +78,11 @@ All images supported by browsers can be used, now it's tested with file types: `
├── ...
├── static # Static folder files and folders located here are accessable for browsers
│ ├── img # !!!IMPORTTANT!!! Your content (IMAGES) must be here...
│ ├── favicon.con # Favicon file
│ ├── snackbar.css # Snackbar styles file
│ └── w3.css # Stylesheet CSS for goo visual
├── templates # Here are files which python renders in browser
│ └── index.html # Main file which is shown for user at start, most operations are called from here
├── tests # Test running via pytest engine
├── .gitignore # Requered to prevent load venv to git repository
├── app.py # Programmatically everything nice happens here
├── data.json # Here is stored annotations data, coordinates, other values including image names from img folder
Expand Down
5 changes: 5 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,5 +187,10 @@ def render():
return flask.render_template("index.html")


@app.route('/test', methods=['GET'])
def render_test():
return flask.render_template("test.html")


if __name__ == '__main__':
app.run(use_reloader=True)
273 changes: 87 additions & 186 deletions data.json
Original file line number Diff line number Diff line change
@@ -1,218 +1,119 @@
[
{
"id": 1666944855514,
"img_path": "Peter_Gric_(28).jpg",
"annotations": [
{
"annotation_id": "annotation2",
"styles": "translate(' + 522 + 'px,' + 264 + 'px)",
"x": 522,
"y": 264,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 2"
},
{
"annotation_id": "annotation1",
"styles": "translate(' + 520 + 'px,' + 16 + 'px)",
"x": 520,
"y": 16,
"dx": -2,
"dy": 0,
"width": 190.1999969482422,
"height": 70,
"annotation_text": "Annotation Text 1"
},
{
"annotation_id": "annotation0",
"styles": "translate(' + 393 + 'px,' + 193 + 'px)",
"x": 393,
"y": 193,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 0"
}
]
},
{
"id": 1666944286669,
"img_path": "Peter_Gric_Tutt'Art@_(18).jpg",
"id": 1667080811344,
"img_path": "gric-peter.jpg",
"annotations": [
{
"annotation_id": "annotation1",
"styles": "translate(' + 572 + 'px,' + 85 + 'px)",
"x": 572,
"y": 85,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 1"
"id": "1667080810320",
"x1": 55,
"y1": 77,
"x2": 122,
"y2": 127,
"lineWidth": 1,
"color": "green",
"annotationText": "Annotation Text 1"
}
]
},
{
"id": 1666944276989,
"img_path": "Peter_Gric_Tutt'Art@_(18).jpg",
"id": 1667080790270,
"img_path": "Peter_Gric_(28).jpg",
"annotations": [
{
"annotation_id": "annotation1",
"styles": "translate(' + 572 + 'px,' + 85 + 'px)",
"x": 572,
"y": 85,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 1"
"id": "1667080786295",
"x1": 96,
"y1": 107,
"x2": 293,
"y2": 191,
"lineWidth": 1,
"color": "green",
"annotationText": "Annotation Text 1"
},
{
"annotation_id": "annotation2",
"styles": "translate(' + 0 + 'px,' + -270 + 'px)",
"x": 0,
"y": -270,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 2"
"id": "1667080789046",
"x1": 163,
"y1": 239,
"x2": 332,
"y2": 326,
"lineWidth": 1,
"color": "DeepSkyBlue",
"annotationText": "Annotation Text 2"
}
]
},
{
"id": 1666944235966,
"img_path": "img1.jpg",
"id": 1667080772644,
"img_path": "Peter_Gric_Tutt'Art@(19).jpg",
"annotations": [
{
"annotation_id": "annotation0",
"styles": "translate(' + 423 + 'px,' + 130 + 'px)",
"x": 423,
"y": 130,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 0"
"id": "1667080724234",
"x1": 133,
"y1": 66,
"x2": 366,
"y2": 217,
"lineWidth": 1,
"color": "red",
"annotationText": "Annotation Text 0"
},
{
"annotation_id": "annotation2",
"styles": "translate(' + 845 + 'px,' + 59 + 'px)",
"x": 845,
"y": 59,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 2"
"id": "1667080727522",
"x1": 493,
"y1": 66,
"x2": 640,
"y2": 159,
"lineWidth": 1,
"color": "red",
"annotationText": "Annotation Text 0"
},
{
"annotation_id": "annotation1",
"styles": "translate(' + 411 + 'px,' + 237 + 'px)",
"x": 411,
"y": 237,
"dx": 0,
"dy": 2,
"width": 159.1999969482422,
"height": 95,
"annotation_text": "Annotation Text 1"
}
]
},
{
"id": 1666942341190,
"img_path": "Peter_Gric_Tutt'Art@(19).jpg",
"annotations": [
{
"annotation_id": "annotation2",
"annotation_text": "Annotation Text 2",
"dx": 0,
"dy": 0,
"styles": "translate(' + 410 + 'px,' + 147 + 'px)",
"x": 410,
"y": 147
"id": "1667080736292",
"x1": 1024,
"y1": 133,
"x2": 1135,
"y2": 258,
"lineWidth": 1,
"color": "red",
"annotationText": "Annotation Text 0"
},
{
"annotation_id": "annotation1",
"annotation_text": "Annotation Text 1",
"dx": 0,
"dy": 0,
"styles": "translate(' + 452 + 'px,' + 78 + 'px)",
"x": 452,
"y": 78
}
]
},
{
"id": 1666942334212,
"img_path": "Peter_Gric_Tutt'Art@(19).jpg",
"annotations": [
{
"annotation_id": "annotation2",
"styles": "translate(' + 417 + 'px,' + 76.33334350585938 + 'px)",
"x": 417,
"y": 76.33334350585938,
"dx": 2,
"dy": 1,
"width": 218.1999969482422,
"height": 111,
"annotation_text": "Annotation Text 2"
"id": "1667080739756",
"x1": 156,
"y1": 325,
"x2": 402,
"y2": 447,
"lineWidth": 1,
"color": "green",
"annotationText": "Annotation Text 1"
},
{
"annotation_id": "annotation1",
"styles": "translate(' + 677 + 'px,' + 74 + 'px)",
"x": 677,
"y": 74,
"dx": 6,
"dy": 4,
"width": 228.1999969482422,
"height": 134,
"annotation_text": "Annotation Text 1"
}
]
},
{
"id": 1666942140836,
"img_path": "img13.png",
"annotations": [
{
"annotation_id": "annotation2",
"styles": "translate(' + 425 + 'px,' + 219 + 'px)",
"x": 425,
"y": 219,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 2"
"id": "1667080741503",
"x1": 511,
"y1": 357,
"x2": 715,
"y2": 448,
"lineWidth": 1,
"color": "green",
"annotationText": "Annotation Text 1"
},
{
"annotation_id": "annotation0",
"styles": "translate(' + 736 + 'px,' + 187 + 'px)",
"x": 736,
"y": 187,
"dx": 0,
"dy": 0,
"annotation_text": "Annotation Text 0"
}
]
},
{
"id": 1666941649938,
"img_path": "gric-peter.jpg",
"annotations": [
{
"annotation_id": "annotation2",
"annotation_text": "Annotation Text 2",
"dx": 0,
"dy": 0,
"styles": "translate(' + 351 + 'px,' + -4.666656494140625 + 'px)",
"x": 351,
"y": -4.666656494140625
}
]
},
{
"id": 1666941447306,
"img_path": "images.jpeg",
"annotations": [
"id": "1667080766239",
"x1": 278,
"y1": 566,
"x2": 571,
"y2": 701,
"lineWidth": 1,
"color": "DeepSkyBlue",
"annotationText": "Annotation Text 2"
},
{
"annotation_id": "annotation1",
"styles": "translate(' + 433 + 'px,' + 25 + 'px)",
"x": 433,
"y": 25,
"dx": 0,
"dy": 2,
"width": 159.1999969482422,
"height": 117.83334350585938,
"annotation_text": "Annotation Text 1"
"id": "1667080768312",
"x1": 747,
"y1": 581,
"x2": 903,
"y2": 669,
"lineWidth": 1,
"color": "DeepSkyBlue",
"annotationText": "Annotation Text 2"
}
]
}
Expand Down
45 changes: 45 additions & 0 deletions static/snackbar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* The snackbar - position it at the bottom and in the middle of the screen */
#snackbar {
visibility: hidden; /* Hidden by default. Visible on click */
min-width: 250px; /* Set a default minimum width */
margin-left: -125px; /* Divide value of min-width by 2 */
background-color: #333; /* Black background color */
color: #fff; /* White text color */
text-align: center; /* Centered text */
border-radius: 2px; /* Rounded borders */
padding: 16px; /* Padding */
position: fixed; /* Sit on top of the screen */
z-index: 1; /* Add a z-index if needed */
left: 50%; /* Center the snackbar */
bottom: 30px; /* 30px from the bottom */
}

/* Show the snackbar when clicking on a button (class added with JavaScript) */
#snackbar.show {
visibility: visible; /* Show the snackbar */
/* Add animation: Take 0.5 seconds to fade in and out the snackbar.
However, delay the fade out process for 2.5 seconds */
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

/* Animations to fade the snackbar in and out */
@-webkit-keyframes fadein {
from {bottom: 0; opacity: 0;}
to {bottom: 30px; opacity: 1;}
}

@keyframes fadein {
from {bottom: 0; opacity: 0;}
to {bottom: 30px; opacity: 1;}
}

@-webkit-keyframes fadeout {
from {bottom: 30px; opacity: 1;}
to {bottom: 0; opacity: 0;}
}

@keyframes fadeout {
from {bottom: 30px; opacity: 1;}
to {bottom: 0; opacity: 0;}
}
Loading

0 comments on commit b4d3381

Please sign in to comment.