openfocus 1.76.0__tar.gz → 2.0.0__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 (466) hide show
  1. {openfocus-1.76.0 → openfocus-2.0.0}/PKG-INFO +85 -25
  2. {openfocus-1.76.0 → openfocus-2.0.0}/README.md +79 -23
  3. openfocus-2.0.0/build_identity.py +2 -0
  4. {openfocus-1.76.0 → openfocus-2.0.0}/constants.py +14 -1
  5. openfocus-2.0.0/core/_alignment_kernels.py +204 -0
  6. openfocus-2.0.0/core/_background_focus_gpu.py +135 -0
  7. openfocus-2.0.0/core/_ecc_area_gpu.py +213 -0
  8. openfocus-2.0.0/core/accelerator_win64.json +83 -0
  9. openfocus-2.0.0/core/algorithm_adapters.py +199 -0
  10. {openfocus-1.76.0 → openfocus-2.0.0}/core/algorithms.py +433 -339
  11. openfocus-2.0.0/core/aligned_previews.py +122 -0
  12. openfocus-2.0.0/core/app.py +310 -0
  13. openfocus-2.0.0/core/background_fill.py +1788 -0
  14. openfocus-2.0.0/core/batch_converter.py +914 -0
  15. {openfocus-1.76.0 → openfocus-2.0.0}/core/cli.py +1124 -168
  16. {openfocus-1.76.0 → openfocus-2.0.0}/core/compare_worker.py +127 -21
  17. {openfocus-1.76.0 → openfocus-2.0.0}/core/control/client.py +15 -6
  18. {openfocus-1.76.0 → openfocus-2.0.0}/core/control/protocol.py +5 -2
  19. {openfocus-1.76.0 → openfocus-2.0.0}/core/control/server.py +1870 -1711
  20. {openfocus-1.76.0 → openfocus-2.0.0}/core/depth_map.py +30 -17
  21. openfocus-2.0.0/core/experimental.py +15 -0
  22. openfocus-2.0.0/core/focus_order.py +198 -0
  23. openfocus-2.0.0/core/frame_resolution_cache.py +551 -0
  24. openfocus-2.0.0/core/frame_storage.py +1069 -0
  25. openfocus-2.0.0/core/frame_transport.py +187 -0
  26. openfocus-2.0.0/core/fusion_diagnostics.py +23 -0
  27. {openfocus-1.76.0 → openfocus-2.0.0}/core/grouped_fusion.py +44 -11
  28. {openfocus-1.76.0 → openfocus-2.0.0}/core/image_loader.py +571 -160
  29. openfocus-2.0.0/core/inference_pack.py +367 -0
  30. openfocus-2.0.0/core/inference_process.py +45 -0
  31. openfocus-2.0.0/core/inference_tensorrt.py +303 -0
  32. openfocus-2.0.0/core/inference_worker.py +190 -0
  33. openfocus-2.0.0/core/mosaic.py +1287 -0
  34. openfocus-2.0.0/core/mosaic_blend.py +146 -0
  35. openfocus-2.0.0/core/mosaic_control.py +489 -0
  36. openfocus-2.0.0/core/mosaic_hdr.py +402 -0
  37. openfocus-2.0.0/core/mosaic_photo.py +515 -0
  38. openfocus-2.0.0/core/mosaic_projection.py +597 -0
  39. openfocus-2.0.0/core/mosaic_seam.py +292 -0
  40. openfocus-2.0.0/core/mosaic_stitcher.py +475 -0
  41. {openfocus-1.76.0 → openfocus-2.0.0}/core/multi_focus_fusion.py +809 -265
  42. openfocus-2.0.0/core/openfocus_alignment.py +1252 -0
  43. {openfocus-1.76.0 → openfocus-2.0.0}/core/recipes.py +98 -16
  44. {openfocus-1.76.0 → openfocus-2.0.0}/core/registration.py +767 -516
  45. openfocus-2.0.0/core/registration_errors.py +19 -0
  46. openfocus-2.0.0/core/render_context.py +533 -0
  47. openfocus-2.0.0/core/render_preflight.py +198 -0
  48. openfocus-2.0.0/core/render_process.py +544 -0
  49. {openfocus-1.76.0 → openfocus-2.0.0}/core/resource_policy.py +350 -41
  50. openfocus-2.0.0/core/scratch_registry.py +505 -0
  51. openfocus-2.0.0/core/source_frames.py +1733 -0
  52. openfocus-2.0.0/core/source_previews.py +445 -0
  53. {openfocus-1.76.0 → openfocus-2.0.0}/core/stack_review.py +6 -1
  54. openfocus-2.0.0/core/storage_preflight.py +51 -0
  55. openfocus-2.0.0/core/windows_shell.py +199 -0
  56. {openfocus-1.76.0 → openfocus-2.0.0}/core/workers.py +796 -210
  57. {openfocus-1.76.0 → openfocus-2.0.0}/docs/THIRD_PARTY_NOTICES.md +67 -0
  58. openfocus-2.0.0/fusion_methods/_dct_kernels.py +182 -0
  59. openfocus-2.0.0/fusion_methods/_depth_kernel.py +186 -0
  60. openfocus-2.0.0/fusion_methods/_dtcwt_kernels.py +48 -0
  61. openfocus-2.0.0/fusion_methods/_gff_kernels.py +467 -0
  62. openfocus-2.0.0/fusion_methods/_gfg_kernels.py +604 -0
  63. openfocus-2.0.0/fusion_methods/_openfocus_depth_rows.py +178 -0
  64. openfocus-2.0.0/fusion_methods/_openfocus_execution.py +236 -0
  65. openfocus-2.0.0/fusion_methods/_openfocus_gpu.py +1130 -0
  66. openfocus-2.0.0/fusion_methods/_openfocus_gpu_a.py +512 -0
  67. openfocus-2.0.0/fusion_methods/_openfocus_gpu_c.py +471 -0
  68. openfocus-2.0.0/fusion_methods/_openfocus_gpu_dct.py +527 -0
  69. openfocus-2.0.0/fusion_methods/_openfocus_gpu_dtcwt.py +1743 -0
  70. openfocus-2.0.0/fusion_methods/_openfocus_gpu_gff.py +896 -0
  71. openfocus-2.0.0/fusion_methods/_openfocus_gpu_gfg.py +984 -0
  72. openfocus-2.0.0/fusion_methods/_openfocus_kernels.py +285 -0
  73. openfocus-2.0.0/fusion_methods/_openfocus_pixels.py +126 -0
  74. openfocus-2.0.0/fusion_methods/_openfocus_pyramid.py +270 -0
  75. openfocus-2.0.0/fusion_methods/_openfocus_resample.py +316 -0
  76. openfocus-2.0.0/fusion_methods/dct.py +380 -0
  77. {openfocus-1.76.0 → openfocus-2.0.0}/fusion_methods/dtcwt.py +539 -510
  78. openfocus-2.0.0/fusion_methods/gff.py +363 -0
  79. {openfocus-1.76.0 → openfocus-2.0.0}/fusion_methods/gfg_fgf.py +280 -127
  80. openfocus-2.0.0/fusion_methods/inference_client.py +152 -0
  81. {openfocus-1.76.0 → openfocus-2.0.0}/fusion_methods/neural_common.py +88 -43
  82. openfocus-2.0.0/fusion_methods/neural_runtime.py +815 -0
  83. openfocus-2.0.0/fusion_methods/openfocus_a.py +420 -0
  84. openfocus-2.0.0/fusion_methods/openfocus_ab.py +303 -0
  85. openfocus-2.0.0/fusion_methods/openfocus_bc.py +277 -0
  86. openfocus-2.0.0/fusion_methods/openfocus_depth.py +413 -0
  87. {openfocus-1.76.0 → openfocus-2.0.0}/fusion_methods/stackmff_v1.py +9 -12
  88. {openfocus-1.76.0 → openfocus-2.0.0}/fusion_methods/stackmff_v2.py +49 -35
  89. openfocus-2.0.0/fusion_methods/stackmff_v2_tiled.py +301 -0
  90. {openfocus-1.76.0 → openfocus-2.0.0}/fusion_methods/stackmffv3.py +61 -76
  91. openfocus-2.0.0/locales/__init__.py +426 -0
  92. {openfocus-1.76.0 → openfocus-2.0.0}/locales/_extra.py +1180 -82
  93. {openfocus-1.76.0 → openfocus-2.0.0}/locales/de.py +590 -41
  94. {openfocus-1.76.0 → openfocus-2.0.0}/locales/en.py +594 -44
  95. {openfocus-1.76.0 → openfocus-2.0.0}/locales/fr.py +590 -41
  96. {openfocus-1.76.0 → openfocus-2.0.0}/locales/it.py +590 -41
  97. {openfocus-1.76.0 → openfocus-2.0.0}/locales/ko.py +590 -41
  98. {openfocus-1.76.0 → openfocus-2.0.0}/locales/nl.py +590 -41
  99. {openfocus-1.76.0 → openfocus-2.0.0}/locales/pl.py +590 -41
  100. {openfocus-1.76.0 → openfocus-2.0.0}/locales/pt.py +590 -41
  101. {openfocus-1.76.0 → openfocus-2.0.0}/locales/ru.py +590 -41
  102. {openfocus-1.76.0 → openfocus-2.0.0}/locales/zh.py +592 -42
  103. {openfocus-1.76.0 → openfocus-2.0.0}/openfocus.egg-info/PKG-INFO +85 -25
  104. {openfocus-1.76.0 → openfocus-2.0.0}/openfocus.egg-info/SOURCES.txt +181 -2
  105. {openfocus-1.76.0 → openfocus-2.0.0}/openfocus.egg-info/requires.txt +7 -1
  106. {openfocus-1.76.0 → openfocus-2.0.0}/openfocus.egg-info/top_level.txt +1 -0
  107. {openfocus-1.76.0 → openfocus-2.0.0}/pyproject.toml +16 -16
  108. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_16bit_and_cache.py +58 -4
  109. openfocus-2.0.0/tests/test_account_client.py +1409 -0
  110. openfocus-2.0.0/tests/test_account_reporting_gui.py +746 -0
  111. openfocus-2.0.0/tests/test_activity_logging.py +143 -0
  112. openfocus-2.0.0/tests/test_agent_tools.py +148 -0
  113. openfocus-2.0.0/tests/test_algorithm_bench.py +111 -0
  114. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_algorithm_surfaces.py +485 -291
  115. openfocus-2.0.0/tests/test_algorithms.py +352 -0
  116. openfocus-2.0.0/tests/test_alignment_cache_atomic.py +510 -0
  117. openfocus-2.0.0/tests/test_alignment_diagnostics_gui.py +27 -0
  118. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_app_paths.py +39 -3
  119. openfocus-2.0.0/tests/test_application_wheel_guard.py +162 -0
  120. openfocus-2.0.0/tests/test_background_fill.py +1027 -0
  121. openfocus-2.0.0/tests/test_background_fill_exposure.py +51 -0
  122. openfocus-2.0.0/tests/test_background_fill_history.py +674 -0
  123. openfocus-2.0.0/tests/test_background_fill_memory.py +216 -0
  124. openfocus-2.0.0/tests/test_background_focus_gpu.py +98 -0
  125. openfocus-2.0.0/tests/test_batch_converter.py +1728 -0
  126. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_batch_drag_drop.py +348 -13
  127. openfocus-2.0.0/tests/test_batch_export_contract.py +1164 -0
  128. openfocus-2.0.0/tests/test_bounded_image_export.py +645 -0
  129. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_cfa_dng.py +244 -196
  130. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_cli.py +103 -6
  131. openfocus-2.0.0/tests/test_cli_engineering.py +1471 -0
  132. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_cli_native_raw.py +9 -22
  133. openfocus-2.0.0/tests/test_cli_profile.py +84 -0
  134. openfocus-2.0.0/tests/test_cli_storage.py +290 -0
  135. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_compare_canvas.py +48 -18
  136. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_compare_dialog.py +567 -46
  137. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_compare_worker.py +120 -17
  138. openfocus-2.0.0/tests/test_compiler_cache.py +42 -0
  139. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_control_channel.py +1144 -48
  140. openfocus-2.0.0/tests/test_control_text_input.py +93 -0
  141. openfocus-2.0.0/tests/test_converter_output_options.py +205 -0
  142. openfocus-2.0.0/tests/test_crash_report.py +167 -0
  143. openfocus-2.0.0/tests/test_dct_gpu.py +487 -0
  144. openfocus-2.0.0/tests/test_debug_logging.py +192 -0
  145. openfocus-2.0.0/tests/test_deferred_registration.py +727 -0
  146. openfocus-2.0.0/tests/test_depth_cache_lock.py +90 -0
  147. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_depth_dialog.py +302 -34
  148. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_depth_map.py +153 -41
  149. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_diagnostics.py +113 -5
  150. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_display_paths.py +38 -2
  151. openfocus-2.0.0/tests/test_dng_display_preview.py +354 -0
  152. openfocus-2.0.0/tests/test_downsample_dimensions.py +268 -0
  153. openfocus-2.0.0/tests/test_dtcwt_gpu.py +382 -0
  154. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_dtcwt_parallel.py +248 -244
  155. openfocus-2.0.0/tests/test_ecc_area_gpu.py +111 -0
  156. openfocus-2.0.0/tests/test_ecc_parallel_prepare.py +419 -0
  157. openfocus-2.0.0/tests/test_exif_attribution.py +237 -0
  158. openfocus-2.0.0/tests/test_experimental_features.py +207 -0
  159. openfocus-2.0.0/tests/test_explorer_import.py +234 -0
  160. openfocus-2.0.0/tests/test_export_stackmff_publication.py +31 -0
  161. openfocus-2.0.0/tests/test_feather_visual_tool.py +28 -0
  162. openfocus-2.0.0/tests/test_file_dialogs.py +605 -0
  163. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_flat_field_workflow.py +109 -13
  164. openfocus-2.0.0/tests/test_focus_order.py +71 -0
  165. openfocus-2.0.0/tests/test_fonts.py +127 -0
  166. openfocus-2.0.0/tests/test_frame_resolution_cache.py +457 -0
  167. openfocus-2.0.0/tests/test_frame_storage_admission.py +762 -0
  168. openfocus-2.0.0/tests/test_frame_transfer.py +318 -0
  169. openfocus-2.0.0/tests/test_frozen_cli_smoke.py +43 -0
  170. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_fusion_methods.py +271 -19
  171. openfocus-2.0.0/tests/test_fusion_sources.py +685 -0
  172. openfocus-2.0.0/tests/test_gfg_fgf_gpu.py +503 -0
  173. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_grouped_fusion.py +92 -11
  174. openfocus-2.0.0/tests/test_gui_lifecycle.py +245 -0
  175. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_gui_units.py +572 -50
  176. openfocus-2.0.0/tests/test_guided_filter_gpu.py +436 -0
  177. openfocus-2.0.0/tests/test_help_manual.py +35 -0
  178. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_i18n_packs.py +74 -0
  179. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_icc_profiles.py +43 -11
  180. openfocus-2.0.0/tests/test_image_write_metadata_errors.py +137 -0
  181. openfocus-2.0.0/tests/test_inference_dispatch.py +191 -0
  182. openfocus-2.0.0/tests/test_inference_pack.py +124 -0
  183. openfocus-2.0.0/tests/test_input_formats.py +348 -0
  184. openfocus-2.0.0/tests/test_label_native_preview.py +295 -0
  185. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_labels.py +157 -0
  186. openfocus-2.0.0/tests/test_lang_ui_audit.py +121 -0
  187. openfocus-2.0.0/tests/test_launch_film_cleanup.py +42 -0
  188. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_layered_export_gui.py +142 -2
  189. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_layered_tiff.py +37 -0
  190. openfocus-2.0.0/tests/test_lazy_project_consumers.py +389 -0
  191. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_lazy_render_workers.py +264 -128
  192. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_linear_desktop_integration.py +106 -4
  193. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_linear_dng.py +49 -1
  194. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_linear_folder_load.py +42 -2
  195. openfocus-2.0.0/tests/test_linear_raw_selection_gui.py +269 -0
  196. openfocus-2.0.0/tests/test_linux_desktop_integration.py +66 -0
  197. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_loader_parallel.py +91 -0
  198. openfocus-2.0.0/tests/test_localized_release_notes.py +75 -0
  199. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_logging_setup.py +30 -14
  200. openfocus-2.0.0/tests/test_machine_preferences.py +43 -0
  201. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_magnifier_coordinates.py +127 -14
  202. openfocus-2.0.0/tests/test_memory_guard.py +354 -0
  203. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_menu_translations.py +87 -28
  204. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_mesh_export.py +83 -0
  205. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_mosaic.py +277 -7
  206. openfocus-2.0.0/tests/test_mosaic_control.py +295 -0
  207. openfocus-2.0.0/tests/test_mosaic_editors.py +377 -0
  208. openfocus-2.0.0/tests/test_mosaic_hdr.py +385 -0
  209. openfocus-2.0.0/tests/test_mosaic_photo.py +498 -0
  210. openfocus-2.0.0/tests/test_mosaic_pipeline.py +333 -0
  211. openfocus-2.0.0/tests/test_mosaic_projection.py +412 -0
  212. openfocus-2.0.0/tests/test_mosaic_seam.py +189 -0
  213. openfocus-2.0.0/tests/test_mosaic_stitcher.py +162 -0
  214. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_multipage_and_recovery.py +51 -0
  215. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_neural_backend_admission.py +10 -2
  216. openfocus-2.0.0/tests/test_neural_runtime.py +1120 -0
  217. openfocus-2.0.0/tests/test_neural_streaming.py +280 -0
  218. openfocus-2.0.0/tests/test_openfocus_a_soft.py +79 -0
  219. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_openfocus_ab.py +352 -146
  220. openfocus-2.0.0/tests/test_openfocus_alignment.py +290 -0
  221. openfocus-2.0.0/tests/test_openfocus_band_consumers.py +179 -0
  222. openfocus-2.0.0/tests/test_openfocus_depth_rows.py +40 -0
  223. openfocus-2.0.0/tests/test_openfocus_geometry.py +22 -0
  224. openfocus-2.0.0/tests/test_openfocus_gpu.py +532 -0
  225. openfocus-2.0.0/tests/test_openfocus_native_resample.py +162 -0
  226. openfocus-2.0.0/tests/test_openfocus_parity.py +147 -0
  227. openfocus-2.0.0/tests/test_openfocus_resample_rows.py +198 -0
  228. openfocus-2.0.0/tests/test_openfocus_row_execution.py +509 -0
  229. openfocus-2.0.0/tests/test_openfocus_streaming.py +836 -0
  230. openfocus-2.0.0/tests/test_openfocus_wide_alignment.py +547 -0
  231. openfocus-2.0.0/tests/test_ort_operator_trace.py +64 -0
  232. openfocus-2.0.0/tests/test_output_label_publication.py +72 -0
  233. openfocus-2.0.0/tests/test_output_selection_binding.py +37 -0
  234. openfocus-2.0.0/tests/test_output_sharing.py +757 -0
  235. openfocus-2.0.0/tests/test_output_sharpen.py +209 -0
  236. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_packaging_contract.py +57 -1
  237. openfocus-2.0.0/tests/test_packaging_report.py +107 -0
  238. openfocus-2.0.0/tests/test_parameter_help.py +86 -0
  239. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_parameter_memory.py +441 -269
  240. openfocus-2.0.0/tests/test_path_identity.py +49 -0
  241. openfocus-2.0.0/tests/test_performance_profile.py +346 -0
  242. openfocus-2.0.0/tests/test_performance_profile_classical.py +132 -0
  243. openfocus-2.0.0/tests/test_performance_profile_fusion.py +137 -0
  244. openfocus-2.0.0/tests/test_performance_profile_render.py +140 -0
  245. openfocus-2.0.0/tests/test_planned_tile_overlap.py +122 -0
  246. openfocus-2.0.0/tests/test_project_dirty.py +121 -0
  247. openfocus-2.0.0/tests/test_project_dirty_settings.py +330 -0
  248. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_project_file.py +122 -2
  249. openfocus-2.0.0/tests/test_publish_release.py +207 -0
  250. openfocus-2.0.0/tests/test_raw_input.py +419 -0
  251. openfocus-2.0.0/tests/test_recipes.py +484 -0
  252. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_registration.py +103 -43
  253. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_registration_resources.py +223 -14
  254. openfocus-2.0.0/tests/test_release_archives.py +679 -0
  255. openfocus-2.0.0/tests/test_release_metadata.py +339 -0
  256. openfocus-2.0.0/tests/test_release_workflows.py +247 -0
  257. openfocus-2.0.0/tests/test_render_after_load.py +335 -0
  258. openfocus-2.0.0/tests/test_render_context_roi.py +170 -0
  259. openfocus-2.0.0/tests/test_render_process.py +1127 -0
  260. openfocus-2.0.0/tests/test_render_setting_lock_and_preview_export.py +112 -0
  261. openfocus-2.0.0/tests/test_report_bundle.py +285 -0
  262. openfocus-2.0.0/tests/test_report_client.py +439 -0
  263. openfocus-2.0.0/tests/test_report_concurrency.py +348 -0
  264. openfocus-2.0.0/tests/test_report_lock.py +141 -0
  265. openfocus-2.0.0/tests/test_required_account.py +169 -0
  266. openfocus-2.0.0/tests/test_resource_policy.py +866 -0
  267. openfocus-2.0.0/tests/test_retained_frames.py +309 -0
  268. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_retouch.py +1750 -1140
  269. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_retouch_checkpoint.py +174 -0
  270. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_retouch_checkpoint_gui.py +521 -318
  271. openfocus-2.0.0/tests/test_retouch_export.py +285 -0
  272. openfocus-2.0.0/tests/test_retouch_navigation_previews.py +129 -0
  273. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_retouch_replay_cli.py +114 -0
  274. openfocus-2.0.0/tests/test_retouch_ui_contract.py +130 -0
  275. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_review_round2.py +45 -2
  276. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_review_round3.py +1 -1
  277. openfocus-2.0.0/tests/test_roi_deferred_consumers.py +379 -0
  278. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_scalebar.py +428 -13
  279. openfocus-2.0.0/tests/test_scratch_registry.py +464 -0
  280. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_sensor_cleanup_workers.py +56 -11
  281. openfocus-2.0.0/tests/test_settings_session_isolation.py +97 -0
  282. openfocus-2.0.0/tests/test_settings_tools.py +1390 -0
  283. openfocus-2.0.0/tests/test_sharpness_previews.py +258 -0
  284. openfocus-2.0.0/tests/test_site_download.py +61 -0
  285. openfocus-2.0.0/tests/test_site_worker.py +140 -0
  286. openfocus-2.0.0/tests/test_soak_status.py +32 -0
  287. openfocus-2.0.0/tests/test_source_exif_undo.py +145 -0
  288. openfocus-2.0.0/tests/test_source_frames.py +1321 -0
  289. openfocus-2.0.0/tests/test_source_hover.py +81 -0
  290. openfocus-2.0.0/tests/test_source_open_supervision.py +74 -0
  291. openfocus-2.0.0/tests/test_source_regions.py +910 -0
  292. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_stack_reset.py +163 -7
  293. openfocus-2.0.0/tests/test_stack_review.py +69 -0
  294. openfocus-2.0.0/tests/test_stack_review_gui.py +617 -0
  295. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_stack_tools.py +6 -6
  296. openfocus-2.0.0/tests/test_stackmff_cpu_benchmark.py +287 -0
  297. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_stackmff_models.py +15 -9
  298. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_standalone_retouch.py +98 -0
  299. openfocus-2.0.0/tests/test_storage_preflight.py +782 -0
  300. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_streaming_backends.py +41 -23
  301. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_torch_backend.py +26 -32
  302. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_transparency.py +9 -14
  303. openfocus-2.0.0/tests/test_ui_audit.py +69 -0
  304. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_ui_layout.py +170 -92
  305. openfocus-2.0.0/tests/test_ui_perf_probe.py +76 -0
  306. openfocus-2.0.0/tests/test_ui_themes.py +679 -0
  307. openfocus-2.0.0/tests/test_update_contract.py +692 -0
  308. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_update_flow.py +153 -99
  309. openfocus-2.0.0/tests/test_updater.py +628 -0
  310. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_usage_analytics.py +31 -0
  311. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_v116_units.py +60 -37
  312. openfocus-2.0.0/tests/test_view_input_regressions.py +175 -0
  313. openfocus-2.0.0/tests/test_watermark.py +761 -0
  314. openfocus-2.0.0/tests/test_watermark_gui.py +1218 -0
  315. openfocus-2.0.0/tests/test_watermark_recovery.py +204 -0
  316. openfocus-2.0.0/tests/test_window_geometry.py +226 -0
  317. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_wipe_compare.py +199 -10
  318. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_worker_diagnostics.py +62 -13
  319. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_worker_lifecycle.py +158 -62
  320. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_workflow_project_contract.py +660 -453
  321. openfocus-2.0.0/tests/test_zoom_anchor.py +274 -0
  322. openfocus-2.0.0/utils/_account_callback_page.py +163 -0
  323. openfocus-2.0.0/utils/account_client.py +1035 -0
  324. openfocus-2.0.0/utils/align_cache.py +574 -0
  325. {openfocus-1.76.0 → openfocus-2.0.0}/utils/app_paths.py +34 -2
  326. {openfocus-1.76.0 → openfocus-2.0.0}/utils/design_tokens.py +68 -4
  327. {openfocus-1.76.0 → openfocus-2.0.0}/utils/diagnostics.py +132 -21
  328. {openfocus-1.76.0 → openfocus-2.0.0}/utils/dust_map.py +43 -3
  329. openfocus-2.0.0/utils/export_paths.py +139 -0
  330. openfocus-2.0.0/utils/file_dialogs.py +565 -0
  331. openfocus-2.0.0/utils/file_manager.py +179 -0
  332. {openfocus-1.76.0 → openfocus-2.0.0}/utils/fonts.py +90 -70
  333. openfocus-2.0.0/utils/frame_pixels.py +199 -0
  334. openfocus-2.0.0/utils/image_utils.py +1244 -0
  335. {openfocus-1.76.0 → openfocus-2.0.0}/utils/layered_tiff.py +43 -11
  336. {openfocus-1.76.0 → openfocus-2.0.0}/utils/linear_dng.py +847 -766
  337. {openfocus-1.76.0 → openfocus-2.0.0}/utils/logging_setup.py +118 -25
  338. {openfocus-1.76.0 → openfocus-2.0.0}/utils/memory.py +123 -19
  339. {openfocus-1.76.0 → openfocus-2.0.0}/utils/mesh_export.py +124 -25
  340. openfocus-2.0.0/utils/output_share.py +112 -0
  341. openfocus-2.0.0/utils/output_sharpen.py +41 -0
  342. openfocus-2.0.0/utils/path_identity.py +42 -0
  343. openfocus-2.0.0/utils/performance_profile.py +615 -0
  344. {openfocus-1.76.0 → openfocus-2.0.0}/utils/platform_utils.py +47 -126
  345. {openfocus-1.76.0 → openfocus-2.0.0}/utils/project_file.py +239 -59
  346. {openfocus-1.76.0 → openfocus-2.0.0}/utils/recovery.py +7 -3
  347. openfocus-2.0.0/utils/release_notes.py +331 -0
  348. openfocus-2.0.0/utils/report_bundle.py +555 -0
  349. openfocus-2.0.0/utils/report_client.py +447 -0
  350. openfocus-2.0.0/utils/reporting.py +71 -0
  351. openfocus-2.0.0/utils/retouch.py +1405 -0
  352. openfocus-2.0.0/utils/retouch_checkpoint.py +836 -0
  353. {openfocus-1.76.0 → openfocus-2.0.0}/utils/scalebar.py +111 -65
  354. {openfocus-1.76.0 → openfocus-2.0.0}/utils/self_update.py +138 -182
  355. {openfocus-1.76.0 → openfocus-2.0.0}/utils/settings_store.py +366 -20
  356. {openfocus-1.76.0 → openfocus-2.0.0}/utils/sorting.py +2 -2
  357. {openfocus-1.76.0 → openfocus-2.0.0}/utils/standalone_retouch.py +43 -5
  358. {openfocus-1.76.0 → openfocus-2.0.0}/utils/ui_utils.py +22 -0
  359. {openfocus-1.76.0 → openfocus-2.0.0}/utils/updater.py +159 -53
  360. {openfocus-1.76.0 → openfocus-2.0.0}/utils/usage_analytics.py +20 -8
  361. openfocus-2.0.0/utils/watermark.py +1041 -0
  362. openfocus-2.0.0/weights/stackmff_final.pth +0 -0
  363. openfocus-2.0.0/weights/stackmff_v2_final.pth +0 -0
  364. openfocus-2.0.0/weights/stackmff_v3_final.pth +0 -0
  365. openfocus-1.76.0/core/algorithm_adapters.py +0 -129
  366. openfocus-1.76.0/core/app.py +0 -162
  367. openfocus-1.76.0/core/batch_converter.py +0 -535
  368. openfocus-1.76.0/core/frame_storage.py +0 -82
  369. openfocus-1.76.0/core/mosaic.py +0 -321
  370. openfocus-1.76.0/core/openfocus_align.py +0 -132
  371. openfocus-1.76.0/core/render_context.py +0 -301
  372. openfocus-1.76.0/core/source_frames.py +0 -601
  373. openfocus-1.76.0/core/source_previews.py +0 -61
  374. openfocus-1.76.0/fusion_methods/dct.py +0 -272
  375. openfocus-1.76.0/fusion_methods/gff.py +0 -259
  376. openfocus-1.76.0/fusion_methods/neural_runtime.py +0 -306
  377. openfocus-1.76.0/fusion_methods/openfocus_a.py +0 -93
  378. openfocus-1.76.0/fusion_methods/openfocus_ab.py +0 -163
  379. openfocus-1.76.0/fusion_methods/openfocus_bc.py +0 -157
  380. openfocus-1.76.0/fusion_methods/openfocus_depth.py +0 -174
  381. openfocus-1.76.0/fusion_methods/stackmff_v2_tiled.py +0 -209
  382. openfocus-1.76.0/locales/__init__.py +0 -155
  383. openfocus-1.76.0/tests/test_algorithms.py +0 -150
  384. openfocus-1.76.0/tests/test_alignment_cache_atomic.py +0 -178
  385. openfocus-1.76.0/tests/test_alignment_diagnostics_gui.py +0 -118
  386. openfocus-1.76.0/tests/test_batch_converter.py +0 -822
  387. openfocus-1.76.0/tests/test_batch_export_contract.py +0 -576
  388. openfocus-1.76.0/tests/test_cli_engineering.py +0 -730
  389. openfocus-1.76.0/tests/test_file_dialogs.py +0 -236
  390. openfocus-1.76.0/tests/test_frame_storage_admission.py +0 -296
  391. openfocus-1.76.0/tests/test_lazy_project_consumers.py +0 -174
  392. openfocus-1.76.0/tests/test_linear_raw_selection_gui.py +0 -115
  393. openfocus-1.76.0/tests/test_memory_guard.py +0 -164
  394. openfocus-1.76.0/tests/test_neural_runtime.py +0 -201
  395. openfocus-1.76.0/tests/test_neural_streaming.py +0 -113
  396. openfocus-1.76.0/tests/test_output_sharpen.py +0 -102
  397. openfocus-1.76.0/tests/test_project_dirty.py +0 -96
  398. openfocus-1.76.0/tests/test_raw_input.py +0 -78
  399. openfocus-1.76.0/tests/test_recipes.py +0 -240
  400. openfocus-1.76.0/tests/test_release_archives.py +0 -284
  401. openfocus-1.76.0/tests/test_release_metadata.py +0 -73
  402. openfocus-1.76.0/tests/test_resource_policy.py +0 -398
  403. openfocus-1.76.0/tests/test_settings_tools.py +0 -776
  404. openfocus-1.76.0/tests/test_site_worker.py +0 -54
  405. openfocus-1.76.0/tests/test_source_frames.py +0 -403
  406. openfocus-1.76.0/tests/test_stack_review.py +0 -31
  407. openfocus-1.76.0/tests/test_stack_review_gui.py +0 -236
  408. openfocus-1.76.0/tests/test_ui_themes.py +0 -73
  409. openfocus-1.76.0/tests/test_update_contract.py +0 -306
  410. openfocus-1.76.0/tests/test_updater.py +0 -363
  411. openfocus-1.76.0/tests/test_window_geometry.py +0 -43
  412. openfocus-1.76.0/tests/test_zoom_anchor.py +0 -142
  413. openfocus-1.76.0/utils/align_cache.py +0 -239
  414. openfocus-1.76.0/utils/export_paths.py +0 -67
  415. openfocus-1.76.0/utils/file_dialogs.py +0 -102
  416. openfocus-1.76.0/utils/frame_pixels.py +0 -89
  417. openfocus-1.76.0/utils/image_utils.py +0 -808
  418. openfocus-1.76.0/utils/output_sharpen.py +0 -25
  419. openfocus-1.76.0/utils/path_identity.py +0 -13
  420. openfocus-1.76.0/utils/retouch.py +0 -800
  421. openfocus-1.76.0/utils/retouch_checkpoint.py +0 -274
  422. {openfocus-1.76.0 → openfocus-2.0.0}/LICENSE +0 -0
  423. {openfocus-1.76.0 → openfocus-2.0.0}/core/__init__.py +0 -0
  424. {openfocus-1.76.0 → openfocus-2.0.0}/core/control/__init__.py +0 -0
  425. {openfocus-1.76.0 → openfocus-2.0.0}/core/control/color_dialogs.py +0 -0
  426. {openfocus-1.76.0 → openfocus-2.0.0}/core/depth_products.py +0 -0
  427. {openfocus-1.76.0 → openfocus-2.0.0}/core/models/__init__.py +0 -0
  428. {openfocus-1.76.0 → openfocus-2.0.0}/core/models/stackmff_v1/__init__.py +0 -0
  429. {openfocus-1.76.0 → openfocus-2.0.0}/core/models/stackmff_v1/network.py +0 -0
  430. {openfocus-1.76.0 → openfocus-2.0.0}/core/models/stackmff_v2/__init__.py +0 -0
  431. {openfocus-1.76.0 → openfocus-2.0.0}/core/models/stackmff_v2/network.py +0 -0
  432. {openfocus-1.76.0 → openfocus-2.0.0}/core/models/stackmff_v3/__init__.py +0 -0
  433. {openfocus-1.76.0 → openfocus-2.0.0}/core/models/stackmff_v3/model_io.py +0 -0
  434. {openfocus-1.76.0 → openfocus-2.0.0}/core/models/stackmff_v3/network.py +0 -0
  435. {openfocus-1.76.0 → openfocus-2.0.0}/core/torch_backend.py +0 -0
  436. {openfocus-1.76.0 → openfocus-2.0.0}/core/transparency.py +0 -0
  437. {openfocus-1.76.0 → openfocus-2.0.0}/fusion_methods/__init__.py +0 -0
  438. {openfocus-1.76.0 → openfocus-2.0.0}/openfocus.egg-info/dependency_links.txt +0 -0
  439. {openfocus-1.76.0 → openfocus-2.0.0}/openfocus.egg-info/entry_points.txt +0 -0
  440. {openfocus-1.76.0 → openfocus-2.0.0}/setup.cfg +0 -0
  441. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_annotation_removal.py +0 -0
  442. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_atomic_image_export.py +0 -0
  443. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_dtcwt_determinism.py +0 -0
  444. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_exif_16bit_export.py +0 -0
  445. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_exif_orientation.py +0 -0
  446. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_frame_list.py +0 -0
  447. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_gff_frame_skip.py +0 -0
  448. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_gfg_fgf.py +0 -0
  449. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_golden.py +0 -0
  450. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_gpu_distribution.py +0 -0
  451. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_i18n_placeholders.py +0 -0
  452. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_label_range.py +0 -0
  453. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_magnifier_wheel_size.py +0 -0
  454. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_output_list.py +0 -0
  455. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_sensor_cleanup.py +0 -0
  456. {openfocus-1.76.0 → openfocus-2.0.0}/tests/test_stackmffv3.py +0 -0
  457. {openfocus-1.76.0 → openfocus-2.0.0}/utils/__init__.py +0 -0
  458. {openfocus-1.76.0 → openfocus-2.0.0}/utils/colormap.py +0 -0
  459. {openfocus-1.76.0 → openfocus-2.0.0}/utils/label_model.py +0 -0
  460. {openfocus-1.76.0 → openfocus-2.0.0}/utils/sensor_cleanup.py +0 -0
  461. {openfocus-1.76.0 → openfocus-2.0.0}/utils/validators.py +0 -0
  462. {openfocus-1.76.0 → openfocus-2.0.0}/utils/weights.py +0 -0
  463. {openfocus-1.76.0 → openfocus-2.0.0}/weights/__init__.py +0 -0
  464. {openfocus-1.76.0 → openfocus-2.0.0}/weights/stackmff_final.onnx +0 -0
  465. {openfocus-1.76.0 → openfocus-2.0.0}/weights/stackmff_v2_final.onnx +0 -0
  466. {openfocus-1.76.0 → openfocus-2.0.0}/weights/stackmff_v3_final.onnx +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openfocus
3
- Version: 1.76.0
3
+ Version: 2.0.0
4
4
  Summary: Multi-focus image fusion from the command line, with registration, classical methods, OpenFocus A/B/C and neural models
5
5
  Author-email: Xinzhe Xie <xiexinzheyyy@163.com>
6
6
  License-Expression: MIT AND LicenseRef-StackMFF-V3-1.0
@@ -22,16 +22,20 @@ License-File: docs/THIRD_PARTY_NOTICES.md
22
22
  Requires-Dist: numpy
23
23
  Requires-Dist: opencv-python-headless
24
24
  Requires-Dist: scipy
25
- Requires-Dist: dtcwt; python_version < "3.13"
25
+ Requires-Dist: dtcwt==0.14.0; python_version < "3.13"
26
+ Requires-Dist: six
26
27
  Requires-Dist: imageio
27
28
  Requires-Dist: Pillow
28
29
  Requires-Dist: psdtags==2024.5.24
29
30
  Requires-Dist: tifffile==2024.8.30
31
+ Requires-Dist: imagecodecs>=2024.9.22
30
32
  Requires-Dist: onnxruntime-directml==1.23.0; sys_platform == "win32" and platform_machine == "AMD64"
31
33
  Requires-Dist: onnxruntime<1.24,>=1.23; sys_platform != "win32" or platform_machine != "AMD64"
32
34
  Requires-Dist: pillow-heif
33
35
  Requires-Dist: rawpy>=0.25.1
34
36
  Requires-Dist: threadpoolctl>=3.5
37
+ Requires-Dist: numba>=0.61.2
38
+ Requires-Dist: pyopencl>=2025.2.7; sys_platform == "win32" or sys_platform == "darwin" or sys_platform == "linux"
35
39
  Dynamic: license-file
36
40
 
37
41
  <p align="center">
@@ -58,7 +62,7 @@ Dynamic: license-file
58
62
  <p align="center">
59
63
  <img src="https://img.shields.io/badge/Windows-10%2F11-0078D7?logo=windows&logoColor=white" alt="Windows 10/11">
60
64
  <img src="https://img.shields.io/badge/macOS-Apple%20Silicon-000000?logo=apple&logoColor=white" alt="macOS Apple Silicon">
61
- <img src="https://img.shields.io/badge/Linux-CLI-FCC624?logo=linux&logoColor=black" alt="Linux CLI">
65
+ <img src="https://img.shields.io/badge/Linux-x86--64-FCC624?logo=linux&logoColor=black" alt="Linux x86-64 desktop and CLI">
62
66
  <a href="https://pypi.org/project/openfocus/"><img src="https://img.shields.io/badge/PyPI-openfocus-3775A9?logo=pypi&logoColor=white" alt="PyPI"></a>
63
67
  </p>
64
68
 
@@ -91,9 +95,7 @@ Dynamic: license-file
91
95
  ## 📢 News
92
96
 
93
97
  > [!NOTE]
94
- > **v1.75.0** — Grouped fusion, reusable processing workflows, transparent PNG
95
- > stacks, alignment diagnostics, enhanced depth exports and a refreshed desktop
96
- > workflow. See the changelog for supported inputs and feature limitations.
98
+ > **OpenFocus 2.0.0** adds a Linux desktop build, GPU acceleration for OpenFocus A/B/C on compatible devices, and original-pixel inspection with reusable method comparisons. [Download](https://openfocus.top/#download) · [Changelog](./CHANGELOG.md#200)
97
99
 
98
100
  Earlier releases are in the [Changelog](./CHANGELOG.md).
99
101
 
@@ -172,7 +174,7 @@ Create depth maps, calibrate physical Z, and export textured 3D surfaces.
172
174
 
173
175
  ### Source-locked retouch
174
176
 
175
- Paint details from contributing source frames onto the fused result.
177
+ Paint details from contributing source frames onto the fused result. Auto background swaps a messy stacked background for one real frame and shows where no frame saw the scene clearly.
176
178
 
177
179
  </td>
178
180
  <td width="54%">
@@ -245,19 +247,24 @@ Control the desktop app through a token-protected local channel.
245
247
 
246
248
  **Also in the box:**
247
249
 
248
- - **Workflow** — stack browser, sharpness curve, previews, ROI and reusable settings.
250
+ - **Workflow** — stack browser, sharpness curve, original-pixel zoom and loupe, ROI and reusable settings.
249
251
  - **Microscopy** — 16-bit processing, TIFF Z-stacks, calibration and dust correction.
250
252
  - **Image formats** — supported transparent PNG stacks and ICC profile preservation.
251
- - **Headless CLI** — batch processing and JSON output for scripting.
253
+ - **Headless CLI** — batch processing, reusable recipes, EXIF focus ordering, auto background and JSON output.
252
254
  - **Projects and recovery** — session files, undo/redo and crash recovery.
253
255
  - **Languages** — twelve UI languages with automatic locale detection.
254
- - **Memory** — neural models load only when selected.
256
+ - **Memory** — bounded frame/tile work, disk-backed intermediates and neural models loaded only when selected.
255
257
 
256
- StackMFF V1/V2/V3 use dynamic ONNX checkpoints and ONNX Runtime; production
257
- inference does not bundle PyTorch. The current runtime can use DirectML on
258
- Windows or CoreML on macOS and falls back to CPU when needed. A provider being
259
- available does not prove GPU execution; support across GPU hardware still needs
260
- validation. See [GPU support](docs/GPU_SUPPORT.md).
258
+ OpenFocus A, B and C are the stable fusion methods. To use the other fusion
259
+ methods, enable **Experimental features** in Advanced Settings or pass
260
+ `--experimental` to the headless CLI.
261
+
262
+ StackMFF V1/V2/V3 run with the bundled ONNX Runtime. Supported Windows x64
263
+ NVIDIA systems can install TensorRT and PyTorch CUDA from **Settings → AI
264
+ acceleration components**. With GPU acceleration enabled, OpenFocus tries the
265
+ applicable native engines, then an accelerated ONNX Runtime provider such as
266
+ DirectML or CoreML, then CPU. Diagnostics record the engine used by the model.
267
+ See [GPU support](docs/GPU_SUPPORT.md).
261
268
 
262
269
  Neural inference adapts spatial tile size to available resources while keeping
263
270
  all focal frames in each inference. Imported frames and alignment scratch can
@@ -267,13 +274,18 @@ they may be rejected when those resources are insufficient. StackMFF V2's
267
274
  spatial tiling is an approximation of whole-image inference and can change the
268
275
  result. See [fusion methods](docs/FUSION_METHODS.md).
269
276
 
277
+ JPEG/RAW display previews use embedded data when available. Processing and
278
+ original-pixel inspection decode the source independently; a small preview never
279
+ replaces the pixels used for fusion. Keep enough free RAM and temporary disk
280
+ space for the selected source, processing workspace and full-size result.
281
+
270
282
  <a id="install"></a>
271
283
  ## ⬇️ Install
272
284
 
273
- Download the latest Windows or macOS build from the [OpenFocus website](https://openfocus.top/#download). Portable builds and older versions are also available on [GitHub Releases](https://github.com/Xinzhe99/OpenFocus/releases).
285
+ The OpenFocus website offers stable desktop builds for Windows x64, macOS Apple Silicon and Linux x86-64. Extract the Linux archive and run `OpenFocus/OpenFocus`. Desktop updates use the stable channel by default. Enable beta updates in Advanced Settings or the welcome dialog to receive newer prereleases. Linux desktop updates are installed manually from the download page. [Desktop downloads](https://openfocus.top/#download) · [Release history](https://github.com/Xinzhe99/OpenFocus/releases)
274
286
 
275
- On macOS (Apple Silicon) or Linux, install from a terminal. Linux installs the
276
- headless CLI; macOS installs the app in `~/Applications`.
287
+ On macOS (Apple Silicon) or Linux, install from a terminal. On Linux this
288
+ command installs the headless CLI; on macOS it installs the app in `~/Applications`.
277
289
 
278
290
  ```bash
279
291
  curl -fsSL https://openfocus.top/install.sh | sh
@@ -319,28 +331,58 @@ pip install openfocus
319
331
  openfocus -i ./stack_folder -o ./result/fused.png
320
332
  ```
321
333
 
334
+ For unattended background replacement while retaining the original fusion and
335
+ its missing-data map:
336
+
337
+ ```bash
338
+ openfocus -i ./stack_folder -o ./result/fused.tif --auto-background auto --save-stacked --missing-data-map
339
+ ```
340
+
341
+ Folder inputs use EXIF focus steps when every frame supplies them and the
342
+ near-to-far step direction is known; otherwise they keep natural filename order. Use `--frame-order name` to force filename order;
343
+ explicitly listed files retain their supplied order.
344
+
345
+ Recipes preserve native RAW conversion mode and batch output format. Run
346
+ transient duplicate and alignment reports through direct CLI invocations.
347
+
322
348
  See the [CLI manual](./docs/USER_MANUAL_EN.md#14-command-line-interface).
323
349
 
324
350
  <a id="community"></a>
325
351
  ## Community & Support
326
352
 
327
- Questions, ideas or feedback? Join our [Discord community](https://discord.gg/afzmwgPt). We reply as soon as we can; we're based in Beijing (UTC+8), so time differences may affect response times.
353
+ Questions, ideas or feedback? Join our [Discord community](https://discord.gg/Jamr2SR5). We reply as soon as we can; we're based in Beijing (UTC+8), so time differences may affect response times.
328
354
 
329
355
  - **Docs** — [User Manual](./docs/USER_MANUAL_EN.md) (twelve languages) · [Changelog](./CHANGELOG.md) · [Performance](./docs/PERFORMANCE.md) · [Fusion methods](./docs/FUSION_METHODS.md)
330
- - <a id="code-signing-policy"></a>[Code signing policy](./docs/CODE_SIGNING_POLICY.md) · [Privacy policy](./docs/PRIVACY.md)
356
+ - [Privacy policy](./docs/PRIVACY.md)
331
357
  - **Citation** — [CITATION.cff](./CITATION.cff); every release is archived on Zenodo ([DOI](https://doi.org/10.5281/zenodo.23050823))
332
358
  - **Feedback** — open an [issue](https://github.com/Xinzhe99/OpenFocus/issues) for bugs, ideas and algorithm work
333
359
  - **Credits** — each fusion/registration algorithm keeps its original research licence; StackMFF V3 lives at [Xinzhe99/StackMFF-V3](https://github.com/Xinzhe99/StackMFF-V3)
334
360
 
335
- **WeChat community:** Scan with WeChat to join the OpenFocus group.
361
+ **WeChat:** Scan to join the OpenFocus group or follow our official account.
336
362
 
337
- <img src="assets/readme/wechat-group.jpg" alt="QR code for the OpenFocus WeChat group" width="260">
363
+ <table>
364
+ <tr>
365
+ <th align="center">WeChat group</th>
366
+ <th align="center">Official account</th>
367
+ </tr>
368
+ <tr>
369
+ <td align="center" valign="top"><img src="assets/readme/wechat-group.png" alt="QR code for the OpenFocus WeChat group" width="260"></td>
370
+ <td align="center" valign="top"><img src="assets/readme/wechat-official-account.jpg" alt="QR code for the OpenFocus WeChat official account" width="260"></td>
371
+ </tr>
372
+ </table>
338
373
 
339
374
  **Support OpenFocus:** If you enjoy the software, you can buy us a coffee via Alipay in China or [PayPal](https://paypal.me/XinZEN0602) internationally. Include your username in the payment note and we will permanently acknowledge it in the project as a thank-you.
340
375
 
341
- <img src="assets/readme/alipay-coffee.jpg" alt="Alipay QR code to support OpenFocus" width="260">
342
-
343
- <a href="https://paypal.me/XinZEN0602"><img src="assets/readme/paypal-coffee.png" alt="Scan or click to support OpenFocus via PayPal" width="260"></a>
376
+ <table>
377
+ <tr>
378
+ <th align="center">Alipay · China</th>
379
+ <th align="center">PayPal · International</th>
380
+ </tr>
381
+ <tr>
382
+ <td align="center" valign="top"><img src="assets/readme/alipay-coffee.jpg" alt="Alipay QR code to support OpenFocus" width="260"></td>
383
+ <td align="center" valign="top"><a href="https://paypal.me/XinZEN0602"><img src="assets/readme/paypal-coffee.png" alt="PayPal QR code with the PayPal mark; scan or click to support OpenFocus" width="260"></a><br><a href="https://paypal.me/XinZEN0602">Scan or click to donate via PayPal</a></td>
384
+ </tr>
385
+ </table>
344
386
 
345
387
  <a id="license"></a>
346
388
  ## License
@@ -364,6 +406,24 @@ pip install -r requirements.txt
364
406
  python main.py
365
407
  ```
366
408
 
409
+ Install the shared development tools and run the regression suite:
410
+
411
+ ```bash
412
+ python -m pip install -r requirements-dev.txt
413
+ python -m pytest -q --timeout=90 --timeout-method=thread
414
+ ```
415
+
416
+ On a headless host, set `QT_QPA_PLATFORM=offscreen`. CI uses these same dependency
417
+ files on Windows, macOS and Linux. A change to processing, cancellation or GUI
418
+ state also needs a real CLI/desktop smoke run; tests alone do not exercise the
419
+ packaged application.
420
+
421
+ Keep algorithm descriptors in `core/algorithms.py`, shared processing in
422
+ `core`/`utils`, and UI snapshots/dialog orchestration in the controllers. New
423
+ methods declare parameters, resource estimates and capabilities once; consumers
424
+ derive their choices from that descriptor. Preserve bit depth, source order,
425
+ cooperative cancellation and the admitted thread/RAM limits.
426
+
367
427
  Packaging with PyInstaller: [docs/BUILD_COMMANDS.md](./docs/BUILD_COMMANDS.md).
368
428
 
369
429
  Adding a fusion or registration algorithm: [CONTRIBUTING.md](./CONTRIBUTING.md).
@@ -22,7 +22,7 @@
22
22
  <p align="center">
23
23
  <img src="https://img.shields.io/badge/Windows-10%2F11-0078D7?logo=windows&logoColor=white" alt="Windows 10/11">
24
24
  <img src="https://img.shields.io/badge/macOS-Apple%20Silicon-000000?logo=apple&logoColor=white" alt="macOS Apple Silicon">
25
- <img src="https://img.shields.io/badge/Linux-CLI-FCC624?logo=linux&logoColor=black" alt="Linux CLI">
25
+ <img src="https://img.shields.io/badge/Linux-x86--64-FCC624?logo=linux&logoColor=black" alt="Linux x86-64 desktop and CLI">
26
26
  <a href="https://pypi.org/project/openfocus/"><img src="https://img.shields.io/badge/PyPI-openfocus-3775A9?logo=pypi&logoColor=white" alt="PyPI"></a>
27
27
  </p>
28
28
 
@@ -55,9 +55,7 @@
55
55
  ## 📢 News
56
56
 
57
57
  > [!NOTE]
58
- > **v1.75.0** — Grouped fusion, reusable processing workflows, transparent PNG
59
- > stacks, alignment diagnostics, enhanced depth exports and a refreshed desktop
60
- > workflow. See the changelog for supported inputs and feature limitations.
58
+ > **OpenFocus 2.0.0** adds a Linux desktop build, GPU acceleration for OpenFocus A/B/C on compatible devices, and original-pixel inspection with reusable method comparisons. [Download](https://openfocus.top/#download) · [Changelog](./CHANGELOG.md#200)
61
59
 
62
60
  Earlier releases are in the [Changelog](./CHANGELOG.md).
63
61
 
@@ -136,7 +134,7 @@ Create depth maps, calibrate physical Z, and export textured 3D surfaces.
136
134
 
137
135
  ### Source-locked retouch
138
136
 
139
- Paint details from contributing source frames onto the fused result.
137
+ Paint details from contributing source frames onto the fused result. Auto background swaps a messy stacked background for one real frame and shows where no frame saw the scene clearly.
140
138
 
141
139
  </td>
142
140
  <td width="54%">
@@ -209,19 +207,24 @@ Control the desktop app through a token-protected local channel.
209
207
 
210
208
  **Also in the box:**
211
209
 
212
- - **Workflow** — stack browser, sharpness curve, previews, ROI and reusable settings.
210
+ - **Workflow** — stack browser, sharpness curve, original-pixel zoom and loupe, ROI and reusable settings.
213
211
  - **Microscopy** — 16-bit processing, TIFF Z-stacks, calibration and dust correction.
214
212
  - **Image formats** — supported transparent PNG stacks and ICC profile preservation.
215
- - **Headless CLI** — batch processing and JSON output for scripting.
213
+ - **Headless CLI** — batch processing, reusable recipes, EXIF focus ordering, auto background and JSON output.
216
214
  - **Projects and recovery** — session files, undo/redo and crash recovery.
217
215
  - **Languages** — twelve UI languages with automatic locale detection.
218
- - **Memory** — neural models load only when selected.
216
+ - **Memory** — bounded frame/tile work, disk-backed intermediates and neural models loaded only when selected.
219
217
 
220
- StackMFF V1/V2/V3 use dynamic ONNX checkpoints and ONNX Runtime; production
221
- inference does not bundle PyTorch. The current runtime can use DirectML on
222
- Windows or CoreML on macOS and falls back to CPU when needed. A provider being
223
- available does not prove GPU execution; support across GPU hardware still needs
224
- validation. See [GPU support](docs/GPU_SUPPORT.md).
218
+ OpenFocus A, B and C are the stable fusion methods. To use the other fusion
219
+ methods, enable **Experimental features** in Advanced Settings or pass
220
+ `--experimental` to the headless CLI.
221
+
222
+ StackMFF V1/V2/V3 run with the bundled ONNX Runtime. Supported Windows x64
223
+ NVIDIA systems can install TensorRT and PyTorch CUDA from **Settings → AI
224
+ acceleration components**. With GPU acceleration enabled, OpenFocus tries the
225
+ applicable native engines, then an accelerated ONNX Runtime provider such as
226
+ DirectML or CoreML, then CPU. Diagnostics record the engine used by the model.
227
+ See [GPU support](docs/GPU_SUPPORT.md).
225
228
 
226
229
  Neural inference adapts spatial tile size to available resources while keeping
227
230
  all focal frames in each inference. Imported frames and alignment scratch can
@@ -231,13 +234,18 @@ they may be rejected when those resources are insufficient. StackMFF V2's
231
234
  spatial tiling is an approximation of whole-image inference and can change the
232
235
  result. See [fusion methods](docs/FUSION_METHODS.md).
233
236
 
237
+ JPEG/RAW display previews use embedded data when available. Processing and
238
+ original-pixel inspection decode the source independently; a small preview never
239
+ replaces the pixels used for fusion. Keep enough free RAM and temporary disk
240
+ space for the selected source, processing workspace and full-size result.
241
+
234
242
  <a id="install"></a>
235
243
  ## ⬇️ Install
236
244
 
237
- Download the latest Windows or macOS build from the [OpenFocus website](https://openfocus.top/#download). Portable builds and older versions are also available on [GitHub Releases](https://github.com/Xinzhe99/OpenFocus/releases).
245
+ The OpenFocus website offers stable desktop builds for Windows x64, macOS Apple Silicon and Linux x86-64. Extract the Linux archive and run `OpenFocus/OpenFocus`. Desktop updates use the stable channel by default. Enable beta updates in Advanced Settings or the welcome dialog to receive newer prereleases. Linux desktop updates are installed manually from the download page. [Desktop downloads](https://openfocus.top/#download) · [Release history](https://github.com/Xinzhe99/OpenFocus/releases)
238
246
 
239
- On macOS (Apple Silicon) or Linux, install from a terminal. Linux installs the
240
- headless CLI; macOS installs the app in `~/Applications`.
247
+ On macOS (Apple Silicon) or Linux, install from a terminal. On Linux this
248
+ command installs the headless CLI; on macOS it installs the app in `~/Applications`.
241
249
 
242
250
  ```bash
243
251
  curl -fsSL https://openfocus.top/install.sh | sh
@@ -283,28 +291,58 @@ pip install openfocus
283
291
  openfocus -i ./stack_folder -o ./result/fused.png
284
292
  ```
285
293
 
294
+ For unattended background replacement while retaining the original fusion and
295
+ its missing-data map:
296
+
297
+ ```bash
298
+ openfocus -i ./stack_folder -o ./result/fused.tif --auto-background auto --save-stacked --missing-data-map
299
+ ```
300
+
301
+ Folder inputs use EXIF focus steps when every frame supplies them and the
302
+ near-to-far step direction is known; otherwise they keep natural filename order. Use `--frame-order name` to force filename order;
303
+ explicitly listed files retain their supplied order.
304
+
305
+ Recipes preserve native RAW conversion mode and batch output format. Run
306
+ transient duplicate and alignment reports through direct CLI invocations.
307
+
286
308
  See the [CLI manual](./docs/USER_MANUAL_EN.md#14-command-line-interface).
287
309
 
288
310
  <a id="community"></a>
289
311
  ## Community & Support
290
312
 
291
- Questions, ideas or feedback? Join our [Discord community](https://discord.gg/afzmwgPt). We reply as soon as we can; we're based in Beijing (UTC+8), so time differences may affect response times.
313
+ Questions, ideas or feedback? Join our [Discord community](https://discord.gg/Jamr2SR5). We reply as soon as we can; we're based in Beijing (UTC+8), so time differences may affect response times.
292
314
 
293
315
  - **Docs** — [User Manual](./docs/USER_MANUAL_EN.md) (twelve languages) · [Changelog](./CHANGELOG.md) · [Performance](./docs/PERFORMANCE.md) · [Fusion methods](./docs/FUSION_METHODS.md)
294
- - <a id="code-signing-policy"></a>[Code signing policy](./docs/CODE_SIGNING_POLICY.md) · [Privacy policy](./docs/PRIVACY.md)
316
+ - [Privacy policy](./docs/PRIVACY.md)
295
317
  - **Citation** — [CITATION.cff](./CITATION.cff); every release is archived on Zenodo ([DOI](https://doi.org/10.5281/zenodo.23050823))
296
318
  - **Feedback** — open an [issue](https://github.com/Xinzhe99/OpenFocus/issues) for bugs, ideas and algorithm work
297
319
  - **Credits** — each fusion/registration algorithm keeps its original research licence; StackMFF V3 lives at [Xinzhe99/StackMFF-V3](https://github.com/Xinzhe99/StackMFF-V3)
298
320
 
299
- **WeChat community:** Scan with WeChat to join the OpenFocus group.
321
+ **WeChat:** Scan to join the OpenFocus group or follow our official account.
300
322
 
301
- <img src="assets/readme/wechat-group.jpg" alt="QR code for the OpenFocus WeChat group" width="260">
323
+ <table>
324
+ <tr>
325
+ <th align="center">WeChat group</th>
326
+ <th align="center">Official account</th>
327
+ </tr>
328
+ <tr>
329
+ <td align="center" valign="top"><img src="assets/readme/wechat-group.png" alt="QR code for the OpenFocus WeChat group" width="260"></td>
330
+ <td align="center" valign="top"><img src="assets/readme/wechat-official-account.jpg" alt="QR code for the OpenFocus WeChat official account" width="260"></td>
331
+ </tr>
332
+ </table>
302
333
 
303
334
  **Support OpenFocus:** If you enjoy the software, you can buy us a coffee via Alipay in China or [PayPal](https://paypal.me/XinZEN0602) internationally. Include your username in the payment note and we will permanently acknowledge it in the project as a thank-you.
304
335
 
305
- <img src="assets/readme/alipay-coffee.jpg" alt="Alipay QR code to support OpenFocus" width="260">
306
-
307
- <a href="https://paypal.me/XinZEN0602"><img src="assets/readme/paypal-coffee.png" alt="Scan or click to support OpenFocus via PayPal" width="260"></a>
336
+ <table>
337
+ <tr>
338
+ <th align="center">Alipay · China</th>
339
+ <th align="center">PayPal · International</th>
340
+ </tr>
341
+ <tr>
342
+ <td align="center" valign="top"><img src="assets/readme/alipay-coffee.jpg" alt="Alipay QR code to support OpenFocus" width="260"></td>
343
+ <td align="center" valign="top"><a href="https://paypal.me/XinZEN0602"><img src="assets/readme/paypal-coffee.png" alt="PayPal QR code with the PayPal mark; scan or click to support OpenFocus" width="260"></a><br><a href="https://paypal.me/XinZEN0602">Scan or click to donate via PayPal</a></td>
344
+ </tr>
345
+ </table>
308
346
 
309
347
  <a id="license"></a>
310
348
  ## License
@@ -328,6 +366,24 @@ pip install -r requirements.txt
328
366
  python main.py
329
367
  ```
330
368
 
369
+ Install the shared development tools and run the regression suite:
370
+
371
+ ```bash
372
+ python -m pip install -r requirements-dev.txt
373
+ python -m pytest -q --timeout=90 --timeout-method=thread
374
+ ```
375
+
376
+ On a headless host, set `QT_QPA_PLATFORM=offscreen`. CI uses these same dependency
377
+ files on Windows, macOS and Linux. A change to processing, cancellation or GUI
378
+ state also needs a real CLI/desktop smoke run; tests alone do not exercise the
379
+ packaged application.
380
+
381
+ Keep algorithm descriptors in `core/algorithms.py`, shared processing in
382
+ `core`/`utils`, and UI snapshots/dialog orchestration in the controllers. New
383
+ methods declare parameters, resource estimates and capabilities once; consumers
384
+ derive their choices from that descriptor. Preserve bit depth, source order,
385
+ cooperative cancellation and the admitted thread/RAM limits.
386
+
331
387
  Packaging with PyInstaller: [docs/BUILD_COMMANDS.md](./docs/BUILD_COMMANDS.md).
332
388
 
333
389
  Adding a fusion or registration algorithm: [CONTRIBUTING.md](./CONTRIBUTING.md).
@@ -0,0 +1,2 @@
1
+ """Build-time suffix; release automation replaces it for packaged betas."""
2
+ BETA_SUFFIX = ""
@@ -1,4 +1,12 @@
1
- APP_VERSION = "1.76.0"
1
+ APP_VERSION = "2.0.0"
2
+ DISCORD_INVITE_URL = "https://discord.gg/Jamr2SR5"
3
+
4
+
5
+ def app_display_version():
6
+ """Return the build identity while preserving the numeric package version."""
7
+ from build_identity import BETA_SUFFIX
8
+ return APP_VERSION + BETA_SUFFIX
9
+
2
10
 
3
11
  WINDOW_WIDTH = 1600
4
12
  WINDOW_HEIGHT = 950
@@ -20,6 +28,10 @@ STATUS_UPDATE_INTERVAL_MS = 2000
20
28
 
21
29
  BYTES_TO_GB = 1024 ** 3
22
30
 
31
+ # Shared snapshots and numerical scratch leave room for source/preview caches.
32
+ FRAME_RAM_BUDGET_BYTES = 384 * 1024 ** 2
33
+ OPENFOCUS_MAX_IN_FLIGHT_FRAMES = 2
34
+
23
35
  FEATURE_MAX_KEYPOINTS = 200
24
36
  FEATURE_MATCH_THRESHOLD = 0.01
25
37
  FEATURE_RANSAC_REJECTS = 30
@@ -31,6 +43,7 @@ ANIMATION_DURATION_MS = 400
31
43
  DEFAULT_THREAD_COUNT = 4
32
44
  MIN_THREAD_COUNT = 1
33
45
  MAX_THREAD_COUNT = 16
46
+ NATIVE_WORKER_STACK_BYTES = 8 * 1024 ** 2
34
47
 
35
48
  AI_BATCH_SIZE = 2
36
49
  AI_BATCH_SIZE_MIN = 1
@@ -0,0 +1,204 @@
1
+ """Native CPU kernels for the fast translation estimator.
2
+
3
+ These mirror the row-wise definitions in core.openfocus_alignment exactly:
4
+ uint32 accumulation, truncating integer division, edge replication and the
5
+ float32 sampler clamp order. Numba is optional; callers fall back to NumPy.
6
+ """
7
+ import numpy as np
8
+
9
+ try:
10
+ from numba import njit, prange
11
+ _HAVE_NUMBA = True
12
+ except Exception: # pragma: no cover - optional dependency
13
+ njit = None
14
+ prange = range
15
+ _HAVE_NUMBA = False
16
+
17
+ _WEIGHTS = (12, 64, 37, 2)
18
+
19
+
20
+ def available():
21
+ return _HAVE_NUMBA
22
+
23
+
24
+ if _HAVE_NUMBA:
25
+ @njit(cache=True, nogil=True)
26
+ def gray16_u8(image, out):
27
+ h, w = image.shape[:2]
28
+ take = min(image.shape[2], 3) if image.ndim == 3 else 1
29
+ for y in range(h):
30
+ for x in range(w):
31
+ if image.ndim == 2:
32
+ value = np.uint32(image[y, x])
33
+ else:
34
+ value = np.uint32(0)
35
+ for c in range(take):
36
+ value += np.uint32(image[y, x, c])
37
+ value //= np.uint32(take)
38
+ out[y, x] = np.uint16(value << np.uint32(8))
39
+ return out
40
+
41
+ @njit(cache=True, nogil=True)
42
+ def down_half(src):
43
+ h, w = src.shape
44
+ oh, ow = (h + 1) // 2, (w + 1) // 2
45
+ out = np.empty((oh, ow), np.uint16)
46
+ for oy in range(oh):
47
+ scratch = np.empty(w, np.uint32)
48
+ y = 2 * oy
49
+ for x in range(w):
50
+ v = np.uint32(0)
51
+ for i in range(4):
52
+ sy = y - 1 + i
53
+ if sy < 0:
54
+ sy = 0
55
+ elif sy >= h:
56
+ sy = h - 1
57
+ v += np.uint32(src[sy, x]) * np.uint32(_WEIGHTS[i])
58
+ scratch[x] = (v + np.uint32(57)) // np.uint32(115)
59
+ for ox in range(ow):
60
+ v = np.uint32(0)
61
+ for i in range(4):
62
+ sx = 2 * ox - 1 + i
63
+ if sx < 0:
64
+ sx = 0
65
+ elif sx >= w:
66
+ sx = w - 1
67
+ v += scratch[sx] * np.uint32(_WEIGHTS[i])
68
+ out[oy, ox] = np.uint16((v + np.uint32(57)) // np.uint32(115))
69
+ return out
70
+
71
+ if _HAVE_NUMBA:
72
+ @njit(cache=True, nogil=True)
73
+ def gray16_u16(image, out):
74
+ h, w = image.shape[:2]
75
+ take = min(image.shape[2], 3) if image.ndim == 3 else 1
76
+ for y in range(h):
77
+ for x in range(w):
78
+ if image.ndim == 2:
79
+ out[y, x] = np.uint16(image[y, x])
80
+ else:
81
+ value = np.uint32(0)
82
+ for c in range(take):
83
+ value += np.uint32(image[y, x, c])
84
+ out[y, x] = np.uint16(value // np.uint32(take))
85
+ return out
86
+
87
+ if _HAVE_NUMBA:
88
+ @njit(cache=True, nogil=True)
89
+ def _axis(coord, length):
90
+ extent = length
91
+ invalid = coord >= np.float32(extent) or coord < np.float32(0)
92
+ if coord >= np.float32(extent - 1):
93
+ coord = np.float32(extent) - np.float32(1.0010000467300415)
94
+ if coord < np.float32(0):
95
+ coord = np.float32(0)
96
+ index = np.int32(coord)
97
+ frac = np.uint32((coord - np.float32(index)) * np.float32(256))
98
+ lo = index
99
+ if lo < 0:
100
+ lo = 0
101
+ elif lo > length - 1:
102
+ lo = length - 1
103
+ hi = index + 1
104
+ if hi < 0:
105
+ hi = 0
106
+ elif hi > length - 1:
107
+ hi = length - 1
108
+ return lo, hi, frac, invalid
109
+
110
+ @njit(cache=True, nogil=True)
111
+ def warp_u16(image, dx, dy):
112
+ h, w = image.shape[:2]
113
+ out = np.empty_like(image)
114
+ channels = 1 if image.ndim == 2 else image.shape[2]
115
+ for y in range(h):
116
+ iy, jy, fy, inv_y = _axis(np.float32(y) - np.float32(dy), h)
117
+ gy = np.uint32(256) - fy
118
+ for x in range(w):
119
+ ix, jx, fx, inv_x = _axis(np.float32(x) - np.float32(dx), w)
120
+ gx = np.uint32(256) - fx
121
+ invalid = inv_y or inv_x
122
+ for c in range(channels):
123
+ if image.ndim == 2:
124
+ top = np.uint32(image[iy, ix]) * gx + np.uint32(image[iy, jx]) * fx
125
+ bottom = np.uint32(image[jy, ix]) * gx + np.uint32(image[jy, jx]) * fx
126
+ value = (top * gy + bottom * fy) >> np.uint32(16)
127
+ out[y, x] = np.uint16(0 if invalid else value)
128
+ else:
129
+ top = np.uint32(image[iy, ix, c]) * gx + np.uint32(image[iy, jx, c]) * fx
130
+ bottom = np.uint32(image[jy, ix, c]) * gx + np.uint32(image[jy, jx, c]) * fx
131
+ value = (top * gy + bottom * fy) >> np.uint32(16)
132
+ out[y, x, c] = np.uint16(0 if invalid else value)
133
+ return out
134
+
135
+
136
+ if _HAVE_NUMBA:
137
+ @njit(cache=True, nogil=True)
138
+ def _axis_pad(coord, length, pad):
139
+ extent = length + 2 * pad
140
+ invalid = coord >= np.float32(extent) or coord < np.float32(0)
141
+ if coord >= np.float32(extent - 1):
142
+ coord = np.float32(extent) - np.float32(1.0010000467300415)
143
+ if coord < np.float32(0):
144
+ coord = np.float32(0)
145
+ index = np.int32(coord)
146
+ frac = np.uint32((coord - np.float32(index)) * np.float32(256))
147
+ lo = index - pad
148
+ if lo < 0:
149
+ lo = 0
150
+ elif lo > length - 1:
151
+ lo = length - 1
152
+ hi = index + 1 - pad
153
+ if hi < 0:
154
+ hi = 0
155
+ elif hi > length - 1:
156
+ hi = length - 1
157
+ return lo, hi, frac, invalid
158
+ if _HAVE_NUMBA:
159
+ @njit(cache=True, nogil=True)
160
+ def refine_level(a, b, c_dx, c_dy, half, step, crop):
161
+ h, w = a.shape
162
+ pad = np.int32(np.ceil(max(abs(c_dx), abs(c_dy), np.float32(1.0)) + half)) + 1
163
+ n = min(crop, h, w)
164
+ cy, cx = (h - n) // 2, (w - n) // 2
165
+ count = np.int32(round(2.0 * half / step)) | 1
166
+ centre = (count - 1) // 2
167
+ best_score = np.float32(np.finfo(np.float32).max)
168
+ best_dx = np.float32(0.0)
169
+ best_dy = np.float32(0.0)
170
+ found = False
171
+ for oy in range(count):
172
+ ody = np.float32((oy - centre) * step)
173
+ dy = np.float32(c_dy + ody)
174
+ for ox in range(count):
175
+ odx = np.float32((ox - centre) * step)
176
+ dx = np.float32(c_dx + odx)
177
+ ssum = np.float64(0.0)
178
+ ssq = np.float64(0.0)
179
+ for yy in range(cy, cy + n):
180
+ ycoord = np.float32(np.float32(yy) + np.float32(pad) - dy)
181
+ iy, jy, fy, inv_y = _axis_pad(ycoord, h, pad)
182
+ gy = np.uint32(256) - fy
183
+ for xx in range(cx, cx + n):
184
+ xcoord = np.float32(np.float32(xx) + np.float32(pad) - dx)
185
+ ix, jx, fx, inv_x = _axis_pad(xcoord, w, pad)
186
+ gx = np.uint32(256) - fx
187
+ if inv_y or inv_x:
188
+ sample = 0
189
+ else:
190
+ top = np.uint32(b[iy, ix]) * gx + np.uint32(b[iy, jx]) * fx
191
+ bottom = np.uint32(b[jy, ix]) * gx + np.uint32(b[jy, jx]) * fx
192
+ sample = np.uint32((top * gy + bottom * fy) >> np.uint32(16))
193
+ diff = np.float64(a[yy, xx]) - np.float64(sample)
194
+ ssum += diff
195
+ ssq += diff * diff
196
+ total = np.float64(n * n)
197
+ mean = ssum / total
198
+ score = np.float64(np.sqrt(max(ssq / total - mean * mean, 0.0)))
199
+ if score < np.float64(best_score):
200
+ best_score = np.float32(score)
201
+ best_dx = dx
202
+ best_dy = dy
203
+ found = True
204
+ return best_dx, best_dy, found