Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions script.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import sys
#!/usr/bin/env python3

import cv2 # Opencv ver 3.1.0 used
import numpy as np

# Set recursion limit
sys.setrecursionlimit(10 ** 9)

import selectinwindow

Expand Down
9 changes: 4 additions & 5 deletions selectinwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class DragRectangle:

def __init__(self, Img, windowName, windowWidth, windowHeight):
# Image
self.image = Img
self.original = Img
self.image = self.original.copy()

# Window name
self.wname = windowName
Expand Down Expand Up @@ -124,7 +125,6 @@ def mouseDoubleClick(eX, eY, dragObj):
if dragObj.active:
if pointInRect(eX, eY, dragObj.outRect.x, dragObj.outRect.y, dragObj.outRect.w, dragObj.outRect.h):
dragObj.returnflag = True
cv2.destroyWindow(dragObj.wname)


def mouseDown(eX, eY, dragObj):
Expand Down Expand Up @@ -288,13 +288,12 @@ def straightenUpRect(dragObj):

def clearCanvasNDraw(dragObj):
# Draw
tmp = dragObj.image.copy()
tmp = dragObj.original.copy()
cv2.rectangle(tmp, (dragObj.outRect.x, dragObj.outRect.y),
(dragObj.outRect.x + dragObj.outRect.w,
dragObj.outRect.y + dragObj.outRect.h), (0, 255, 0), 2)
drawSelectMarkers(tmp, dragObj)
cv2.imshow(dragObj.wname, tmp)
cv2.waitKey()
dragObj.image = tmp


def drawSelectMarkers(image, dragObj):
Expand Down