Skip to content

Commit 43b3c7b

Browse files
authored
Merge pull request #44 from PennyHow/dev
Development for v1.2.4
2 parents cd614be + 1953253 commit 43b3c7b

171 files changed

Lines changed: 4593 additions & 7817 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
*.pyc

PyTrx/Area.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#PyTrx (c) by Penelope How, Nick Hulton, Lynne Buie
2-
#
3-
#PyTrx is licensed under a MIT License.
1+
#PyTrx (c) is licensed under a MIT License.
42
#
53
#You should have received a copy of the license along with this
64
#work. If not, see <https://choosealicense.com/licenses/mit/>.
@@ -16,15 +14,21 @@
1614
import matplotlib.pyplot as plt
1715
from matplotlib.lines import Line2D
1816
import numpy as np
19-
import cv2, ogr, unittest
17+
import cv2, ogr, unittest, sys
2018
from PIL import Image
2119
from packaging import version
2220

2321
#Import PyTrx functions and classes
24-
from PyTrx.FileHandler import readMask
25-
from PyTrx.Images import ImageSequence, enhanceImage
26-
import PyTrx.Velocity as Velocity
27-
from PyTrx.CamEnv import projectUV, setProjection
22+
try:
23+
from FileHandler import readMask
24+
from Images import ImageSequence, enhanceImage
25+
import Velocity as Velocity
26+
from CamEnv import projectUV, setProjection
27+
except:
28+
from PyTrx.FileHandler import readMask
29+
from PyTrx.Images import ImageSequence, enhanceImage
30+
import PyTrx.Velocity as Velocity
31+
from PyTrx.CamEnv import projectUV, setProjection
2832

2933
#------------------------------------------------------------------------------
3034
class Area(ImageSequence):

