Add Zoom to rectangle by default

This commit is contained in:
Benjamin Loison 2024-04-26 01:49:57 +02:00
parent f5c235c3cd
commit 56037b058b
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -5,6 +5,8 @@ import matplotlib.image as mpimg
import os
from tqdm import tqdm
# `Zoom to rectangle` shortcut is `o`.
os.chdir('flat-field/TIF')
fileNames = os.listdir()[:3]
@ -17,24 +19,26 @@ def displayImage():
if len(fileNames) > fileNameIndex:
fileName = fileNames[fileNameIndex]
image = mpimg.imread(fileName)
plt.imshow(image)
fig, ax = plt.subplots()
ax.imshow(image)
fileNameIndex += 1
plt.connect('button_press_event', onClick)
mng = plt.get_current_fig_manager()
mng.full_screen_toggle()
plt.show()
fig.canvas.toolbar.zoom()
fig.show()
def onClick(event):
global xys
if event.button is MouseButton.RIGHT:
xy = [event.x, event.y]
xys += [xy]
#print(fileNameIndex, xy)
plt.close()
displayImage()
progressBar.update(1)
#print(fileName)
displayImage()