Skip to content

Commit

Permalink
Undo functionality added
Browse files Browse the repository at this point in the history
  • Loading branch information
RRMoelker committed Jul 19, 2018
1 parent 5082b30 commit 2dfebb3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Build files
/CMakeCache.txt
/CMakeFiles/
/Makefile
/cmake_install.cmake
/yolo_mark
11 changes: 10 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ std::atomic<bool> clear_marks;
std::atomic<int> x_start, y_start;
std::atomic<int> x_end, y_end;
std::atomic<int> x_size, y_size;
std::atomic<bool> draw_select, selected;
std::atomic<bool> draw_select, selected, undo;

std::atomic<int> add_id_img;
Rect prev_img_rect(0, 0, 50, 100);
Expand Down Expand Up @@ -472,6 +472,11 @@ int main(int argc, char *argv[])
rectangle(frame, rect_dst, color, 2);
}

if (undo) {
undo = false;
full_image.copyTo(full_image_roi);
current_coord_vec.pop_back();
}

if (selected)
{
Expand Down Expand Up @@ -656,6 +661,10 @@ int main(int argc, char *argv[])

switch (pressed_key)
{
case 122: // z
undo = true;
break;

case 32: // SPACE
case 1048608: // SPACE
++trackbar_value;
Expand Down

0 comments on commit 2dfebb3

Please sign in to comment.