ashwin-pajankar / Python-OpenCV3

Initial Publish... Yet to add the code...
131 stars 110 forks source link

OpenCV:How do I draw a circle with increasing/decreasing radius? #2

Open abunesh opened 6 years ago

abunesh commented 6 years ago

oops sorry, i forgot to add descriptions. I was looking at this tutorial of yours Python-OpenCV3/01# Basics/prog12.py i was wondering if i could change the function of the mousewheel so that once i have an initial circle by clicking the left mouse button, i can change its size by scrolling the mouse wheel.

ashwin-pajankar commented 6 years ago

Yes. Try that and let me know too.

Warm Regards, Ashwin Pajankar Polymath: Science Popularizer | Programmer | Maker | Author | Youtuber www.AshwinPajankar.com www.youtube.com/user/AshwinPajankar

On Thu, May 17, 2018 at 1:25 PM, abunesh notifications@github.com wrote:

oops sorry, i forgot to add descriptions. I was looking at this tutorial of yours Python-OpenCV3/01# Basics/prog12.py i was wondering if i could change the function of the mousewheel so that once i have an initial circle by clicking the left mouse button, i can change its size by scrolling the mouse wheel.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ashwin-pajankar/Python-OpenCV3/issues/2#issuecomment-389778571, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ_iLfN4gfL9bukn51Pd7QH0Pgx6-dGgks5tzS0EgaJpZM4UCkzE .

abunesh commented 6 years ago

hey ive been trying to achieve that but to no avail. Here's my function which i have written; it would be great if you could have a look and tell me what i am doing wrong?(newbie so the errors might be glaring)

def draw_circle(event, x, y, flags, param):
    r=30
    r=r+5
    if event == cv2.EVENT_LBUTTONDOWN:
        cv2.circle(img, (x,y), 30, (255, 0,), 1)
        if event == cv2.EVENT_MOUSEWHEEL:
            cv2.circle(img, (x, y), r, (255, 0,), 1)
        elif event == cv2.EVENT_MBUTTONDOWN:
            break