Ask Your Question

cv2.selectROIs in PyQt [closed]

asked 2018-11-07 08:24:15 -0500

I'm new in python using opencv and I'm trying to build a program that selecting region of interest (ROI) of an images. I have sample codes but my goal is to have one window form only. Is it possible to display opencv selectROIs in PyQt label or any widgets to have one window form only? Because on my observation it always appear in separate window and once I plot the ROI in an image, it cannot be editable. Please suggest any process or module that will accomplish my target output. Here's my sample code.

def browsefunc():
    filename = filedialog.askopenfilenames(filetypes=(("File", "*.jpg"), ("All Files", "*.*")))
    filelist = list(filename)

    for image in filelist:
    img = cv2.imread(image)
    fromCenter = False

    //My Goal is to have one window only. it is possible to mix the below code to PyQt module to achieve it?
    r = cv2.selectROIs('Select ROIs', img, fromCenter)
edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by berak
close date 2018-11-08 00:16:25.096455


PyQt off topics?

LBerger gravatar imageLBerger ( 2018-11-07 08:35:42 -0500 )edit

^^ somewhat ;)

(but we should at least give an explanation, see below :)

berak gravatar imageberak ( 2018-11-07 08:41:05 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-11-07 08:35:13 -0500

berak gravatar image

updated 2018-11-07 08:41:46 -0500

sorry, but that is not possible.

the internal RoiSelector class needs a window, and mouse/kb events to work this is also done from c++, not python, so impossible to "rewire" it.

either "live with it" as it is now, or you'll have to reinvent (the whole thing) with pyqt means.

edit flag offensive delete link more


Thank you. that's why I'm asking "If it is possible". Anyways, as alternative I tried to build using PyQt and used rubberband as selecting roi. Maybe I will continue to that and study how selectROIs get its region with different aspect of an image. Thank you for the clarifications and help :)

Breakpoint gravatar imageBreakpoint ( 2018-11-07 19:07:51 -0500 )edit

Question Tools

1 follower


Asked: 2018-11-07 08:24:15 -0500

Seen: 357 times

Last updated: Nov 07 '18