immvision.pyi 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829
  1. ###############################################################################
  2. # This file is a part of Dear ImGui Bundle
  3. # -----------------------------------------------------------------------------
  4. # immvision.pyi: auto-generated bindings for ImmVision, an immediate image
  5. # debugger and insights tool. See https://github.com/pthom/immvision.git
  6. #
  7. # Most of the code of this file is automatically generated (using https://pthom.github.io/litgen/),
  8. # and is generally very close to the C++ version. Comments, docs are identical.
  9. # Do not manually edit the autogenerated parts (look for "Autogenerated" comments)!
  10. ###############################################################################
  11. # ruff: noqa: B008
  12. from typing import List, Tuple, TypeAlias, Optional, overload
  13. import enum
  14. import numpy as np
  15. from numpy.typing import NDArray
  16. from imgui_bundle import ImVec2, ImVec2Like
  17. Point2d: TypeAlias = Tuple[float, float]
  18. Point: TypeAlias = Tuple[int, int]
  19. Size: TypeAlias = Tuple[int, int]
  20. ImageBuffer: TypeAlias = NDArray[np.number]
  21. Mat: TypeAlias = NDArray[np.number] # Legacy alias for ImageBuffer
  22. Matrix33d: TypeAlias = List[
  23. List[float]
  24. ] # 3x3 affine transformation matrix (for zoom/pan)
  25. Matx33d: TypeAlias = Matrix33d # Legacy alias
  26. Image_RGBA: TypeAlias = NDArray[np.uint8]
  27. Image_RGB: TypeAlias = NDArray[np.uint8]
  28. ImTextureID: TypeAlias = int
  29. # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  30. # <litgen_stub> // Autogenerated code below! Do not edit!
  31. #################### <generated_from:immvision_types.h> ####################
  32. # IMMVISION_API is a marker for public API functions.
  33. #
  34. # ImmVision types
  35. # ===============
  36. #
  37. # ImmVision uses its own lightweight types for images, points, sizes, and matrices.
  38. # These types do not depend on OpenCV.
  39. #
  40. # C++ users:
  41. # If OpenCV is available (IMMVISION_HAS_OPENCV is defined), all types provide
  42. # implicit conversions to/from their OpenCV equivalents:
  43. # ImageBuffer <-> cv::Mat (zero-copy via ImageBuffer(cv::Mat) and to_cv_mat())
  44. # Point <-> cv::Point (implicit both ways)
  45. # Point2 <-> cv::Point2 (implicit both ways)
  46. # Size <-> cv::Size (implicit both ways)
  47. # Matrix33 <-> cv::Matx33 (implicit both ways)
  48. # This means you can pass cv::Mat, cv::Point, etc. directly to ImmVision functions.
  49. #
  50. # Python users:
  51. # These types are mapped transparently to native Python types:
  52. # ImageBuffer <-> numpy.ndarray
  53. # Point <-> Tuple[int, int]
  54. # Point2 <-> Tuple[float, float]
  55. # Size <-> Tuple[int, int]
  56. # Matrix33 <-> List[List[float]] (3x3)
  57. # You never need to create these types explicitly in Python.
  58. #
  59. class Size2d:
  60. """2D double-precision size. Used for drawing operations (ellipse, rectangle_size)."""
  61. # double width = 0., /* original C++ signature */
  62. width: float = 0.0
  63. # height = 0.; /* original C++ signature */
  64. height: float = 0.0
  65. # Size2d() = default; /* original C++ signature */
  66. @overload
  67. def __init__(self) -> None:
  68. pass
  69. # Size2d(double w, double h) : width(w), height(h) {} /* original C++ signature */
  70. @overload
  71. def __init__(self, w: float, h: float) -> None:
  72. pass
  73. # Size2d(const Size& s) : width((double)s.width), height((double)s.height) {} /* original C++ signature */
  74. @overload
  75. def __init__(self, s: Size) -> None:
  76. pass
  77. class Color4d:
  78. """4-channel double color value (e.g. RGBA or BGRA)."""
  79. # double v[4] = {0, 0, 0, 255}; /* original C++ signature */
  80. v: np.ndarray # ndarray[type=double, size=4] default:float(0, 0, 0, 255)
  81. # double& operator[](int i) { return v[i]; } /* original C++ signature */
  82. def __getitem__(self, i: int) -> float:
  83. """(private API)"""
  84. pass
  85. # Color4d() = default; /* original C++ signature */
  86. @overload
  87. def __init__(self) -> None:
  88. pass
  89. # Color4d(double v0, double v1, double v2, double v3) : v{v0, v1, v2, v3} {} /* original C++ signature */
  90. @overload
  91. def __init__(self, v0: float, v1: float, v2: float, v3: float) -> None:
  92. pass
  93. class Rect:
  94. """Integer rectangle (x, y, width, height)."""
  95. # int x = 0, /* original C++ signature */
  96. x: int = 0
  97. # y = 0, /* original C++ signature */
  98. y: int = 0
  99. # width = 0, /* original C++ signature */
  100. width: int = 0
  101. # height = 0; /* original C++ signature */
  102. height: int = 0
  103. # Rect() = default; /* original C++ signature */
  104. @overload
  105. def __init__(self) -> None:
  106. pass
  107. # Rect(int x_, int y_, int w, int h) : x(x_), y(y_), width(w), height(h) {} /* original C++ signature */
  108. @overload
  109. def __init__(self, x_: int, y_: int, w: int, h: int) -> None:
  110. pass
  111. # Rect(Point pt, Size sz) : x(pt.x), y(pt.y), width(sz.width), height(sz.height) {} /* original C++ signature */
  112. @overload
  113. def __init__(self, pt: Point, sz: Size) -> None:
  114. pass
  115. # Rect(Point pt1, Point pt2) /* original C++ signature */
  116. # : x(std::min(pt1.x, pt2.x)), y(std::min(pt1.y, pt2.y)),
  117. # width(std::max(pt1.x, pt2.x) - x), height(std::max(pt1.y, pt2.y) - y) {}
  118. @overload
  119. def __init__(self, pt1: Point, pt2: Point) -> None:
  120. """Construct from two corner points (top-left and bottom-right)"""
  121. pass
  122. # bool empty() const { return width <= 0 || height <= 0; } /* original C++ signature */
  123. def empty(self) -> bool:
  124. """(private API)"""
  125. pass
  126. # int area() const { return width * height; } /* original C++ signature */
  127. def area(self) -> int:
  128. """(private API)"""
  129. pass
  130. # bool contains(Point pt) const { return pt.x >= x && pt.x < x + width && pt.y >= y && pt.y < y + height; } /* original C++ signature */
  131. def contains(self, pt: Point) -> bool:
  132. """(private API)"""
  133. pass
  134. # Size size() const { return {width, height}; } /* original C++ signature */
  135. def size(self) -> Size:
  136. """(private API)"""
  137. pass
  138. #################### </generated_from:immvision_types.h> ####################
  139. #################### <generated_from:image.h> ####################
  140. # IMMVISION_API is a marker for public API functions. IMMVISION_STRUCT_API is a marker for public API structs (in comment lines)
  141. # Usage of ImmVision as a shared library is not recommended. No guaranty of ABI stability is provided
  142. # Set the color order for displayed images.
  143. # You **must** call once at the start of your program:
  144. # ImmVision::UseRgbColorOrder() or ImmVision::UseBgrColorOrder() (C++)
  145. # immvision.use_rgb_color_order() or immvision.use_bgr_color_order() (Python)
  146. # (Breaking change - October 2024)
  147. # void UseRgbColorOrder(); /* original C++ signature */
  148. def use_rgb_color_order() -> None:
  149. """(private API)"""
  150. pass
  151. # void UseBgrColorOrder(); /* original C++ signature */
  152. def use_bgr_color_order() -> None:
  153. """(private API)"""
  154. pass
  155. # bool IsUsingRgbColorOrder(); /* original C++ signature */
  156. def is_using_rgb_color_order() -> bool:
  157. """Returns True if we are using RGB color order
  158. (private API)
  159. """
  160. pass
  161. # bool IsUsingBgrColorOrder(); /* original C++ signature */
  162. def is_using_bgr_color_order() -> bool:
  163. """Returns True if we are using BGR color order
  164. (private API)
  165. """
  166. pass
  167. # bool IsColorOrderUndefined(); /* original C++ signature */
  168. def is_color_order_undefined() -> bool:
  169. """Returns True if the color order is undefined (i.e. UseRgbColorOrder or UseBgrColorOrder was not called)
  170. (private API)
  171. """
  172. pass
  173. # Temporary change of color order (useful for displaying a single image with a different color order)
  174. # void PushColorOrderRgb(); /* original C++ signature */
  175. def push_color_order_rgb() -> None:
  176. """(private API)"""
  177. pass
  178. # void PushColorOrderBgr(); /* original C++ signature */
  179. def push_color_order_bgr() -> None:
  180. """(private API)"""
  181. pass
  182. # void PopColorOrder(); /* original C++ signature */
  183. def pop_color_order() -> None:
  184. """(private API)"""
  185. pass
  186. class ColorMapStatsTypeId(enum.IntEnum):
  187. """Are we using the stats on the full image, on the Visible ROI, or are we using Min/Max values"""
  188. # FromFullImage, /* original C++ signature */
  189. from_full_image = enum.auto() # (= 0)
  190. # FromVisibleROI /* original C++ signature */
  191. # }
  192. from_visible_roi = enum.auto() # (= 1)
  193. class ColormapScaleFromStatsData:
  194. """Scale the Colormap according to the Image stats
  195. IMMVISION_API_STRUCT
  196. """
  197. # ColorMapStatsTypeId ColorMapStatsType = ColorMapStatsTypeId::FromFullImage; /* original C++ signature */
  198. # Are we using the stats on the full image, the visible ROI, or are we using Min/Max values
  199. color_map_stats_type: ColorMapStatsTypeId = ColorMapStatsTypeId.from_full_image
  200. # double NbSigmas = 1.5; /* original C++ signature */
  201. # If stats active (either on ROI or on Image), how many sigmas around the mean should the Colormap be applied
  202. nb_sigmas: float = 1.5
  203. # bool UseStatsMin = false; /* original C++ signature */
  204. # If ColorMapScaleType==ColorMapStatsType::FromMinMax, then ColormapScaleMin will be calculated from the matrix min value instead of a sigma based value
  205. use_stats_min: bool = False
  206. # bool UseStatsMax = false; /* original C++ signature */
  207. # If ColorMapScaleType==ColorMapStatsType::FromMinMax, then ColormapScaleMax will be calculated from the matrix min value instead of a sigma based value
  208. use_stats_max: bool = False
  209. # ColormapScaleFromStatsData(ColorMapStatsTypeId ColorMapStatsType = ColorMapStatsTypeId::FromFullImage, double NbSigmas = 1.5, bool UseStatsMin = false, bool UseStatsMax = false); /* original C++ signature */
  210. def __init__(
  211. self,
  212. color_map_stats_type: ColorMapStatsTypeId = ColorMapStatsTypeId.from_full_image,
  213. nb_sigmas: float = 1.5,
  214. use_stats_min: bool = False,
  215. use_stats_max: bool = False,
  216. ) -> None:
  217. """Auto-generated default constructor with named params"""
  218. pass
  219. class ColormapSettingsData:
  220. """Colormap Settings (useful for matrices with one channel, in order to see colors mapping float values)
  221. IMMVISION_API_STRUCT
  222. """
  223. # std::string Colormap = "None"; /* original C++ signature */
  224. # Colormap, see available Colormaps with AvailableColormaps()
  225. # Work only with 1 channel matrices, i.e len(shape)==2
  226. colormap: str = "None"
  227. # ColormapScaleMin and ColormapScaleMax indicate how the Colormap is applied:
  228. # - Values in [ColormapScaleMin, ColomapScaleMax] will use the full colormap.
  229. # - Values outside this interval will be clamped before coloring
  230. # by default, the initial values are ignored, and they will be updated automatically
  231. # via the options in ColormapScaleFromStats
  232. # double ColormapScaleMin = 0.; /* original C++ signature */
  233. colormap_scale_min: float = 0.0
  234. # double ColormapScaleMax = 1.; /* original C++ signature */
  235. colormap_scale_max: float = 1.0
  236. # ColormapScaleFromStatsData ColormapScaleFromStats = ColormapScaleFromStatsData(); /* original C++ signature */
  237. # If ColormapScaleFromStats.ActiveOnFullImage or ColormapScaleFromStats.ActiveOnROI,
  238. # then ColormapScaleMin/Max are ignored, and the scaling is done according to the image stats.
  239. # ColormapScaleFromStats.ActiveOnFullImage is True by default
  240. colormap_scale_from_stats: ColormapScaleFromStatsData = ColormapScaleFromStatsData()
  241. # std::string internal_ColormapHovered = ""; /* original C++ signature */
  242. # Internal value: stores the name of the Colormap that is hovered by the mouse
  243. internal_colormap_hovered: str = ""
  244. # ColormapSettingsData(std::string Colormap = "None", double ColormapScaleMin = 0., double ColormapScaleMax = 1., ColormapScaleFromStatsData ColormapScaleFromStats = ColormapScaleFromStatsData(), std::string internal_ColormapHovered = ""); /* original C++ signature */
  245. def __init__(
  246. self,
  247. colormap: str = "None",
  248. colormap_scale_min: float = 0.0,
  249. colormap_scale_max: float = 1.0,
  250. colormap_scale_from_stats: Optional[ColormapScaleFromStatsData] = None,
  251. internal_colormap_hovered: str = "",
  252. ) -> None:
  253. """Auto-generated default constructor with named params
  254. Python bindings defaults:
  255. If ColormapScaleFromStats is None, then its default value will be: ColormapScaleFromStatsData()
  256. """
  257. pass
  258. class MouseInformation:
  259. """Contains information about the mouse inside an image
  260. IMMVISION_API_STRUCT
  261. """
  262. # bool IsMouseHovering = false; /* original C++ signature */
  263. # Is the mouse hovering the image
  264. is_mouse_hovering: bool = False
  265. # Point2d MousePosition = (-1., -1.); /* original C++ signature */
  266. # Mouse position in the original image/matrix
  267. # This position is given with float coordinates, and will be (-1., -1.) if the mouse is not hovering the image
  268. mouse_position: Point2d = (-1.0, -1.0)
  269. # Point MousePosition_Displayed = (-1, -1); /* original C++ signature */
  270. # Mouse position in the displayed portion of the image (the original image can be zoomed,
  271. # and only show a subset if it may be shown).
  272. # This position is given with integer coordinates, and will be (-1, -1) if the mouse is not hovering the image
  273. mouse_position_displayed: Point = (-1, -1)
  274. #
  275. # Note: you can query ImGui::IsMouseDown(mouse_button) (c++) or imgui.is_mouse_down(mouse_button) (Python)
  276. #
  277. # MouseInformation(bool IsMouseHovering = false, Point2d MousePosition = (-1., -1.), Point MousePosition_Displayed = (-1, -1)); /* original C++ signature */
  278. def __init__(
  279. self,
  280. is_mouse_hovering: bool = False,
  281. mouse_position: Optional[Point2d] = None,
  282. mouse_position_displayed: Optional[Point] = None,
  283. ) -> None:
  284. """Auto-generated default constructor with named params
  285. Python bindings defaults:
  286. If any of the params below is None, then its default value below will be used:
  287. * MousePosition: Point2(-1., -1.)
  288. * MousePosition_Displayed: (-1, -1)
  289. """
  290. pass
  291. class ImageParams:
  292. """Set of display parameters and options for an Image
  293. IMMVISION_API_STRUCT
  294. """
  295. #
  296. # ImageParams store the parameters for a displayed image
  297. # (as well as user selected watched pixels, selected channel, etc.)
  298. # Its default constructor will give them reasonable choices, which you can adapt to your needs.
  299. # Its values will be updated when the user pans or zooms the image, adds watched pixels, etc.
  300. #
  301. #
  302. # Refresh Images Textures
  303. #
  304. # bool RefreshImage = false; /* original C++ signature */
  305. # Refresh Image: images textures are cached. Set to True if your image matrix/buffer has changed
  306. # (for example, for live video images)
  307. refresh_image: bool = False
  308. #
  309. # Display size and title
  310. #
  311. # Size ImageDisplaySize = (0, 0); /* original C++ signature */
  312. # Size of the displayed image (can be different from the matrix size)
  313. # If you specify only the width or height (e.g (300, 0), then the other dimension
  314. # will be calculated automatically, respecting the original image w/h ratio.
  315. image_display_size: Size = (0, 0)
  316. #
  317. # Zoom and Pan (represented by an affine transform matrix, of size 3x3)
  318. #
  319. # Matrix33d ZoomPanMatrix = [[1,0,0],[0,1,0],[0,0,1]]; /* original C++ signature */
  320. # ZoomPanMatrix can be created using MakeZoomPanMatrix to create a view centered around a given point
  321. zoom_pan_matrix: Matrix33d = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
  322. # std::string ZoomKey = ""; /* original C++ signature */
  323. # If displaying several images, those with the same ZoomKey will zoom and pan together
  324. zoom_key: str = ""
  325. # ColormapSettingsData ColormapSettings = ColormapSettingsData(); /* original C++ signature */
  326. #
  327. # Colormap Settings (useful for matrices with one channel, in order to see colors mapping float values)
  328. #
  329. # ColormapSettings stores all the parameter concerning the Colormap
  330. colormap_settings: ColormapSettingsData = ColormapSettingsData()
  331. # std::string ColormapKey = ""; /* original C++ signature */
  332. # If displaying several images, those with the same ColormapKey will adjust together
  333. colormap_key: str = ""
  334. #
  335. # Zoom and pan with the mouse
  336. #
  337. # bool PanWithMouse = true; /* original C++ signature */
  338. pan_with_mouse: bool = True
  339. # bool ZoomWithMouseWheel = true; /* original C++ signature */
  340. zoom_with_mouse_wheel: bool = True
  341. # bool CanResize = true; /* original C++ signature */
  342. # Can the image widget be resized by the user
  343. can_resize: bool = True
  344. # bool ResizeKeepAspectRatio = true; /* original C++ signature */
  345. # Does the widget keep an aspect ratio equal to the image when resized
  346. resize_keep_aspect_ratio: bool = True
  347. # int SelectedChannel = -1; /* original C++ signature */
  348. #
  349. # Image display options
  350. #
  351. # if SelectedChannel >= 0 then only this channel is displayed
  352. selected_channel: int = -1
  353. # bool ShowSchoolPaperBackground = true; /* original C++ signature */
  354. # Show a "school paper" background grid
  355. show_school_paper_background: bool = True
  356. # bool ShowAlphaChannelCheckerboard = true; /* original C++ signature */
  357. # show a checkerboard behind transparent portions of 4 channels RGBA images
  358. show_alpha_channel_checkerboard: bool = True
  359. # bool ShowGrid = true; /* original C++ signature */
  360. # Grid displayed when the zoom is high
  361. show_grid: bool = True
  362. # bool DrawValuesOnZoomedPixels = true; /* original C++ signature */
  363. # Pixel values show when the zoom is high
  364. draw_values_on_zoomed_pixels: bool = True
  365. # bool ShowImageInfo = true; /* original C++ signature */
  366. #
  367. # Image display options
  368. #
  369. # Show matrix type and size
  370. show_image_info: bool = True
  371. # bool ShowPixelInfo = true; /* original C++ signature */
  372. # Show pixel values
  373. show_pixel_info: bool = True
  374. # bool ShowZoomButtons = true; /* original C++ signature */
  375. # Show buttons that enable to zoom in/out (the mouse wheel also zoom)
  376. show_zoom_buttons: bool = True
  377. # bool ShowOptionsPanel = false; /* original C++ signature */
  378. # Open the options panel
  379. show_options_panel: bool = False
  380. # bool ShowOptionsInTooltip = false; /* original C++ signature */
  381. # If set to True, then the option panel will be displayed in a transient tooltip window
  382. show_options_in_tooltip: bool = False
  383. # bool ShowOptionsButton = true; /* original C++ signature */
  384. # If set to False, then the Options button will not be displayed
  385. show_options_button: bool = True
  386. # std::vector<Point> WatchedPixels = std::vector<Point>(); /* original C++ signature */
  387. #
  388. # Watched Pixels
  389. #
  390. # List of Watched Pixel coordinates
  391. watched_pixels: List[Point] = List[Point]()
  392. # bool AddWatchedPixelOnDoubleClick = true; /* original C++ signature */
  393. # Shall we add a watched pixel on double click
  394. add_watched_pixel_on_double_click: bool = True
  395. # bool HighlightWatchedPixels = true; /* original C++ signature */
  396. # Shall the watched pixels be drawn on the image
  397. highlight_watched_pixels: bool = True
  398. # MouseInformation MouseInfo = MouseInformation(); /* original C++ signature */
  399. # Mouse position information. These values are filled after displaying an image
  400. mouse_info: MouseInformation = MouseInformation()
  401. # ImageParams(bool RefreshImage = false, Size ImageDisplaySize = (0, 0), Matrix33d ZoomPanMatrix = [[1,0,0],[0,1,0],[0,0,1]], std::string ZoomKey = "", ColormapSettingsData ColormapSettings = ColormapSettingsData(), std::string ColormapKey = "", bool PanWithMouse = true, bool ZoomWithMouseWheel = true, bool CanResize = true, bool ResizeKeepAspectRatio = true, int SelectedChannel = -1, bool ShowSchoolPaperBackground = true, bool ShowAlphaChannelCheckerboard = true, bool ShowGrid = true, bool DrawValuesOnZoomedPixels = true, bool ShowImageInfo = true, bool ShowPixelInfo = true, bool ShowZoomButtons = true, bool ShowOptionsPanel = false, bool ShowOptionsInTooltip = false, bool ShowOptionsButton = true, std::vector<Point> WatchedPixels = std::vector<Point>(), bool AddWatchedPixelOnDoubleClick = true, bool HighlightWatchedPixels = true, MouseInformation MouseInfo = MouseInformation()); /* original C++ signature */
  402. def __init__(
  403. self,
  404. refresh_image: bool = False,
  405. image_display_size: Optional[Size] = None,
  406. zoom_pan_matrix: Optional[Matrix33d] = None,
  407. zoom_key: str = "",
  408. colormap_settings: Optional[ColormapSettingsData] = None,
  409. colormap_key: str = "",
  410. pan_with_mouse: bool = True,
  411. zoom_with_mouse_wheel: bool = True,
  412. can_resize: bool = True,
  413. resize_keep_aspect_ratio: bool = True,
  414. selected_channel: int = -1,
  415. show_school_paper_background: bool = True,
  416. show_alpha_channel_checkerboard: bool = True,
  417. show_grid: bool = True,
  418. draw_values_on_zoomed_pixels: bool = True,
  419. show_image_info: bool = True,
  420. show_pixel_info: bool = True,
  421. show_zoom_buttons: bool = True,
  422. show_options_panel: bool = False,
  423. show_options_in_tooltip: bool = False,
  424. show_options_button: bool = True,
  425. watched_pixels: Optional[List[Point]] = None,
  426. add_watched_pixel_on_double_click: bool = True,
  427. highlight_watched_pixels: bool = True,
  428. mouse_info: Optional[MouseInformation] = None,
  429. ) -> None:
  430. """Auto-generated default constructor with named params
  431. Python bindings defaults:
  432. If any of the params below is None, then its default value below will be used:
  433. * ImageDisplaySize: (0, 0)
  434. * ZoomPanMatrix: Matrix33.eye()
  435. * ColormapSettings: ColormapSettingsData()
  436. * WatchedPixels: List[Point]()
  437. * MouseInfo: MouseInformation()
  438. """
  439. pass
  440. # #ifdef IMMVISION_SERIALIZE_JSON
  441. #
  442. # IMMVISION_API std::string ImageParamsToJson(const ImageParams& params); /* original C++ signature */
  443. def image_params_to_json(params: ImageParams) -> str:
  444. pass
  445. # IMMVISION_API void FillImageParamsFromJson(const std::string& json, ImageParams* params); /* original C++ signature */
  446. def fill_image_params_from_json(json: str, params: ImageParams) -> None:
  447. pass
  448. # IMMVISION_API ImageParams ImageParamsFromJson(const std::string& json); /* original C++ signature */
  449. def image_params_from_json(json: str) -> ImageParams:
  450. pass
  451. # #endif
  452. #
  453. # IMMVISION_API ImageParams FactorImageParamsDisplayOnly(); /* original C++ signature */
  454. def factor_image_params_display_only() -> ImageParams:
  455. """Create ImageParams that display the image only, with no decoration, and no user interaction"""
  456. pass
  457. # IMMVISION_API Matrix33d MakeZoomPanMatrix( /* original C++ signature */
  458. # const Point2d & zoomCenter,
  459. # double zoomRatio,
  460. # const Size displayedImageSize
  461. # );
  462. def make_zoom_pan_matrix(
  463. zoom_center: Point2d, zoom_ratio: float, displayed_image_size: Size
  464. ) -> Matrix33d:
  465. """Create a zoom/pan matrix centered around a given point of interest"""
  466. pass
  467. # IMMVISION_API Matrix33d MakeZoomPanMatrix_ScaleOne( /* original C++ signature */
  468. # Size imageSize,
  469. # const Size displayedImageSize
  470. # );
  471. def make_zoom_pan_matrix_scale_one(
  472. image_size: Size, displayed_image_size: Size
  473. ) -> Matrix33d:
  474. pass
  475. # IMMVISION_API Matrix33d MakeZoomPanMatrix_FullView( /* original C++ signature */
  476. # Size imageSize,
  477. # const Size displayedImageSize
  478. # );
  479. def make_zoom_pan_matrix_full_view(
  480. image_size: Size, displayed_image_size: Size
  481. ) -> Matrix33d:
  482. pass
  483. # IMMVISION_API void Image(const std::string& label, const ImageBuffer& image, ImageParams* params); /* original C++ signature */
  484. def image(label: str, image: ImageBuffer, params: ImageParams) -> None:
  485. """Display an image, with full user control: zoom, pan, watch pixels, etc.
  486. :param label
  487. A legend that will be displayed.
  488. Important notes:
  489. - With ImGui and ImmVision, widgets *must* have a unique Ids.
  490. For this widget, the id is given by this label.
  491. Two widgets (for example) two images *cannot* have the same label or the same id!
  492. (you can use ImGui::PushID / ImGui::PopID to circumvent this, or add suffixes with ##)
  493. If they do, they might not refresh correctly!
  494. To circumvent this, you can:
  495. - Call `ImGui::PushID("some_unique_string")` at the start of your function,
  496. and `ImGui::PopID()` at the end.
  497. - Or modify your label like this:
  498. "MyLabel##some_unique_id"
  499. (the part after "##" will not be displayed but will be part of the id)
  500. - To display an empty legend, use "##_some_unique_id"
  501. :param image
  502. The image to display. All dense image types are supported (uint8, int16, float32, etc.).
  503. C++: accepts ImageBuffer directly, or cv::Mat (implicit conversion, zero-copy).
  504. Python: pass a numpy.ndarray.
  505. :param params
  506. Complete options (as modifiable inputs), and outputs (mouse position, watched pixels, etc)
  507. @see ImageParams structure.
  508. The ImageParams may be modified by this function: you can extract from them
  509. the mouse position, watched pixels, etc.
  510. Important note:
  511. ImageParams is an input-output parameter, passed as a pointer.
  512. Its scope should be wide enough so that it is preserved from frame to frame.
  513. !! If you cannot zoom/pan in a displayed image, extend the scope of the ImageParams !!
  514. - This function requires that both imgui and OpenGL were initialized.
  515. (for example, use `imgui_runner.run`for Python, or `HelloImGui::Run` for C++)
  516. """
  517. pass
  518. # IMMVISION_API Point2d ImageDisplay( /* original C++ signature */
  519. # const std::string& label_id,
  520. # const ImageBuffer& image,
  521. # const Size& imageDisplaySize = (0, 0),
  522. # bool refreshImage = false,
  523. # bool showOptionsButton = false
  524. # );
  525. def image_display(
  526. label_id: str,
  527. image: ImageBuffer,
  528. image_display_size: Optional[Size] = None,
  529. refresh_image: bool = False,
  530. show_options_button: bool = False,
  531. ) -> Point2d:
  532. """ImageDisplay: Only, display the image, with no user interaction (by default)
  533. Parameters:
  534. :param label_id
  535. A legend that will be displayed.
  536. Important notes:
  537. - With ImGui and ImmVision, widgets must have a unique Ids. For this widget, the id is given by this label.
  538. Two widgets (for example) two images *cannot* have the same label or the same id!
  539. If they do, they might not refresh correctly!
  540. To circumvent this, you can modify your label like this:
  541. "MyLabel##some_unique_id" (the part after "##" will not be displayed but will be part of the id)
  542. - To display an empty legend, use "##_some_unique_id"
  543. - if your legend is displayed (i.e. it does not start with "##"),
  544. then the total size of the widget will be larger than the imageDisplaySize.
  545. :param image:
  546. The image to display. All dense image types are supported.
  547. C++: accepts ImageBuffer directly, or cv::Mat (implicit conversion, zero-copy).
  548. Python: pass a numpy.ndarray.
  549. :param imageDisplaySize:
  550. Size of the displayed image (can be different from the image size)
  551. If you specify only the width or height (e.g (300, 0), then the other dimension
  552. will be calculated automatically, respecting the original image w/h ratio.
  553. :param refreshImage:
  554. images textures are cached. Set to True if your image has changed
  555. (for example, for live video images)
  556. :param showOptionsButton:
  557. If True, show an option button that opens the option panel.
  558. In that case, it also becomes possible to zoom & pan, add watched pixel by double-clicking, etc.
  559. :return:
  560. The mouse position in the original image coordinates, as double values.
  561. (i.e. it does not matter if imageDisplaySize is different from the image size)
  562. It will return (-1., -1.) if the mouse is not hovering the image.
  563. Note: use ImGui::IsMouseDown(mouse_button) (C++) or imgui.is_mouse_down(mouse_button) (Python)
  564. to query more information about the mouse.
  565. Note: this function requires that both imgui and OpenGL were initialized.
  566. (for example, use `imgui_runner.run`for Python, or `HelloImGui::Run` for C++)
  567. Python bindings defaults:
  568. If imageDisplaySize is None, then its default value will be: (0, 0)
  569. """
  570. pass
  571. # IMMVISION_API Point2d ImageDisplayResizable( /* original C++ signature */
  572. # const std::string& label_id,
  573. # const ImageBuffer& image,
  574. # ImVec2* size = nullptr,
  575. # bool refreshImage = false,
  576. # bool resizable = true,
  577. # bool showOptionsButton = false
  578. # );
  579. def image_display_resizable(
  580. label_id: str,
  581. image: ImageBuffer,
  582. size: Optional[ImVec2Like] = None,
  583. refresh_image: bool = False,
  584. resizable: bool = True,
  585. show_options_button: bool = False,
  586. ) -> Point2d:
  587. """ImageDisplayResizable: display the image, with no user interaction (by default)
  588. The image can be resized by the user (and the new size will be stored in the size parameter, if provided)
  589. The label will not be displayed (but it will be used as an id, and must be unique)
  590. :param image:
  591. The image to display.
  592. C++: accepts ImageBuffer directly, or cv::Mat (implicit conversion, zero-copy).
  593. Python: pass a numpy.ndarray.
  594. """
  595. pass
  596. # IMMVISION_API std::vector<std::string> AvailableColormaps(); /* original C++ signature */
  597. def available_colormaps() -> List[str]:
  598. """Return the list of the available color maps
  599. Taken from https://github.com/yuki-koyama/tinycolormap, thanks to Yuki Koyama
  600. """
  601. pass
  602. # IMMVISION_API void ClearTextureCache(); /* original C++ signature */
  603. def clear_texture_cache() -> None:
  604. """Clears the internal texture cache of immvision (this is done automatically at exit time)
  605. Note: this function requires that both imgui and OpenGL were initialized.
  606. (for example, use `imgui_runner.run`for Python, or `HelloImGui::Run` for C++)
  607. """
  608. pass
  609. # IMMVISION_API ImageBuffer GetCachedRgbaImage(const std::string& label); /* original C++ signature */
  610. def get_cached_rgba_image(label: str) -> ImageBuffer:
  611. """Returns the RGBA image currently displayed by ImmVision::Image or ImmVision::ImageDisplay
  612. Note: this image must be currently displayed. This function will return the transformed image
  613. (i.e with ColorMap, Zoom, etc.)
  614. """
  615. pass
  616. # IMMVISION_API std::string VersionInfo(); /* original C++ signature */
  617. def version_info() -> str:
  618. """Return immvision version info"""
  619. pass
  620. # IMMVISION_API ImageBuffer ImRead(const std::string& filename); /* original C++ signature */
  621. def im_read(filename: str) -> ImageBuffer:
  622. """Load an image from file (PNG, JPG, BMP, TGA, HDR, etc.) using stb_image.
  623. Returns an empty ImageBuffer if loading fails.
  624. The returned image is always in RGB order (not BGR).
  625. For uint8 images: channels are as stored in file (1, 3, or 4).
  626. For HDR images: returns float32 data.
  627. """
  628. pass
  629. #################### </generated_from:image.h> ####################
  630. #################### <generated_from:inspector.h> ####################
  631. # IMMVISION_API is a marker for public API functions. IMMVISION_STRUCT_API is a marker for public API structs (in comment lines)
  632. # Usage of ImmVision as a shared library is not recommended. No guaranty of ABI stability is provided
  633. # IMMVISION_API void Inspector_AddImage( /* original C++ signature */
  634. # const ImageBuffer& image,
  635. # const std::string& legend,
  636. # const std::string& zoomKey = "",
  637. # const std::string& colormapKey = "",
  638. # const Point2d & zoomCenter = (0., 0.),
  639. # double zoomRatio = -1.
  640. # );
  641. def inspector_add_image(
  642. image: ImageBuffer,
  643. legend: str,
  644. zoom_key: str = "",
  645. colormap_key: str = "",
  646. zoom_center: Optional[Point2d] = None,
  647. zoom_ratio: float = -1.0,
  648. ) -> None:
  649. """Add an image to the inspector. Call this from anywhere (e.g. at different steps
  650. of an image processing pipeline). Later, call Inspector_Show() to display all collected images.
  651. :param image:
  652. The image to add.
  653. C++: accepts ImageBuffer directly, or cv::Mat (implicit conversion, zero-copy).
  654. Python: pass a numpy.ndarray.
  655. Python bindings defaults:
  656. If zoomCenter is None, then its default value will be: Point2()
  657. """
  658. pass
  659. # IMMVISION_API void Inspector_Show(); /* original C++ signature */
  660. def inspector_show() -> None:
  661. pass
  662. # IMMVISION_API void Inspector_ClearImages(); /* original C++ signature */
  663. def inspector_clear_images() -> None:
  664. pass
  665. #################### </generated_from:inspector.h> ####################
  666. #################### <generated_from:gl_texture.h> ####################
  667. class GlTexture:
  668. """GlTexture contains an OpenGL texture which can be created or updated from an ImageBuffer (C++), or numpy array (Python)"""
  669. #
  670. # Constructors
  671. #
  672. # GlTexture(); /* original C++ signature */
  673. @overload
  674. def __init__(self) -> None:
  675. """Create an empty texture"""
  676. pass
  677. # GlTexture(const ImageBuffer& image, bool isColorOrderBGR = false); /* original C++ signature */
  678. @overload
  679. def __init__(self, image: ImageBuffer, is_color_order_bgr: bool = False) -> None:
  680. """Create a texture from an image (ImageBuffer in C++, numpy array in Python)
  681. isColorOrderBGR: if True, the image is assumed to be in BGR order (OpenCV default)
  682. """
  683. pass
  684. # GlTexture(GlTexture&& other) noexcept = default; /* original C++ signature */
  685. @overload
  686. def __init__(self, other: GlTexture) -> None:
  687. pass
  688. #
  689. # Methods
  690. #
  691. # void UpdateFromImage(const ImageBuffer& image, bool isColorOrderBGR = false); /* original C++ signature */
  692. def update_from_image(
  693. self, image: ImageBuffer, is_color_order_bgr: bool = False
  694. ) -> None:
  695. """Update the texture from a new image (ImageBuffer in C++, numpy array in Python).
  696. (private API)
  697. """
  698. pass
  699. # ImVec2 SizeImVec2() const; /* original C++ signature */
  700. def size_im_vec2(self) -> ImVec2:
  701. """Returns the size as ImVec2
  702. (private API)
  703. """
  704. pass
  705. #
  706. # Members
  707. #
  708. # ImTextureID TextureId; /* original C++ signature */
  709. # OpenGL texture ID on the GPU
  710. texture_id: ImTextureID
  711. # Size ImageSize; /* original C++ signature */
  712. # Image size in pixels
  713. image_size: Size
  714. #################### </generated_from:gl_texture.h> ####################
  715. # </litgen_stub> // Autogenerated code end!