python - Select rectangle interactively and obtain corner coods opencv -


I am trying to realize the virtualized partition, with opencv and functions available from the implementation.

In the code as shown here

  import as NP import cv2 from matplotlib import pipette as plt img = cv2.imread ('messi5.jpg ') Mask = np.zeros (img.shape [: 2], Np.uint8) bgdModel = np.zeros ((1,65), np.float64) fgdModel = np.zeros ((1,65), np. Float64) rect = (5050450,290) cv2.grabCut (IMG), Mask, Racket, BGD MODEL, FGD Model, 5, CV2. GcinidiWTNIT) Mask2 = NP where ((mask == 2) | (mask == 0), 0,1). STCPEE ('UIT8') IMG = IMG * Mask 2 [:,:, np.newaxis] plt.imshow (img), plt.colorbar (), plt.show ()  

However, as you can see in the code, rectangular coordinates are hard coded I want to select a rectangle by interaction by displaying the input image and using the rectangle corner of the rectangle for further processing. There's something very new for both Python and OpenCivi. I'm trying here, but there is a lot of help you need to thank in advance.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -