sciveo 0.1.58__tar.gz → 0.1.59__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 (160) hide show
  1. {sciveo-0.1.58 → sciveo-0.1.59}/PKG-INFO +1 -1
  2. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/cli.py +5 -3
  3. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/tools/video_interactive.py +1 -1
  4. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/images/embeddings.py +4 -1
  5. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/video/description.py +1 -0
  6. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/configuration.py +1 -0
  7. sciveo-0.1.59/sciveo/tools/draw/__init__.py +0 -0
  8. sciveo-0.1.59/sciveo/tools/draw/contours.py +147 -0
  9. sciveo-0.1.59/sciveo/version.py +2 -0
  10. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo.egg-info/PKG-INFO +1 -1
  11. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo.egg-info/SOURCES.txt +2 -0
  12. sciveo-0.1.58/sciveo/version.py +0 -2
  13. {sciveo-0.1.58 → sciveo-0.1.59}/README.md +0 -0
  14. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/__init__.py +0 -0
  15. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/api/__init__.py +0 -0
  16. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/api/base.py +0 -0
  17. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/api/predictors.py +0 -0
  18. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/api/server.py +0 -0
  19. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/api/upload.py +0 -0
  20. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/common/__init__.py +0 -0
  21. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/common/configuration.py +0 -0
  22. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/common/model.py +0 -0
  23. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/common/optimizers.py +0 -0
  24. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/common/sampling.py +0 -0
  25. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/content/__init__.py +0 -0
  26. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/content/dataset.py +0 -0
  27. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/content/experiment.py +0 -0
  28. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/content/project.py +0 -0
  29. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/content/runner.py +0 -0
  30. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/__init__.py +0 -0
  31. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/__init__.py +0 -0
  32. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/base.py +0 -0
  33. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/encoders/__init__.py +0 -0
  34. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/encoders/base.py +0 -0
  35. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/encoders/normalizer.py +0 -0
  36. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/nlp/__init__.py +0 -0
  37. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/nlp/search.py +0 -0
  38. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/time_series/__init__.py +0 -0
  39. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/time_series/dataset.py +0 -0
  40. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/time_series/predictor.py +0 -0
  41. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/time_series/trainer.py +0 -0
  42. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/ml/time_series/window_generator.py +0 -0
  43. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/__init__.py +0 -0
  44. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/base.py +0 -0
  45. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/job_daemon.py +0 -0
  46. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/layouts/__init__.py +0 -0
  47. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/layouts/base.py +0 -0
  48. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/pipeline.py +0 -0
  49. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/postprocessors/__init__.py +0 -0
  50. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/postprocessors/base.py +0 -0
  51. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/postprocessors/default.py +0 -0
  52. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/__init__.py +0 -0
  53. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/audio/__init__.py +0 -0
  54. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/audio/audio.py +0 -0
  55. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/audio/audio_extractor_process.py +0 -0
  56. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/aws.py +0 -0
  57. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/base.py +0 -0
  58. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/file/__init__.py +0 -0
  59. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/file/archive.py +0 -0
  60. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/__init__.py +0 -0
  61. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/album.py +0 -0
  62. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/album_in_image.py +0 -0
  63. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/depth_esimation.py +0 -0
  64. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/embeddings.py +0 -0
  65. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/filters.py +0 -0
  66. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/generators.py +0 -0
  67. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/histogram.py +0 -0
  68. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/mask.py +0 -0
  69. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/object_detection.py +0 -0
  70. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/resize.py +0 -0
  71. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/segmentation.py +0 -0
  72. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/image/watermark.py +0 -0
  73. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/media_info.py +0 -0
  74. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/nlp/__init__.py +0 -0
  75. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/nlp/address.py +0 -0
  76. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/qr.py +0 -0
  77. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/sci/__init__.py +0 -0
  78. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/sci/base.py +0 -0
  79. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/sci/dataset.py +0 -0
  80. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/sci/time_series/__init__.py +0 -0
  81. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/sci/time_series/predictor.py +0 -0
  82. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/sci/time_series/trainer.py +0 -0
  83. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/tpu_base.py +0 -0
  84. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/video/__init__.py +0 -0
  85. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/video/generators.py +0 -0
  86. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/video/motion_detection.py +0 -0
  87. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/video/resize.py +0 -0
  88. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/video/video_album.py +0 -0
  89. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/video/video_frames.py +0 -0
  90. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/processors/video/video_resample.py +0 -0
  91. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/queues.py +0 -0
  92. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/server.py +0 -0
  93. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/web/__init__.py +0 -0
  94. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/pipelines/web/server.py +0 -0
  95. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/tools/__init__.py +0 -0
  96. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/media/tools/nvr.py +0 -0
  97. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/__init__.py +0 -0
  98. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/base.py +0 -0
  99. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/dataset/__init__.py +0 -0
  100. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/dataset/object_detection.py +0 -0
  101. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/evaluation/__init__.py +0 -0
  102. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/evaluation/markdown.py +0 -0
  103. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/evaluation/object_detection.py +0 -0
  104. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/images/__init__.py +0 -0
  105. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/images/base.py +0 -0
  106. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/images/description.py +0 -0
  107. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/images/object_detection.py +0 -0
  108. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/images/tools.py +0 -0
  109. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/images/transformers.py +0 -0
  110. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/nlp/__init__.py +0 -0
  111. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/nlp/embeddings.py +0 -0
  112. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/nlp/tokenizers/__init__.py +0 -0
  113. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/nlp/tokenizers/bpe.py +0 -0
  114. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/ml/video/__init__.py +0 -0
  115. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/monitoring/__init__.py +0 -0
  116. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/monitoring/monitor.py +0 -0
  117. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/monitoring/start.py +0 -0
  118. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/monitoring/watchdog/__init__.py +0 -0
  119. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/monitoring/watchdog/base.py +0 -0
  120. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/network/__init__.py +0 -0
  121. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/network/camera.py +0 -0
  122. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/network/sniffer.py +0 -0
  123. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/network/tools.py +0 -0
  124. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/__init__.py +0 -0
  125. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/array.py +0 -0
  126. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/aws/__init__.py +0 -0
  127. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/aws/priority_queue.py +0 -0
  128. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/aws/s3.py +0 -0
  129. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/common.py +0 -0
  130. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/complexity.py +0 -0
  131. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/compress.py +0 -0
  132. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/crypto.py +0 -0
  133. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/daemon.py +0 -0
  134. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/formating.py +0 -0
  135. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/hardware.py +0 -0
  136. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/http.py +0 -0
  137. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/logger.py +0 -0
  138. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/os.py +0 -0
  139. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/queue.py +0 -0
  140. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/random.py +0 -0
  141. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/remote.py +0 -0
  142. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/simple_counter.py +0 -0
  143. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/synchronized.py +0 -0
  144. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo/tools/timers.py +0 -0
  145. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo.egg-info/dependency_links.txt +0 -0
  146. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo.egg-info/entry_points.txt +0 -0
  147. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo.egg-info/requires.txt +0 -0
  148. {sciveo-0.1.58 → sciveo-0.1.59}/sciveo.egg-info/top_level.txt +0 -0
  149. {sciveo-0.1.58 → sciveo-0.1.59}/setup.cfg +0 -0
  150. {sciveo-0.1.58 → sciveo-0.1.59}/setup.py +0 -0
  151. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_complexity.py +0 -0
  152. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_compress.py +0 -0
  153. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_configuration.py +0 -0
  154. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_crypto.py +0 -0
  155. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_eval_markdown.py +0 -0
  156. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_ml_datasets.py +0 -0
  157. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_monitoring.py +0 -0
  158. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_runner.py +0 -0
  159. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_sampling.py +0 -0
  160. {sciveo-0.1.58 → sciveo-0.1.59}/test/test_tokenizers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.58
