Skip to content

Commit

Permalink
image modes in extended zolof initial cal gui
Browse files Browse the repository at this point in the history
  • Loading branch information
ronshnapp committed Oct 22, 2024
1 parent 77f5a91 commit 9c7d966
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions myptv/extendedZolof/gui_intial_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from PIL import Image, ImageTk
from tkinter import Label, Canvas, LabelFrame, Entry, Tk, Scrollbar, Button
from numpy import array
from numpy import array, amax
import os


Expand All @@ -41,7 +41,7 @@ def __init__(self, cam_name, image_name, target_fname):
target_fname - the file name of the calibration target's target file.
'''
self.image_name = image_name
self.image = Image.open(self.image_name)
self.image = Image.open(self.image_name).convert('F')
image_size = self.image.size

self.target_fname = target_fname
Expand Down Expand Up @@ -83,7 +83,7 @@ def __init__(self, cam_name, image_name, target_fname):
# (1) Image frame, first column

# load the image
photo = ImageTk.PhotoImage(self.image)
photo = ImageTk.PhotoImage(Image.fromarray(self.image/amax(self.image)*255))



Expand Down Expand Up @@ -484,11 +484,13 @@ def show_calibration(self):
'''Plots the calibration points images on the calibration image'''

# refresh the image
image = Image.open(self.image_name)
image = Image.open(self.image_name).convert('F')
s = image.size
image = image.resize((int(s[0]*self.z),int(s[1]*self.z)),
Image.ANTIALIAS)
new_bird = ImageTk.PhotoImage(image)
Image.LANCZOS)
#new_bird = ImageTk.PhotoImage(image)
new_bird = ImageTk.PhotoImage(Image.fromarray(image/amax(image)*255))

self.board.configure(image = new_bird)
self.board.image = new_bird
self.canvas.delete('all')
Expand Down Expand Up @@ -630,11 +632,12 @@ def sementImage(self):
self.segmented.append((b[0][1], b[0][0], b[1][1], b[1][0]))

# plot the segmented particles over a refreshed image
image = Image.open(self.image_name)
image = Image.open(self.image_name).convert('F')
s = image.size
image = image.resize((int(s[0]*self.z),int(s[1]*self.z)),
Image.ANTIALIAS)
new_bird = ImageTk.PhotoImage(image)
Image.LANCZOS)
#new_bird = ImageTk.PhotoImage(image)
new_bird = ImageTk.PhotoImage(Image.fromarray(image/amax(image)*255))
self.board.configure(image = new_bird)
self.board.image = new_bird
self.canvas.delete('all')
Expand Down Expand Up @@ -715,11 +718,12 @@ def upKey(self, event):
def zoomIn(self, event):
'''zoom in the image with + key'''
self.z = self.z*1.15
image = Image.open(self.image_name)
image = Image.open(self.image_name).convert('F')
s = image.size
image = image.resize((int(s[0]*self.z),int(s[1]*self.z)),
Image.ANTIALIAS)
new_bird = ImageTk.PhotoImage(image)
Image.LANCZOS)
#new_bird = ImageTk.PhotoImage(image)
new_bird = ImageTk.PhotoImage(Image.fromarray(image/amax(image)*255))
self.board.configure(image = new_bird)
self.board.image = new_bird
self.canvas.delete('all')
Expand All @@ -739,11 +743,12 @@ def zoomIn(self, event):
def zoomIn_btn(self):
'''zoom in the Zoom in button'''
self.z = self.z*1.15
image = Image.open(self.image_name)
image = Image.open(self.image_name).convert('F')
s = image.size
image = image.resize((int(s[0]*self.z),int(s[1]*self.z)),
Image.ANTIALIAS)
new_bird = ImageTk.PhotoImage(image)
Image.LANCZOS)
#new_bird = ImageTk.PhotoImage(image)
new_bird = ImageTk.PhotoImage(Image.fromarray(image/amax(image)*255))
self.board.configure(image = new_bird)
self.board.image = new_bird
self.canvas.delete('all')
Expand All @@ -763,11 +768,12 @@ def zoomIn_btn(self):
def zoomOut(self, event):
'''zoom out with - key'''
self.z = self.z*(1/1.15)
image = Image.open(self.image_name)
image = Image.open(self.image_name).convert('F')
s = image.size
image = image.resize((int(s[0]*self.z),int(s[1]*self.z)),
Image.ANTIALIAS)
new_bird = ImageTk.PhotoImage(image)
Image.LANCZOS)
#new_bird = ImageTk.PhotoImage(image)
new_bird = ImageTk.PhotoImage(Image.fromarray(image/amax(image)*255))
self.board.configure(image = new_bird)
self.board.image = new_bird
self.canvas.delete('all')
Expand All @@ -787,11 +793,12 @@ def zoomOut(self, event):
def zoomOut_btn(self):
'''zoom out with - key'''
self.z = self.z*(1/1.15)
image = Image.open(self.image_name)
image = Image.open(self.image_name).convert('F')
s = image.size
image = image.resize((int(s[0]*self.z),int(s[1]*self.z)),
Image.ANTIALIAS)
new_bird = ImageTk.PhotoImage(image)
Image.LANCZOS)
#new_bird = ImageTk.PhotoImage(image)
new_bird = ImageTk.PhotoImage(Image.fromarray(image/amax(image)*255))
self.board.configure(image = new_bird)
self.board.image = new_bird
self.canvas.delete('all')
Expand Down

0 comments on commit 9c7d966

Please sign in to comment.