Can you display an image at specific screen coordinates with opencv?

Viewed 1389

I am writing some code in Python using OpenCV that takes a series of images and processes them. I display the image and the processed image for each image received. My code to display the images is something like this:

# Get an image and processes it
cv2.imshow('Raw Image', img)
cv2.imshow('Partially Processed Image', partially_processed_image)
cv2.imshow('Processed Image', processed_image)
cv2.waitkey(0)

# Save result and repeat back through for another image

This puts the images all in the same place in the screen on top of each other. Is there a way in OpenCV to display images to different screen locations (so they don't automatically display on top of each other)? I looked in the documentation and didn't see anything immediately obvious, but I wondered if there was a work around.

Thanks!

1 Answers

Based on the comment above from Mark Setchell, here is how to display images in OpenCV at specific screen coordinates (check the OpenCV documentation for namedWindow() and moveWindow() for the version you are using):

# Make your windows
cv2.namedWindow('Raw Image', cv2.WINDOW_NORMAL)
cv2.namedWindow('Partially Processed Image', cv2.WINDOW_NORMAL)
cv2.namedWindow('Processed Image', cv2.WINDOW_NORMAL)

# Get your image and process it
# Then display
cv2.imshow('Raw Image', img)
cv2.imshow('Partially Processed Image', partially_processed_image)
cv2.imshow('Processed Image', processed_image)
# Then move your windows to where you want them
cv2.moveWindow('Raw Image', some_x, some_y)
cv2.moveWindow('Partially Processed Image', some_other_x, some_other_y)
cv2.moveWindow('Processed Image', yet_another_x, yet_another_y)
cv2.waitkey(0)
# Save result and repeat back through for another image
Related