camera-client 0.2.9__tar.gz → 0.2.10__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 (19) hide show
  1. {camera_client-0.2.9/camera_client.egg-info → camera_client-0.2.10}/PKG-INFO +1 -1
  2. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client/__main__.py +17 -12
  3. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client/client.py +2 -0
  4. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client/loading.py +8 -0
  5. {camera_client-0.2.9 → camera_client-0.2.10/camera_client.egg-info}/PKG-INFO +1 -1
  6. {camera_client-0.2.9 → camera_client-0.2.10}/pyproject.toml +1 -1
  7. {camera_client-0.2.9 → camera_client-0.2.10}/LICENSE +0 -0
  8. {camera_client-0.2.9 → camera_client-0.2.10}/MANIFEST.in +0 -0
  9. {camera_client-0.2.9 → camera_client-0.2.10}/README.md +0 -0
  10. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client/__init__.py +0 -0
  11. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client/script.py +0 -0
  12. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client.egg-info/SOURCES.txt +0 -0
  13. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client.egg-info/dependency_links.txt +0 -0
  14. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client.egg-info/entry_points.txt +0 -0
  15. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client.egg-info/requires.txt +0 -0
  16. {camera_client-0.2.9 → camera_client-0.2.10}/camera_client.egg-info/top_level.txt +0 -0
  17. {camera_client-0.2.9 → camera_client-0.2.10}/requirements.txt +0 -0
  18. {camera_client-0.2.9 → camera_client-0.2.10}/setup.cfg +0 -0
  19. {camera_client-0.2.9 → camera_client-0.2.10}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: camera-client
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Python SDK for camera calibration and projection transformations - handle lens distortion, coordinate transformations, and 3D ray casting with symbolic expressions.
5
5
  Author-email: Alexander Abramov <extremal.ru@gmail.com>
6
6
  License: MIT
@@ -36,6 +36,8 @@ def download_archive(url: str, output_dir: str = ".", silent: bool = False) -> b
36
36
  True if download succeeded, False otherwise
37
37
  """
38
38
  try:
39
+ os.makedirs(output_dir, exist_ok=True)
40
+
39
41
  # Parse the URL to extract filename from path or Content-Disposition header
40
42
  parsed_url = urlparse(url)
41
43
 
@@ -76,7 +78,7 @@ def download_archive(url: str, output_dir: str = ".", silent: bool = False) -> b
76
78
 
77
79
  if not silent:
78
80
  print(f"Successfully downloaded: {filename}")
79
- print(f"File size: {output_path.stat().st_size} bytes")
81
+ print(f"File size: {output_path.stat().st_size / 1024 / 1024:.2f} MB")
80
82
 
81
83
  return True
82
84
 
@@ -85,7 +87,7 @@ def download_archive(url: str, output_dir: str = ".", silent: bool = False) -> b
85
87
  return False
86
88
 
87
89
 
88
- def download_from_file(file_path: str, output_dir: str = ".", camera_id: int = None) -> None:
90
+ def download_from_file(file_path: str, output_dir: str = ".", camera_ids: list = None) -> None:
89
91
  """
90
92
  Download camera calibration archives from a .txt file with URLs or a .json config.
91
93
 
