glassesTools 1.3.0__tar.gz → 1.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. {glassestools-1.3.0/src/glassesTools.egg-info → glassestools-1.3.2}/PKG-INFO +2 -2
  2. {glassestools-1.3.0 → glassestools-1.3.2}/README.md +1 -1
  3. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/aruco.py +2 -1
  4. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/marker.py +6 -0
  5. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/plane.py +31 -19
  6. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/version.py +1 -1
  7. {glassestools-1.3.0 → glassestools-1.3.2/src/glassesTools.egg-info}/PKG-INFO +2 -2
  8. {glassestools-1.3.0 → glassestools-1.3.2}/LICENSE +0 -0
  9. {glassestools-1.3.0 → glassestools-1.3.2}/MANIFEST.in +0 -0
  10. {glassestools-1.3.0 → glassestools-1.3.2}/pyproject.toml +0 -0
  11. {glassestools-1.3.0 → glassestools-1.3.2}/requirements.txt +0 -0
  12. {glassestools-1.3.0 → glassestools-1.3.2}/setup.cfg +0 -0
  13. {glassestools-1.3.0 → glassestools-1.3.2}/setup.py +0 -0
  14. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/__init__.py +0 -0
  15. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/data_files.py +0 -0
  16. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/drawing.py +0 -0
  17. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/eyetracker.py +0 -0
  18. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/gaze_headref.py +0 -0
  19. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/gaze_worldref.py +0 -0
  20. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/importing/SMI_ETG.py +0 -0
  21. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/importing/SeeTrue_STONE.py +0 -0
  22. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/importing/__init__.py +0 -0
  23. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/importing/adhawk_mindlink.py +0 -0
  24. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/importing/pupilLabs.py +0 -0
  25. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/importing/tobii_G2.py +0 -0
  26. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/importing/tobii_G3.py +0 -0
  27. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/intervals.py +0 -0
  28. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/mp4analyser/__init__.py +0 -0
  29. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/mp4analyser/core.py +0 -0
  30. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/mp4analyser/iso.py +0 -0
  31. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/mp4analyser/mpeglookups.py +0 -0
  32. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/mp4analyser/non_iso.py +0 -0
  33. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/mp4analyser/summary.py +0 -0
  34. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/mp4analyser/util.py +0 -0
  35. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/ocv.py +0 -0
  36. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/recording.py +0 -0
  37. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/timestamps.py +0 -0
  38. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/transforms.py +0 -0
  39. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/utils.py +0 -0
  40. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/video_gui.py +0 -0
  41. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools/video_utils.py +0 -0
  42. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools.egg-info/SOURCES.txt +0 -0
  43. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools.egg-info/dependency_links.txt +0 -0
  44. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools.egg-info/requires.txt +0 -0
  45. {glassestools-1.3.0 → glassestools-1.3.2}/src/glassesTools.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: glassesTools
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: Tools for processing wearable eye tracker recordings.
5
5
  Home-page: https://github.com/dcnieho/glassesTools
6
6
  Author: Diederick Niehorster
