forked from pn2q95w37/XL
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
550 B
16 lines
550 B
from cv2 import selectROI,imwrite
|
|
from PyQt5.QtWidgets import QMainWindow, QFileDialog
|
|
|
|
|
|
class childwindow1(QMainWindow):
|
|
def __init__(self,parent=None):
|
|
super(childwindow1, self).__init__(parent)
|
|
def openfile(self):
|
|
fname, _ = QFileDialog.getOpenFileName(self, 'Open file', '.', 'Image Files(*.jpg *.bmp *.png *.jpeg *.rgb *.tif)')
|
|
return fname
|
|
def selectROI(self,img):
|
|
bbox = selectROI(img, False)
|
|
cut = img[bbox[1]:bbox[1] + bbox[3], bbox[0]:bbox[0] + bbox[2]]
|
|
imwrite('cut.jpg', cut)
|
|
|