osx - How do I draw a single circle on a frame in OpenCV/Python while continuously updating the x-y position and redrawing? -
I want to draw a circle on the first frame of a video based on a mouse click, and if the cycle is refreshed The user selects another position (i.e. only one circle should be drawn on the frame at a time). To do this, I copy the original image after the initial frame capture, and each time it returns to a new circle before it is ready.
In my real code, XOPS and UPS mouse click and radius in the trackbar input, but below I have extended the X and Y systematically whereas for simplicity inside the loop (the codes given below are still Are not expected).
What do I get from this code? This is a bunch of circles drawn on the first frame, not once, as I had expected
firstname = 1 cv2 .nameWindow ('test') cap = cv2.VideoCapture ('video.mp4') if cap.isOpened (): ret, originalframe = cap.read () # frame 1 frame = read the original cap cap .release () xpos = 10 ypos = 10 while (first frame == 1): frame = original frame # original frame cv2.circle (frame, (xops, UPS), 100, (0, 255, 1), thickness = 1, line type = 8 , Change = 0) #draw circle xpos = xpos +10 #move circle pos ypos = ypos + 10 #move Rkl pos cv2.imshow ( 'test', frame) # draw if cv2.waitKey (33) & amp; 0xFF == Ord (''): #Hit space-bar when done ... first line = 0
This is a crop screenshot of output - too many circles:
I Running Mac OS X 10.9W / Python / OpenCV2
frame = defaultframe
only frame
Code> Original Frame . Right now in your code, the circle is drawn to the original data!
You will have to make a copy of the data for frame
:
- Clone Image: Clone an IplImage in another IplImage.
- Clonmet: Clone one mat type in another type of mill.
- Cc: Copy the data, if the header is already defined. / Li>
Comments
Post a Comment