<commit_before>#!/usr/bin/env python3

from __future__ import print_function
import argparse
import cv2
import fnmatch
import os.path
import pathlib
from tqdm import tqdm
import sys
import time

import tkinter as tk            # python3-tkinter
from tkinter import filedialog

from props import getNode       # aura-props

import math
import numpy as np

# pip3 install --pre --extra-index-url https://archive.panda3d.org/ panda3d
# pip3 install panda3d

from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from panda3d.core import LineSegs, NodePath, OrthographicLens, PNMImage, Texture, Filename, Shader, WindowProperties
from direct.gui.DirectGui import YesNoDialog

from lib import histogram
from lib import project
from explore import annotations
from explore import reticle
from explore import surface

parser = argparse.ArgumentParser(description='ImageAnalysis Map Explorer.')
parser.add_argument('project', nargs='?', help='project directory')
args = parser.parse_args()

if False:
    import wx
    def get_path(wildcard):
        app = wx.App(None)
        style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST
        dialog = wx.FileDialog(None, 'Open', wildcard=wildcard, style=style)
        if dialog.ShowModal() == wx.ID_OK:
            path = dialog.GetPath()
        else:
            path = None
        dialog.Destroy()
        return path
    get_path("*")
    print(get_path('*.txt'))
    quit()

tk_root = tk.Tk()
tk_root.withdraw()

if not args.project:
    # file_path = filedialog.askopenfilename()
    file_path = filedialog.askdirectory(title="Please open the project directory", mustexist=True)
    # print('selected:', type(file_path), len(file_path), file_path)
    if file_path:
        args.project = file_path
    else:
        print("no project selected, exiting.")
        quit()

proj = project.ProjectMgr(args.project)
proj.load_images_info()

# lookup ned reference
ref_node = getNode("/config/ned_reference", True)
ned_ref = [ ref_node.getFloat('lat_deg'),
            ref_node.getFloat('lon_deg'),
            ref_node.getFloat('alt_m') ]

tcache = {}

# histogram matching
do_histogram = histogram.load(proj.analysis_dir)

# adaptive equalizer
clahe = cv2.createCLAHE(clipLimit=1.0, tileGridSize=(8,8))

class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
 
        self.models = []
        self.base_textures = []

        # window title
        props = WindowProperties( )
        props.setTitle( pathlib.Path(args.project).name )
        base.win.requestProperties( props )

        # we would like an orthographic lens
        self.lens = OrthographicLens()
        self.lens.setFilmSize(20, 15)
        base.camNode.setLens(self.lens)

        self.cam_pos = [ 0.0, 0.0, 1000.0 ]
        self.camera.setPos(self.cam_pos[0], self.cam_pos[1], self.cam_pos[2])
        self.camera.setHpr(0, -90.0, 0)
        self.view_size = 100.0
        self.last_ysize = 0
        
        self.top_image = 0

        # modules
        self.surface = surface.Surface(proj.analysis_dir)
        self.annotations = annotations.Annotations(self.render, self.surface,
                                                   proj, ned_ref, tk_root)
        self.reticle = reticle.Reticle(self.render, self.surface, ned_ref)
        self.draw_reticle = True

        #self.messenger.toggleVerbose()

        # event handlers
        self.accept('arrow_left', self.cam_move, [-0.1, 0, 0])<commit_msg>Raise the camera level to 10k meters so we aren't underground in parts of AZ.<commit_after>#!/usr/bin/env python3

from __future__ import print_function
import argparse
import cv2
import fnmatch
import os.path
import pathlib
from tqdm import tqdm
import sys
import time

import tkinter as tk            # python3-tkinter
from tkinter import filedialog

from props import getNode       # aura-props

import math
import numpy as np

# pip3 install --pre --extra-index-url https://archive.panda3d.org/ panda3d
# pip3 install panda3d

from direct.showbase.ShowBase import ShowBase # pip install panda3d
from direct.task import Task
from panda3d.core import LineSegs, NodePath, OrthographicLens, PNMImage, Texture, Filename, Shader, WindowProperties
from direct.gui.DirectGui import YesNoDialog

from lib import histogram
from lib import project
from explore import annotations
from explore import reticle
from explore import surface

parser = argparse.ArgumentParser(description='ImageAnalysis Map Explorer.')
parser.add_argument('project', nargs='?', help='project directory')
args = parser.parse_args()

if False:
    import wx
    def get_path(wildcard):
        app = wx.App(None)
        style = wx.FD_OPEN | wx.FD_FILE_MUST_EXIST
        dialog = wx.FileDialog(None, 'Open', wildcard=wildcard, style=style)
        if dialog.ShowModal() == wx.ID_OK:
            path = dialog.GetPath()
        else:
            path = None
        dialog.Destroy()
        return path
    get_path("*")
    print(get_path('*.txt'))
    quit()

tk_root = tk.Tk()
tk_root.withdraw()

if not args.project:
    # file_path = filedialog.askopenfilename()
    file_path = filedialog.askdirectory(title="Please open the project directory", mustexist=True)
    # print('selected:', type(file_path), len(file_path), file_path)
    if file_path:
        args.project = file_path
    else:
        print("no project selected, exiting.")
        quit()

proj = project.ProjectMgr(args.project)
proj.load_images_info()

# lookup ned reference
ref_node = getNode("/config/ned_reference", True)
ned_ref = [ ref_node.getFloat('lat_deg'),
            ref_node.getFloat('lon_deg'),
            ref_node.getFloat('alt_m') ]

tcache = {}

# histogram matching
do_histogram = histogram.load(proj.analysis_dir)

# adaptive equalizer
clahe = cv2.createCLAHE(clipLimit=1.0, tileGridSize=(8,8))

class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
 
        self.models = []
        self.base_textures = []

        # window title
        props = WindowProperties( )
        props.setTitle( pathlib.Path(args.project).name )
        base.win.requestProperties( props )

        # we would like an orthographic lens
        self.lens = OrthographicLens()
        self.lens.setFilmSize(20, 15)
        base.camNode.setLens(self.lens)

        self.cam_pos = [ 0.0, 0.0, 10000.0 ]
        self.camera.setPos(self.cam_pos[0], self.cam_pos[1], self.cam_pos[2])
        self.camera.setHpr(0, -90.0, 0)
        self.view_size = 100.0
        self.last_ysize = 0
        
        self.top_image = 0

        # modules
        self.surface = surface.Surface(proj.analysis_dir)
        self.annotations = annotations.Annotations(self.render, self.surface,
                                                   proj, ned_ref, tk_root)
        self.reticle = reticle.Reticle(self.render, self.surface, ned_ref)
        self.draw_reticle = True

        #self.messenger.toggleVerbose()

        # event handlers
        self.accept('arrow_left', self.cam_move, [-0.1, 0, 0])
{'fraction_non_alphanumeric': 0.10372378370666287, 'fraction_numerical': 0.013411328292195749, 'mean_word_length': 2.907469342251951, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6496778', 'n_tokens_mistral': 2278, 'n_tokens_neox': 2168, 'n_words': 522}