Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Zoom in image to retrieve pixel coordinates

I would like to know if there is something I can do to zoom in the image I'm working with to select double clicked points I want to get coordinates from. It's for high-res images, I'd like more precision. Scale factor 1 image pixel = 1 screen pixel would be fine to reach.

Here's the current code:

image_points= list()

def grep_pos(event,x,y,flags,param):
    if event == cv2.EVENT_LBUTTONDBLCLK:
        cv2.circle(imgcolor,(x,y),10,(255,255,0),-1)
        image_points.append((x,y))
    if event == cv2.EVENT_MOUSEWHEEL:
        a="maybe do stuff here to zoom, but how ?"


cv2.namedWindow('image',cv2.WINDOW_NORMAL)
cv2.setMouseCallback('image',grep_pos)
while(1):
    cv2.imshow('image',imgcolor)
    if cv2.waitKey(20) & 0xFF == 27:
        break

cv2.destroyAllWindows()

And what is the part & 0xFF == 27 for? `

Zoom in image to retrieve pixel coordinates

I would like to know if there is something I can do to zoom in the image I'm working with to select double clicked points I want to get coordinates from. It's for high-res images, I'd like more precision. Scale factor 1 image pixel = 1 screen pixel would be fine to reach.

Here's the current code:

image_points= list()

def grep_pos(event,x,y,flags,param):
    if event == cv2.EVENT_LBUTTONDBLCLK:
        cv2.circle(imgcolor,(x,y),10,(255,255,0),-1)
        image_points.append((x,y))
    if event == cv2.EVENT_MOUSEWHEEL:
        a="maybe do stuff here to zoom, but how ?"


cv2.namedWindow('image',cv2.WINDOW_NORMAL)
cv2.setMouseCallback('image',grep_pos)
while(1):
    cv2.imshow('image',imgcolor)
    if cv2.waitKey(20) & 0xFF == 27:
        break

cv2.destroyAllWindows()

And what is the part & 0xFF == 27 for? `for?

Zoom in image to retrieve pixel coordinates

I would like to know if there is something I can do to zoom in the image I'm working with with?
It is
to select some double clicked points I want to get coordinates from. grab their coordinates.
It's mainly for high-res images, images on which I'd like more precision.
Scale factor 1 image pixel = 1 screen pixel would be fine to reach.

Here's the current code:

image_points= list()

def grep_pos(event,x,y,flags,param):
    if event == cv2.EVENT_LBUTTONDBLCLK:
        cv2.circle(imgcolor,(x,y),10,(255,255,0),-1)
        image_points.append((x,y))
    if event == cv2.EVENT_MOUSEWHEEL:
        a="maybe do stuff here to zoom, but how ?"


cv2.namedWindow('image',cv2.WINDOW_NORMAL)
cv2.setMouseCallback('image',grep_pos)
while(1):
    cv2.imshow('image',imgcolor)
    if cv2.waitKey(20) & 0xFF == 27:
        break

cv2.destroyAllWindows()

And what is the part & 0xFF == 27 for?

Zoom in image to retrieve pixel coordinates

I would like to know if there is something I can do to zoom in the image I'm working with?
It is to select some double clicked points I want to grab their coordinates.
It's mainly for high-res images on which I'd like more precision.
Scale factor 1 image pixel = 1 screen pixel would be fine to reach.

Here's the current code:

image_points= list()

image_points= list()
def grep_pos(event,x,y,flags,param):
    if event == cv2.EVENT_LBUTTONDBLCLK:
        cv2.circle(imgcolor,(x,y),10,(255,255,0),-1)
        image_points.append((x,y))
    if event == cv2.EVENT_MOUSEWHEEL:
        a="maybe do stuff here to zoom, but how ?"


cv2.namedWindow('image',cv2.WINDOW_NORMAL)
cv2.setMouseCallback('image',grep_pos)
while(1):
    cv2.imshow('image',imgcolor)
    if cv2.waitKey(20) & 0xFF == 27:
        break

cv2.destroyAllWindows()

And what is the part & 0xFF == 27 for?