@@ -96,7 +98,7 @@ def download_from_file(file_path: str, output_dir: str = ".", camera_id: int = N
96
98
  Args:
97
99
  file_path: Path to .txt or .json file
98
100
  output_dir: Directory to save the downloaded files (default: current directory)
99
- camera_id: If provided, only download archives for this camera_id (JSON only)
101
+ camera_ids: If provided, only download archives for these camera_ids (JSON only)
100
102
  """
101
103
  try:
102
104
  if file_path.endswith('.json'):
@@ -106,8 +108,8 @@ def download_from_file(file_path: str, output_dir: str = ".", camera_id: int = N
106
108
  if not isinstance(configs, list):
107
109
  configs = [configs]
108
110
 
109
- if camera_id is not None:
110
- configs = [c for c in configs if c.get('camera_id') == camera_id]
111
+ if camera_ids is not None:
112
+ configs = [c for c in configs if c.get('camera_id') in camera_ids]
111
113
 
112
114
  urls = []
113
115
  for c in configs:
@@ -127,8 +129,8 @@ def download_from_file(file_path: str, output_dir: str = ".", camera_id: int = N
127
129
 
128
130
  if not urls:
129
131
  msg = f"No matching entries found in {file_path}"
130
- if camera_id is not None:
131
- msg += f" for camera_id={camera_id}"
132
+ if camera_ids is not None:
133
+ msg += f" for camera_id={','.join(str(x) for x in camera_ids)}"
132
134
  print(msg, file=sys.stderr)
133
135
  sys.exit(1)
134
136
  else:
@@ -196,14 +198,14 @@ def main():
196
198
  )
197
199
  download_parser.add_argument(
198
200
  '-o', '--output-dir',
199
- default='.',
200
- help='Output directory (default: current directory)'
201
+ default='camera_archives/',
202
+ help='Output directory (default: camera_archives/)'
201
203
  )
202
204
  download_parser.add_argument(
203
205
  '--camera_id',
204
- type=int,
206
+ type=str,
205
207
  default=None,
206
- help='Filter by camera_id (only used with JSON config files)'
208
+ help='Filter by camera_id, comma-separated for multiple (e.g. --camera_id=1156,1157)'
207
209
  )
208
210
 
209
211
  args = parser.parse_args()
@@ -220,7 +222,10 @@ def main():
220
222
 
221
223
  # Process based on input type
222
224
  if args.file:
223
- download_from_file(args.file, args.output_dir, camera_id=args.camera_id)
225
+ camera_ids = None
226
+ if args.camera_id:
227
+ camera_ids = [int(x.strip()) for x in args.camera_id.split(',')]
228
+ download_from_file(args.file, args.output_dir, camera_ids=camera_ids)
224
229
  else:
225
230
  success = download_archive(args.url, args.output_dir)
226
231
  sys.exit(0 if success else 1)
@@ -54,6 +54,8 @@ class CameraProjection:
54
54
  self.map_scale_w = data["map_scale_w"]
55
55
  self.map_scale_vang = data["map_scale_vang"]
56
56
 
57
+ self.camera_layers = data["camera_layers"]
58
+
57
59
  self.im_size = self.src2ctd_points_map.shape[:2]
58
60
 
59
61
  # Compile transformation expressions for ctd -> gnd
@@ -71,6 +71,12 @@ def read_npz_file(filename):
71
71
  # Ctd image geometry
72
72
  ctd_geometry = json.loads(str(data["ctd_geometry"]))
73
73
 
74
+ # Camera layers (optional)
75
+ if "camera_layers" in data:
76
+ camera_layers = json.loads(str(data["camera_layers"]))
77
+ else:
78
+ camera_layers = {}
79
+
74
80
  # Don't forget to close the file
75
81
  data.close()
76
82
 
@@ -100,4 +106,6 @@ def read_npz_file(filename):
100
106
  "map_scale_vang": map_scale_vang,
101
107
  # Ctd image geometry
102
108
  "ctd_geometry": ctd_geometry,
109
+ # Camera layers
110
+ "camera_layers": camera_layers,
103
111
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: camera-client
3
- Version: 0.2.9
3
+ Version: 0.2.10
4
4
  Summary: Python SDK for camera calibration and projection transformations - handle lens distortion, coordinate transformations, and 3D ray casting with symbolic expressions.
5
5
  Author-email: Alexander Abramov <extremal.ru@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "camera-client"
7
- version = "0.2.9"
7
+ version = "0.2.10"
8
8
  description = "Python SDK for camera calibration and projection transformations - handle lens distortion, coordinate transformations, and 3D ray casting with symbolic expressions."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
File without changes
File without changes
File without changes
File without changes