@@ -48,7 +48,7 @@ Requires-Dist: imgui_bundle==1.3.0; extra == "gui"
48
48
  [![PyPI Latest Release](https://img.shields.io/pypi/v/glassesTools.svg)](https://pypi.org/project/glassesTools/)
49
49
  [![image](https://img.shields.io/pypi/pyversions/glassesTools.svg)](https://pypi.org/project/glassesTools/)
50
50
 
51
- # GlassesTools v1.3.0
51
+ # GlassesTools v1.3.2
52
52
  Tools for processing wearable eye tracker recordings.
53
53
 
54
54
  If you use this package or any of the code in this repository, please cite:<br>
@@ -2,7 +2,7 @@
2
2
  [![PyPI Latest Release](https://img.shields.io/pypi/v/glassesTools.svg)](https://pypi.org/project/glassesTools/)
3
3
  [![image](https://img.shields.io/pypi/pyversions/glassesTools.svg)](https://pypi.org/project/glassesTools/)
4
4
 
5
- # GlassesTools v1.3.0
5
+ # GlassesTools v1.3.2
6
6
  Tools for processing wearable eye tracker recordings.
7
7
 
8
8
  If you use this package or any of the code in this repository, please cite:<br>
@@ -2,7 +2,7 @@ import numpy as np
2
2
  import cv2
3
3
  from typing import Any
4
4
 
5
- from . import drawing, intervals, ocv, plane, timestamps, transforms
5
+ from . import drawing, intervals, ocv, plane, timestamps
6
6
 
7
7
 
8
8
  class ArUcoDetector():
@@ -75,6 +75,7 @@ class ArUcoDetector():
75
75
  return self._estimate_homography_impl(objP, imgP)
76
76
 
77
77
  def _estimate_homography_impl(self, objP, imgP):
78
+ from . import transforms
78
79
  N_markers, H = 0, None
79
80
  if objP is None:
80
81
  return N_markers, H
@@ -12,6 +12,12 @@ class Marker:
12
12
  ret = '[%d]: center @ (%.2f, %.2f), rot %.0f deg' % (self.key, self.center[0], self.center[1], self.rot)
13
13
  return ret
14
14
 
15
+ def shift(self, offset=np.ndarray):
16
+ self.center += offset
17
+ if self.corners:
18
+ for c in self.corners:
19
+ c += offset
20
+
15
21
  def corners_intersection(corners):
16
22
  line1 = ( corners[0], corners[2] )
17
23
  line2 = ( corners[1], corners[3] )
@@ -4,7 +4,7 @@ import cv2
4
4
  import pathlib
5
5
  import math
6
6
 
7
- from . import aruco, data_files, drawing, marker, ocv
7
+ from . import data_files, drawing, marker, ocv
8
8
 
9
9
 
10
10
  class Plane:
@@ -12,13 +12,13 @@ class Plane:
12
12
 
13
13
  def __init__(self,
14
14
  markers : str|pathlib.Path|pd.DataFrame, # if str or Path: file from which to read markers. Else direction N_markerx4 array. Should contain centers of markers
15
- marker_size : float, # mm
15
+ marker_size : float, # in "unit" units
16
16
 
17
17
  aruco_dict = cv2.aruco.DICT_4X4_250,
18
18
  marker_border_bits = 1,
19
19
  marker_pos_scale_fac = 1., # scale factor for marker positions in the markers input argument
20
+ unit : str = None, # Unit in which measurements (marker size and positions for instance) are expressed. Purely informational
20
21
  package_to_read_from : str = None, # if provided, reads marker file from specified package's resources
21
- plane_center : np.ndarray = None, # center coordinate of plane, in scaled marker coordinates
22
22
  ref_image_store_path : str|pathlib.Path = None,
23
23
  ref_image_width = 1920
24
24
  ):
@@ -29,27 +29,40 @@ class Plane:
29
29
  self.bbox : list[float] = []
30
30
 
31
31
  # marker specs
32
- self.aruco_dict = aruco_dict
32
+ self.aruco_dict = cv2.aruco.getPredefinedDictionary(aruco_dict)
33
33
  self.marker_border_bits = marker_border_bits
34
+ self.unit = unit
34
35
 
35
36
  # prep markers
36
- self._get_markers(markers, marker_pos_scale_fac, package_to_read_from, plane_center)
37
+ self._get_markers(markers, marker_pos_scale_fac, package_to_read_from)
37
38
 
38
39
  # get reference image of plane
39
40
  if ref_image_store_path:
40
41
  ref_image_store_path = pathlib.Path(ref_image_store_path)
41
42
 
42
43
  # get image
43
- if ref_image_store_path is None or not ref_image_store_path.is_file():
44
- # if doesn't exist, create
45
- img = self._store_reference_image(ref_image_store_path, ref_image_width)
46
- else:
47
- # read image
44
+ img = None
45
+ # read from file if image exists
46
+ if ref_image_store_path is not None and ref_image_store_path.is_file():
48
47
  img = cv2.imread(str(ref_image_store_path), cv2.IMREAD_COLOR)
48
+ # if image doesn't exist or is the wrong size, create
49
+ if img is None or img.shape[1]!=ref_image_width:
50
+ img = self._store_reference_image(ref_image_store_path, ref_image_width)
49
51
 
50
52
  self._ref_image_width = ref_image_width
51
53
  self._ref_image_cache : dict[int, np.ndarray] = {ref_image_width: img}
52
54
 
55
+ def set_center(self, center: np.ndarray):
56
+ # set center of plane. Center coordinate is on current (not original) plane
57
+ # so set_center([5., 0.]) three times in a row shift the center rightward by 15 units
58
+ for i in self.markers:
59
+ self.markers[i].shift(-center)
60
+
61
+ self.bbox[0] -= center[0]
62
+ self.bbox[2] -= center[0]
63
+ self.bbox[1] -= center[1]
64
+ self.bbox[3] -= center[1]
65
+
53
66
  def get_ref_image(self, width: int=None, asRGB=False):
54
67
  if width is None:
55
68
  width = self._ref_image_width
@@ -75,7 +88,7 @@ class Plane:
75
88
  color = (0,0,0)
76
89
  drawing.openCVCircle(img, xy, size, color, -1, subPixelFac)
77
90
 
78
- def _get_markers(self, markers: str|pathlib.Path|pd.DataFrame, marker_pos_scale_fac: float, package_to_read_from: str|None, plane_center: np.ndarray|None):
91
+ def _get_markers(self, markers: str|pathlib.Path|pd.DataFrame, marker_pos_scale_fac: float, package_to_read_from: str|None):
79
92
  # read in aruco marker positions
80
93
  markerHalfSizeMm = self.marker_size/2.
81
94
 
@@ -89,9 +102,6 @@ class Plane:
89
102
  # turn into marker objects
90
103
  marker_pos.x = marker_pos.x.astype('float32')*marker_pos_scale_fac
91
104
  marker_pos.y = marker_pos.y.astype('float32')*marker_pos_scale_fac
92
- if plane_center is not None:
93
- marker_pos.x -= plane_center[0]
94
- marker_pos.y -= plane_center[1]
95
105
 
96
106
  for idx, row in marker_pos.iterrows():
97
107
  c = row[['x','y']].values
@@ -110,13 +120,15 @@ class Plane:
110
120
  self.markers[idx] = marker.Marker(idx, c, corners=[tl, tr, br, bl], rot=rot)
111
121
 
112
122
  # determine bounding box of markers ([left, top, right, bottom])
113
- # NB: this assumes markers are rotated by multiples of 90 degrees
114
- self.bbox.append(marker_pos.x.min()-markerHalfSizeMm)
115
- self.bbox.append(marker_pos.y.min()-markerHalfSizeMm)
116
- self.bbox.append(marker_pos.x.max()+markerHalfSizeMm)
117
- self.bbox.append(marker_pos.y.max()+markerHalfSizeMm)
123
+ all_x = [c[0] for idx in self.markers for c in self.markers[idx].corners]
124
+ all_y = [c[1] for idx in self.markers for c in self.markers[idx].corners]
125
+ self.bbox.append(min(all_x))
126
+ self.bbox.append(min(all_y))
127
+ self.bbox.append(max(all_x))
128
+ self.bbox.append(max(all_y))
118
129
 
119
130
  def get_aruco_board(self, unrotate_markers=False):
131
+ from . import aruco
120
132
  board_corner_points = []
121
133
  ids = []
122
134
  for key in self.markers:
@@ -1,4 +1,4 @@
1
- __version__ = "1.3.0"
1
+ __version__ = "1.3.2"
2
2
 
3
3
  __title__ = "glassesTools"
4
4
  __description__ = "Tools for processing wearable eye tracker recordings."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: glassesTools
3
- Version: 1.3.0
3
+ Version: 1.3.2
4
4
  Summary: Tools for processing wearable eye tracker recordings.
5
5
  Home-page: https://github.com/dcnieho/glassesTools
6
6
  Author: Diederick Niehorster
@@ -48,7 +48,7 @@ Requires-Dist: imgui_bundle==1.3.0; extra == "gui"
48
48
  [![PyPI Latest Release](https://img.shields.io/pypi/v/glassesTools.svg)](https://pypi.org/project/glassesTools/)
49
49
  [![image](https://img.shields.io/pypi/pyversions/glassesTools.svg)](https://pypi.org/project/glassesTools/)
50
50
 
51
- # GlassesTools v1.3.0
51
+ # GlassesTools v1.3.2
52
52
  Tools for processing wearable eye tracker recordings.
53
53
 
54
54
  If you use this package or any of the code in this repository, please cite:<br>
File without changes
File without changes
File without changes
File without changes