PyTrx/CamEnv.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#PyTrx (c) by Penelope How, Nick Hulton, Lynne Buie
2-
#
3-
#PyTrx is licensed under a MIT License.
1+
#PyTrx (c) is licensed under a MIT License.
42
#
53
#You should have received a copy of the license along with this
64
#work. If not, see <https://choosealicense.com/licenses/mit/>.
@@ -15,11 +13,17 @@
1513
"""
1614

1715
#Import PyTrx packages
18-
from PyTrx.Utilities import plotGCPs, plotCalib, plotResiduals, plotPrincipalPoint
19-
from PyTrx.FileHandler import readImg, readGCPs, readMatrixDistortion
20-
from PyTrx.DEM import ExplicitRaster,load_DEM,voxelviewshed
21-
from PyTrx.Images import CamImage
22-
16+
try:
17+
from Utilities import plotGCPs, plotCalib, plotResiduals, plotPrincipalPoint
18+
from FileHandler import readImg, readGCPs, readMatrixDistortion
19+
from DEM import ExplicitRaster,load_DEM,voxelviewshed
20+
from Images import CamImage
21+
except:
22+
from PyTrx.Utilities import plotGCPs, plotCalib, plotResiduals, plotPrincipalPoint
23+
from PyTrx.FileHandler import readImg, readGCPs, readMatrixDistortion
24+
from PyTrx.DEM import ExplicitRaster,load_DEM,voxelviewshed
25+
from PyTrx.Images import CamImage
26+
2327
#Import other packages
2428
import matplotlib.pyplot as plt
2529
from scipy import interpolate

PyTrx/DEM.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
#PyTrx (c) by Penelope How, Nick Hulton, Lynne Buie
2-
#
3-
#PyTrx is licensed under a MIT License.
1+
#PyTrx (c) is licensed under a MIT License.
42
#
53
#You should have received a copy of the license along with this
64
#work. If not, see <https://choosealicense.com/licenses/mit/>.

PyTrx/Examples/KR_autoarea.py

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'''
2-
PyTrx (c) by Penelope How, Nick Hulton, Lynne Buie
3-
4-
PyTrx is licensed under a MIT License.
2+
PyTrx (c) is licensed under a MIT License.
53
64
You should have received a copy of the license along with this
75
work. If not, see <https://choosealicense.com/licenses/mit/>.
@@ -25,24 +23,22 @@
2523
'''
2624

2725
#Import packages
28-
import os
29-
30-
##Import PyTrx modules (from PyTrx file directory)
31-
#import sys
32-
#sys.path.append('../')
33-
#from Area import Area
34-
#import FileHandler as FileHandler
35-
#from Velocity import Homography
36-
#from CamEnv import CamEnv
37-
#from Utilities import plotAreaPX, plotAreaXYZ
38-
39-
##If you have pip/conda installed PyTrx then comment out the PyTrx module
40-
##imports above and uncomment these ones below
41-
from PyTrx.Area import Area
42-
import PyTrx.FileHandler as FileHandler
43-
from PyTrx.Velocity import Homography
44-
from PyTrx.CamEnv import CamEnv
45-
from PyTrx.Utilities import plotAreaPX, plotAreaXYZ
26+
import os, sys
27+
28+
##Import PyTrx modules
29+
try:
30+
sys.path.append('../')
31+
from Area import Area
32+
import FileHandler as FileHandler
33+
from Velocity import Homography
34+
from CamEnv import CamEnv
35+
from Utilities import plotAreaPX, plotAreaXYZ
36+
except:
37+
from PyTrx.Area import Area
38+
import PyTrx.FileHandler as FileHandler
39+
from PyTrx.Velocity import Homography
40+
from PyTrx.CamEnv import CamEnv
41+
from PyTrx.Utilities import plotAreaPX, plotAreaXYZ
4642

4743

4844
#----------------------------- Map data files -----------------------------

PyTrx/Examples/KR_manualarea.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'''
2-
PyTrx (c) by Penelope How, Nick Hulton, Lynne Buie
3-
4-
PyTrx is licensed under a MIT License.
2+
PyTrx (c) is licensed under a MIT License.
53
64
You should have received a copy of the license along with this
75
work. If not, see <https://choosealicense.com/licenses/mit/>.
@@ -23,28 +21,26 @@
2321
'''
2422

2523
#Import packages
26-
import os
24+
import os, cv2, glob, sys
2725
import matplotlib.pyplot as plt
2826
import matplotlib.image as mpimg
2927
import cv2
3028
import glob
3129

32-
# #Import PyTrx modules (from PyTrx file directory)
33-
# import sys
34-
# sys.path.append('../')
35-
# from Area import Area
36-
# from Velocity import Homography
37-
# from CamEnv import CamEnv
38-
# import FileHandler
39-
# from Utilities import plotAreaPX, plotAreaXYZ
40-
41-
#If you have pip/conda installed PyTrx then comment out the PyTrx module
42-
#imports above and uncomment these ones below
43-
from PyTrx.Area import Area
44-
from PyTrx.Velocity import Homography
45-
from PyTrx.CamEnv import CamEnv
46-
from PyTrx import FileHandler
47-
from PyTrx.Utilities import plotAreaPX, plotAreaXYZ
30+
# #Import PyTrx modules
31+
try:
32+
sys.path.append('../')
33+
from Area import Area
34+
from Velocity import Homography
35+
from CamEnv import CamEnv
36+
import FileHandler
37+
from Utilities import plotAreaPX, plotAreaXYZ
38+
except:
39+
from PyTrx.Area import Area
40+
from PyTrx.Velocity import Homography
41+
from PyTrx.CamEnv import CamEnv
42+
from PyTrx import FileHandler
43+
from PyTrx.Utilities import plotAreaPX, plotAreaXYZ
4844

4945

5046
#----------------------------- Map data files -----------------------------

PyTrx/Examples/KR_velocity1.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'''
2-
PyTrx (c) by Penelope How, Nick Hulton, Lynne Buie
3-
4-
PyTrx is licensed under a MIT License.
2+
PyTrx (c) is licensed under a MIT License.
53
64
You should have received a copy of the license along with this
75
work. If not, see <https://choosealicense.com/licenses/mit/>.
@@ -23,23 +21,21 @@
2321
'''
2422

2523
#Import packages
26-
import os
24+
import os, sys
2725
import numpy as np
2826

29-
# #Import PyTrx modules (from PyTrx file directory)
30-
# import sys
31-
# sys.path.append('../')
32-
# from CamEnv import CamEnv
33-
# from Velocity import Velocity, Homography
34-
# from FileHandler import writeHomogFile, writeVeloFile, writeVeloSHP, writeCalibFile
35-
# from Utilities import plotVeloPX, plotVeloXYZ, interpolateHelper, plotInterpolate
36-
37-
#If you have pip/conda installed PyTrx then comment out the PyTrx module
38-
#imports above and uncomment these ones below
39-
from PyTrx.CamEnv import CamEnv
40-
from PyTrx.Velocity import Velocity, Homography
41-
from PyTrx.FileHandler import writeHomogFile, writeVeloFile, writeVeloSHP, writeCalibFile
42-
from PyTrx.Utilities import plotVeloPX, plotVeloXYZ, interpolateHelper, plotInterpolate
27+
#Import PyTrx modules
28+
try:
29+
sys.path.append('../')
30+
from CamEnv import CamEnv
31+
from Velocity import Velocity, Homography
32+
from FileHandler import writeHomogFile, writeVeloFile, writeVeloSHP, writeCalibFile
33+
from Utilities import plotVeloPX, plotVeloXYZ, interpolateHelper, plotInterpolate
34+
except:
35+
from PyTrx.CamEnv import CamEnv
36+
from PyTrx.Velocity import Velocity, Homography
37+
from PyTrx.FileHandler import writeHomogFile, writeVeloFile, writeVeloSHP, writeCalibFile
38+
from PyTrx.Utilities import plotVeloPX, plotVeloXYZ, interpolateHelper, plotInterpolate
4339

4440

4541
#------------------------- Map data sources -------------------------------

PyTrx/Examples/KR_velocity2.py

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'''
2-
PyTrx (c) by Penelope How, Nick Hulton, Lynne Buie
3-
4-
PyTrx is licensed under a MIT License.
2+
PyTrx (c) is licensed under a MIT License.
53
64
You should have received a copy of the license along with this
75
work. If not, see <https://choosealicense.com/licenses/mit/>.
@@ -23,26 +21,20 @@
2321
'''
2422

2523
#Import packages
26-
import os
24+
import os, sys
2725
import numpy as np
2826

29-
# #Import PyTrx modules (from PyTrx file directory)
30-
# import sys
31-
# sys.path.append('../')
32-
# from CamEnv import CamEnv
33-
# from Velocity import Velocity, Homography
34-
# from FileHandler import writeHomogFile, writeVeloFile, writeVeloSHP, writeCalibFile
35-
# from Utilities import plotVeloPX, plotVeloXYZ, interpolateHelper, plotInterpolate
36-
37-
#If you have pip/conda installed PyTrx then comment out the PyTrx module
38-
#imports above and uncomment these ones below
39-
from PyTrx.CamEnv import CamEnv
40-
from PyTrx.Velocity import Velocity, Homography
41-
from PyTrx.FileHandler import writeHomogFile, writeVeloFile, writeVeloSHP, writeCalibFile
42-
from PyTrx.Utilities import plotVeloPX, plotVeloXYZ, interpolateHelper, plotInterpolate
43-
44-
45-
27+
try:
28+
sys.path.append('../')
29+
from CamEnv import CamEnv
30+
from Velocity import Velocity, Homography
31+
from FileHandler import writeHomogFile, writeVeloFile, writeVeloSHP, writeCalibFile
32+
from Utilities import plotVeloPX, plotVeloXYZ, interpolateHelper, plotInterpolate
33+
except:
34+
from PyTrx.CamEnv import CamEnv
35+
from PyTrx.Velocity import Velocity, Homography
36+
from PyTrx.FileHandler import writeHomogFile, writeVeloFile, writeVeloSHP, writeCalibFile
37+
from PyTrx.Utilities import plotVeloPX, plotVeloXYZ, interpolateHelper, plotInterpolate
4638

4739
#------------------------- Map data sources -------------------------------
4840

PyTrx/Examples/KR_velocity3.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'''
2-
PyTrx (c) by Penelope How, Nick Hulton, Lynne Buie
3-
4-
PyTrx is licensed under a MIT License.
2+
PyTrx (c) is licensed under a MIT License.
53
64
You should have received a copy of the license along with this
75
work. If not, see <https://choosealicense.com/licenses/mit/>.
@@ -31,27 +29,24 @@
3129
'''
3230

3331
#Import packages
34-
import cv2
32+
import cv2, glob, sys
3533
import glob
3634
import numpy as np
3735
from pathlib import Path
3836

39-
# #Import PyTrx modules (from PyTrx file directory)
40-
# import sys
41-
# sys.path.append('../')
42-
# from CamEnv import setProjection, optimiseCamera, computeResidualsXYZ
43-
# from DEM import load_DEM
44-
# import Velocity
45-
# import FileHandler
46-
# import Utilities
47-
48-
#If you have pip/conda installed PyTrx then comment out the PyTrx module
49-
#imports above and uncomment these ones below
50-
from PyTrx.CamEnv import setProjection, optimiseCamera, computeResidualsXYZ
51-
from PyTrx.DEM import load_DEM
52-
from PyTrx import Velocity
53-
from PyTrx import FileHandler
54-
from PyTrx import Utilities
37+
# #Import PyTrx modules
38+
try:
39+
from CamEnv import setProjection, optimiseCamera, computeResidualsXYZ
40+
from DEM import load_DEM
41+
import Velocity
42+
import FileHandler
43+
import Utilities
44+
except:
45+
from PyTrx.CamEnv import setProjection, optimiseCamera, computeResidualsXYZ
46+
from PyTrx.DEM import load_DEM
47+
from PyTrx import Velocity
48+
from PyTrx import FileHandler
49+
from PyTrx import Utilities
5550

5651

5752
#------------------------ Define inputs/outputs ---------------------------

0 commit comments

Comments
 (0)