map works
This commit is contained in:
parent
96ffc19811
commit
0ca541bcf3
2 changed files with 39 additions and 11 deletions
48
app.py
48
app.py
|
@ -26,21 +26,49 @@ map_widget.pack(fill="both", expand=True)
|
|||
|
||||
|
||||
|
||||
class renderedImageZoom:
|
||||
def __init__(self,root,coords):
|
||||
self.image_window = root
|
||||
|
||||
self.image_window.title("Simulated Sunset")
|
||||
self.image_window.config(width=256,height=256)
|
||||
image = skydome.renderFromCamera(coords)
|
||||
self.canvas = tkinter.Canvas(self.image_window,bg="white")
|
||||
self.canvas.pack(fill=tkinter.BOTH,expand=True)
|
||||
self.img = Image.fromarray(image,mode="RGB")
|
||||
self.tk_image = ImageTk.PhotoImage(width=256,height=256,image=self.img)
|
||||
#img = ImageTk.PhotoImage(Image.open("highpress_camera.png"))
|
||||
|
||||
self.canvas.create_image(0,0, anchor="nw", image=self.tk_image)
|
||||
zoom_in_button = tkinter.Button(self.image_window, text="Zoom In", command=self.zoom_in)
|
||||
zoom_out_button = tkinter.Button(self.image_window, text="Zoom Out", command=self.zoom_out)
|
||||
zoom_in_button.pack(side=tkinter.LEFT)
|
||||
zoom_out_button.pack(side=tkinter.LEFT)
|
||||
|
||||
self.canvas.bind("<Button-4>",self.zoom_in)
|
||||
self.canvas.bind("<Button-5>", self.zoom_out)
|
||||
|
||||
def zoom_in(self, event=None):
|
||||
# Increase the image size by a factor (e.g., 1.2)
|
||||
self.img = self.img.resize((int(self.img.width * 1.2), int(self.img.height * 1.2)))
|
||||
self.tk_image = ImageTk.PhotoImage(self.img)
|
||||
self.canvas.delete("all")
|
||||
self.canvas.create_image(0, 0, anchor=tkinter.NW, image=self.tk_image)
|
||||
|
||||
def zoom_out(self, event=None):
|
||||
# Decrease the image size by a factor (e.g., 0.8)
|
||||
self.img = self.img.resize((int(self.img.width * 0.8), int(self.img.height * 0.8)))#,resampling)
|
||||
self.tk_image = ImageTk.PhotoImage(self.img)
|
||||
self.canvas.delete("all")
|
||||
self.canvas.create_image(0, 0, anchor=tkinter.NW, image=self.tk_image)
|
||||
|
||||
|
||||
|
||||
def show_image(coords):
|
||||
image_window = tkinter.Toplevel()
|
||||
image_window.title("Simulated Sunset")
|
||||
image_window.config(width=256,height=256)
|
||||
#image = skydome.renderFromCamera(coords)
|
||||
#canvas = tkinter.Canvas(image_window,width=256,height=256)
|
||||
#canvas.pack()
|
||||
#img = ImageTk.PhotoImage(width=256,height=256,image=Image.fromarray(image,mode="RGB"))
|
||||
img = ImageTk.PhotoImage(Image.open("highpress_camera.png"))
|
||||
|
||||
panel = tkinter.Label(image_window,image=img)
|
||||
panel.pack(side="bottom", fill = "both", expand = "yes")
|
||||
image_shower = renderedImageZoom(image_window,coords)
|
||||
image_window.mainloop()
|
||||
#canvas.create_image(20,20, anchor="nw", image=img)
|
||||
|
||||
def marker_click(marker):
|
||||
print(f"marker clicked - text: {marker.text} position: {marker.position}")
|
||||
|
|
|
@ -431,7 +431,7 @@ def renderFromCamera(filename):
|
|||
print(f"Renderinggg row {y + 1}/{height}, elapsed time: {elapsed_time:.2f} seconds")
|
||||
|
||||
image = np.clip(image, 0, 1) * 255
|
||||
return image
|
||||
return image.astype(np.uint8)
|
||||
#imageio.imwrite(filename, image.astype(np.uint8))
|
||||
|
||||
#renderFromCamera("camera_render.png")
|
||||
|
|
Loading…
Reference in a new issue