3
+ Version: 0.1.59
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
@@ -15,6 +15,7 @@ import time
15
15
  import json
16
16
  import argparse
17
17
 
18
+ from sciveo.version import __version__
18
19
  from sciveo.tools.logger import *
19
20
  from sciveo.tools.configuration import GlobalConfiguration
20
21
 
@@ -22,7 +23,7 @@ from sciveo.tools.configuration import GlobalConfiguration
22
23
  def main():
23
24
  config = GlobalConfiguration.get()
24
25
 
25
- parser = argparse.ArgumentParser(description='sciveo CLI')
26
+ parser = argparse.ArgumentParser(description=f'{config.name} CLI')
26
27
  parser.add_argument(
27
28
  'command',
28
29
  choices=[
@@ -66,13 +67,14 @@ def main():
66
67
  else:
67
68
  NetworkTools(timeout=args.timeout, ports=json.loads(args.ports)).scan_host(host)
68
69
  elif args.command == 'init':
70
+ info(f"init {config.name} ver {__version__}")
69
71
  home = os.path.expanduser('~')
70
- base_path = os.path.join(home, '.sciveo')
72
+ base_path = os.path.join(home, f'.{config.name}')
71
73
  if not os.path.exists(base_path):
72
74
  os.makedirs(base_path)
73
75
  default_lines = [
74
76
  "secret_access_key=<your secret access key>",
75
- "api_base_url=https://sciveo.com",
77
+ f"api_base_url=https://{config.name}.com",
76
78
  "sci_log_level=DEBUG"
77
79
  ]
78
80
  with open(os.path.join(base_path, "default"), 'w') as fp:
@@ -23,7 +23,7 @@ class BaseInteractiveVideoPlayer:
23
23
  def __init__(self, path_video, tag):
24
24
  self.path_video = path_video
25
25
  self.file_name = os.path.basename(self.path_video)
26
- self.file_name_base = filename_without_ext = os.path.splitext(self.file_name)[0]
26
+ self.file_name_base = os.path.splitext(self.file_name)[0]
27
27
  self.path_base = os.path.dirname(self.path_video)
28
28
  self.tag = tag
29
29
  self.frame_tag = f"Video {tag}"
@@ -89,7 +89,10 @@ class ImageEmbedding(BaseImageML):
89
89
  def predict_one(self, x):
90
90
  self.init()
91
91
  image = self.read_image(x)
92
- return self.embed(image)
92
+ embedding = self.embed(image)
93
+ if not isinstance(embedding, list):
94
+ embedding = embedding.tolist()
95
+ return embedding
93
96
 
94
97
  def predict(self, X):
95
98
  self.init()
@@ -30,6 +30,7 @@ class VideoToText(ImageToText):
30
30
  total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
31
31
  cap.set(cv2.CAP_PROP_POS_FRAMES, total_frames // 2)
32
32
  ret, frame = cap.read()
33
+ frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
33
34
  cap.release()
34
35
  return frame
35
36
 
@@ -20,6 +20,7 @@ class GlobalConfiguration:
20
20
 
21
21
  def __init__(self, name) -> None:
22
22
  home = os.path.expanduser('~')
23
+ self.name = name
23
24
  self.base_path = os.path.join(home, f'.{name}')
24
25
  self.data = {}
25
26
 
File without changes
@@ -0,0 +1,147 @@
1
+ #
2
+ # Pavlin Georgiev, Softel Labs
3
+ #
4
+ # This is a proprietary file and may not be copied,
5
+ # distributed, or modified without express permission
6
+ # from the owner. For licensing inquiries, please
7
+ # contact pavlin@softel.bg.
8
+ #
9
+ # 2025
10
+ #
11
+
12
+ import os
13
+ import time
14
+ import cv2
15
+ import numpy as np
16
+
17
+ from sciveo.tools.logger import *
18
+
19
+
20
+ class MapContoursUI:
21
+ def __init__(self, image_path):
22
+ self.image_path = image_path
23
+ self.image = cv2.imread(image_path)
24
+ if self.image is None:
25
+ raise ValueError(f"Image not found: {image_path}")
26
+ self.contours = []
27
+ self.current_contour = []
28
+ self.current_mouse_pos = (0, 0)
29
+ self.drawing = False
30
+ self.display = self.image.copy()
31
+
32
+ def _mouse_callback(self, event, x, y, flags, param):
33
+ if event == cv2.EVENT_MOUSEMOVE:
34
+ self.current_mouse_pos = (x, y)
35
+
36
+ def draw(self):
37
+ cv2.namedWindow("Contour Drawing")
38
+ cv2.setMouseCallback("Contour Drawing", self._mouse_callback)
39
+
40
+ print("\nControls:\n"
41
+ " c - Start new contour\n"
42
+ " v - Add point\n"
43
+ " x - Finalize contour\n"
44
+ " u - Undo last contour\n"
45
+ " z - Finish & show areas\n")
46
+
47
+ while True:
48
+ frame = self.display.copy()
49
+
50
+ for cnt in self.contours:
51
+ cv2.polylines(frame, [cnt], isClosed=True, color=(255, 0, 255), thickness=2)
52
+
53
+ if self.current_contour:
54
+ pts = self.current_contour + [self.current_mouse_pos]
55
+ for i in range(1, len(pts)):
56
+ cv2.line(frame, pts[i - 1], pts[i], (0, 255, 255), 1)
57
+
58
+ cv2.circle(frame, self.current_mouse_pos, 5, (0, 255, 0), -1)
59
+
60
+ self.draw_contour_indexes(frame)
61
+ self.draw_contour_lengths(frame)
62
+
63
+ cv2.imshow("Contour Drawing", frame)
64
+ key = cv2.waitKey(1) & 0xFF
65
+
66
+ if key == ord('c'): # Start new contour
67
+ self.current_contour = []
68
+ self.drawing = True
69
+ print("Started new contour.")
70
+
71
+ elif key == ord('v') and self.drawing: # Add point
72
+ self.current_contour.append(self.current_mouse_pos)
73
+ print(f"Added point: {self.current_mouse_pos}")
74
+
75
+ elif key == ord('x') and self.drawing: # Finalize
76
+ if len(self.current_contour) >= 3:
77
+ self.contours.append(np.array(self.current_contour, dtype=np.int32))
78
+ print("Contour finalized.")
79
+ else:
80
+ print("Contour discarded (not enough points).")
81
+ self.current_contour = []
82
+ self.drawing = False
83
+
84
+ elif key == ord('u') and self.contours: # Undo
85
+ self.contours.pop()
86
+ print("Last contour removed.")
87
+
88
+ elif key == ord('z'): # Finish
89
+ cv2.destroyWindow("Contour Drawing")
90
+ break
91
+
92
+ self.print_area_summary()
93
+ time.sleep(5)
94
+ cv2.destroyAllWindows()
95
+
96
+ def draw_contour_indexes(self, frame):
97
+ for idx, cnt in enumerate(self.contours):
98
+ M = cv2.moments(cnt)
99
+ if M["m00"] != 0:
100
+ cx = int(M["m10"] / M["m00"])
101
+ cy = int(M["m01"] / M["m00"])
102
+ cv2.putText(frame, str(idx + 1), (cx - 10, cy + 10), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 255, 0), 3)
103
+
104
+ def draw_contour_lengths(self, frame):
105
+ for cnt in self.contours:
106
+ points = cnt.reshape(-1, 2)
107
+ for i in range(len(points)):
108
+ p1 = points[i]
109
+ p2 = points[(i + 1) % len(points)]
110
+ dist = int(np.linalg.norm(p1 - p2))
111
+ mid = ((p1[0] + p2[0]) // 2, (p1[1] + p2[1]) // 2)
112
+ cv2.putText(frame, f"{dist}px", mid, cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 255), 1)
113
+
114
+ if self.current_contour:
115
+ pts = self.current_contour + [self.current_mouse_pos]
116
+ for i in range(len(pts) - 1):
117
+ cv2.line(frame, pts[i], pts[i + 1], (0, 255, 0), 1)
118
+
119
+ dist = int(np.linalg.norm(np.array(pts[i]) - np.array(pts[i + 1])))
120
+ mid = ((pts[i][0] + pts[i + 1][0]) // 2, (pts[i][1] + pts[i + 1][1]) // 2)
121
+ cv2.putText(frame, f"{dist}px", mid, cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
122
+
123
+ def print_area_summary(self):
124
+ info("🧮 Contour Areas")
125
+ for i, cnt in enumerate(self.contours):
126
+ area = cv2.contourArea(cnt)
127
+ info(f"Contour {i+1}: Area = {area:.2f}")
128
+
129
+ def save(self, path):
130
+ np.save(path, np.array(self.contours, dtype=object))
131
+ info(f"Contours saved to: {path}")
132
+
133
+ def load(self, path):
134
+ if os.path.exists(path):
135
+ loaded = np.load(path, allow_pickle=True)
136
+ self.contours = list(loaded)
137
+ info(f"Contours loaded from: {path}")
138
+ self.print_area_summary()
139
+ else:
140
+ info(f"File not found: {path}")
141
+
142
+
143
+ if __name__ == "__main__":
144
+ ui = MapContoursUI(os.environ["PATH_IMAGE"])
145
+ ui.load(os.environ["PATH_SAVE_CONTOURS"])
146
+ ui.draw()
147
+ ui.save(os.environ["PATH_SAVE_CONTOURS"])
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = '0.1.59'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sciveo
3
- Version: 0.1.58
3
+ Version: 0.1.59
4
4
  Description-Content-Type: text/markdown
5
5
  Provides-Extra: mon
6
6
  Provides-Extra: net
@@ -143,6 +143,8 @@ sciveo/tools/timers.py
143
143
  sciveo/tools/aws/__init__.py
144
144
  sciveo/tools/aws/priority_queue.py
145
145
  sciveo/tools/aws/s3.py
146
+ sciveo/tools/draw/__init__.py
147
+ sciveo/tools/draw/contours.py
146
148
  test/test_complexity.py
147
149
  test/test_compress.py
148
150
  test/test_configuration.py
@@ -1,2 +0,0 @@
1
-
2
- __version__ = '0.1.58'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes