Home > database >  how to zoom in and zoom out on image in opencv python with mouse wheel?
how to zoom in and zoom out on image in opencv python with mouse wheel?

Time:09-26

I have this python code

I need to can zoom in and zoom out on this image with mouse wheel

I am sure this is question of many people - solve this problem can solve their problem too

import cv2

if __name__ == '__main__' :


 im_dst = cv2.imread('C:/11.jpg')
 cv2.imshow('Image',im_dst)

I could find a way for zoom on normal image window with mouse in python by search , but it could not work on opencv window

i searched 2days on internet but i could not find a correct way (i found a way for old opencv (not cv2)) but it could not work with new opencv

any help is welcomed thanks

CodePudding user response:

# in terminal: pip install mouse
import mouse

if mouse.wheel(1) # Zoom in / mouse wheel up
    # change the image size
if mouse.wheel(-1) # Zoom out / mouse wheel down
    # change the image size
  • Related