Ready for pointing
This commit is contained in:
parent
981e2a48ae
commit
ab72da470e
@ -3,17 +3,38 @@ import numpy as np
|
||||
from matplotlib.backend_bases import MouseButton
|
||||
import matplotlib.image as mpimg
|
||||
import os
|
||||
from tqdm import tqdm
|
||||
|
||||
os.chdir('flat-field/TIF')
|
||||
|
||||
def onClick(event):
|
||||
if event.button is MouseButton.LEFT:
|
||||
print(event.x, event.y)
|
||||
plt.close()
|
||||
fileNames = os.listdir()[:3]
|
||||
fileNameIndex = 0
|
||||
xys = []
|
||||
progressBar = tqdm(total = len(fileNames))
|
||||
|
||||
for fileName in os.listdir():
|
||||
print(fileName)
|
||||
image = mpimg.imread(fileName)
|
||||
plt.imshow(image)
|
||||
plt.connect('button_press_event', onClick)
|
||||
plt.show(block = True)
|
||||
def displayImage():
|
||||
global fileNameIndex
|
||||
if len(fileNames) > fileNameIndex:
|
||||
fileName = fileNames[fileNameIndex]
|
||||
image = mpimg.imread(fileName)
|
||||
plt.imshow(image)
|
||||
fileNameIndex += 1
|
||||
plt.connect('button_press_event', onClick)
|
||||
|
||||
mng = plt.get_current_fig_manager()
|
||||
mng.full_screen_toggle()
|
||||
|
||||
plt.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()
|
Loading…
Reference in New Issue
Block a user