| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829 |
- ###############################################################################
- # This file is a part of Dear ImGui Bundle
- # -----------------------------------------------------------------------------
- # immvision.pyi: auto-generated bindings for ImmVision, an immediate image
- # debugger and insights tool. See https://github.com/pthom/immvision.git
- #
- # Most of the code of this file is automatically generated (using https://pthom.github.io/litgen/),
- # and is generally very close to the C++ version. Comments, docs are identical.
- # Do not manually edit the autogenerated parts (look for "Autogenerated" comments)!
- ###############################################################################
- # ruff: noqa: B008
- from typing import List, Tuple, TypeAlias, Optional, overload
- import enum
- import numpy as np
- from numpy.typing import NDArray
- from imgui_bundle import ImVec2, ImVec2Like
- Point2d: TypeAlias = Tuple[float, float]
- Point: TypeAlias = Tuple[int, int]
- Size: TypeAlias = Tuple[int, int]
- ImageBuffer: TypeAlias = NDArray[np.number]
- Mat: TypeAlias = NDArray[np.number] # Legacy alias for ImageBuffer
- Matrix33d: TypeAlias = List[
- List[float]
- ] # 3x3 affine transformation matrix (for zoom/pan)
- Matx33d: TypeAlias = Matrix33d # Legacy alias
- Image_RGBA: TypeAlias = NDArray[np.uint8]
- Image_RGB: TypeAlias = NDArray[np.uint8]
- ImTextureID: TypeAlias = int
- # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- # <litgen_stub> // Autogenerated code below! Do not edit!
- #################### <generated_from:immvision_types.h> ####################
- # IMMVISION_API is a marker for public API functions.
- #
- # ImmVision types
- # ===============
- #
- # ImmVision uses its own lightweight types for images, points, sizes, and matrices.
- # These types do not depend on OpenCV.
- #
- # C++ users:
- # If OpenCV is available (IMMVISION_HAS_OPENCV is defined), all types provide
- # implicit conversions to/from their OpenCV equivalents:
- # ImageBuffer <-> cv::Mat (zero-copy via ImageBuffer(cv::Mat) and to_cv_mat())
- # Point <-> cv::Point (implicit both ways)
- # Point2 <-> cv::Point2 (implicit both ways)
- # Size <-> cv::Size (implicit both ways)
- # Matrix33 <-> cv::Matx33 (implicit both ways)
- # This means you can pass cv::Mat, cv::Point, etc. directly to ImmVision functions.
- #
- # Python users:
- # These types are mapped transparently to native Python types:
- # ImageBuffer <-> numpy.ndarray
- # Point <-> Tuple[int, int]
- # Point2 <-> Tuple[float, float]
- # Size <-> Tuple[int, int]
- # Matrix33 <-> List[List[float]] (3x3)
- # You never need to create these types explicitly in Python.
- #
- class Size2d:
- """2D double-precision size. Used for drawing operations (ellipse, rectangle_size)."""
- # double width = 0., /* original C++ signature */
- width: float = 0.0
- # height = 0.; /* original C++ signature */
- height: float = 0.0
- # Size2d() = default; /* original C++ signature */
- @overload
- def __init__(self) -> None:
- pass
- # Size2d(double w, double h) : width(w), height(h) {} /* original C++ signature */
- @overload
- def __init__(self, w: float, h: float) -> None:
- pass
- # Size2d(const Size& s) : width((double)s.width), height((double)s.height) {} /* original C++ signature */
- @overload
- def __init__(self, s: Size) -> None:
- pass
- class Color4d:
- """4-channel double color value (e.g. RGBA or BGRA)."""
- # double v[4] = {0, 0, 0, 255}; /* original C++ signature */
- v: np.ndarray # ndarray[type=double, size=4] default:float(0, 0, 0, 255)
- # double& operator[](int i) { return v[i]; } /* original C++ signature */
- def __getitem__(self, i: int) -> float:
- """(private API)"""
- pass
- # Color4d() = default; /* original C++ signature */
- @overload
- def __init__(self) -> None:
- pass
- # Color4d(double v0, double v1, double v2, double v3) : v{v0, v1, v2, v3} {} /* original C++ signature */
- @overload
- def __init__(self, v0: float, v1: float, v2: float, v3: float) -> None:
- pass
- class Rect:
- """Integer rectangle (x, y, width, height)."""
- # int x = 0, /* original C++ signature */
- x: int = 0
- # y = 0, /* original C++ signature */
- y: int = 0
- # width = 0, /* original C++ signature */
- width: int = 0
- # height = 0; /* original C++ signature */
- height: int = 0
- # Rect() = default; /* original C++ signature */
- @overload
- def __init__(self) -> None:
- pass
- # Rect(int x_, int y_, int w, int h) : x(x_), y(y_), width(w), height(h) {} /* original C++ signature */
- @overload
- def __init__(self, x_: int, y_: int, w: int, h: int) -> None:
- pass
- # Rect(Point pt, Size sz) : x(pt.x), y(pt.y), width(sz.width), height(sz.height) {} /* original C++ signature */
- @overload
- def __init__(self, pt: Point, sz: Size) -> None:
- pass
- # Rect(Point pt1, Point pt2) /* original C++ signature */
- # : x(std::min(pt1.x, pt2.x)), y(std::min(pt1.y, pt2.y)),
- # width(std::max(pt1.x, pt2.x) - x), height(std::max(pt1.y, pt2.y) - y) {}
- @overload
- def __init__(self, pt1: Point, pt2: Point) -> None:
- """Construct from two corner points (top-left and bottom-right)"""
- pass
- # bool empty() const { return width <= 0 || height <= 0; } /* original C++ signature */
- def empty(self) -> bool:
- """(private API)"""
- pass
- # int area() const { return width * height; } /* original C++ signature */
- def area(self) -> int:
- """(private API)"""
- pass
- # bool contains(Point pt) const { return pt.x >= x && pt.x < x + width && pt.y >= y && pt.y < y + height; } /* original C++ signature */
- def contains(self, pt: Point) -> bool:
- """(private API)"""
- pass
- # Size size() const { return {width, height}; } /* original C++ signature */
- def size(self) -> Size:
- """(private API)"""
- pass
- #################### </generated_from:immvision_types.h> ####################
- #################### <generated_from:image.h> ####################
- # IMMVISION_API is a marker for public API functions. IMMVISION_STRUCT_API is a marker for public API structs (in comment lines)
- # Usage of ImmVision as a shared library is not recommended. No guaranty of ABI stability is provided
- # Set the color order for displayed images.
- # You **must** call once at the start of your program:
- # ImmVision::UseRgbColorOrder() or ImmVision::UseBgrColorOrder() (C++)
- # immvision.use_rgb_color_order() or immvision.use_bgr_color_order() (Python)
- # (Breaking change - October 2024)
- # void UseRgbColorOrder(); /* original C++ signature */
- def use_rgb_color_order() -> None:
- """(private API)"""
- pass
- # void UseBgrColorOrder(); /* original C++ signature */
- def use_bgr_color_order() -> None:
- """(private API)"""
- pass
- # bool IsUsingRgbColorOrder(); /* original C++ signature */
- def is_using_rgb_color_order() -> bool:
- """Returns True if we are using RGB color order
- (private API)
- """
- pass
- # bool IsUsingBgrColorOrder(); /* original C++ signature */
- def is_using_bgr_color_order() -> bool:
- """Returns True if we are using BGR color order
- (private API)
- """
- pass
- # bool IsColorOrderUndefined(); /* original C++ signature */
- def is_color_order_undefined() -> bool:
- """Returns True if the color order is undefined (i.e. UseRgbColorOrder or UseBgrColorOrder was not called)
- (private API)
- """
- pass
- # Temporary change of color order (useful for displaying a single image with a different color order)
- # void PushColorOrderRgb(); /* original C++ signature */
- def push_color_order_rgb() -> None:
- """(private API)"""
- pass
- # void PushColorOrderBgr(); /* original C++ signature */
- def push_color_order_bgr() -> None:
- """(private API)"""
- pass
- # void PopColorOrder(); /* original C++ signature */
- def pop_color_order() -> None:
- """(private API)"""
- pass
- class ColorMapStatsTypeId(enum.IntEnum):
- """Are we using the stats on the full image, on the Visible ROI, or are we using Min/Max values"""
- # FromFullImage, /* original C++ signature */
- from_full_image = enum.auto() # (= 0)
- # FromVisibleROI /* original C++ signature */
- # }
- from_visible_roi = enum.auto() # (= 1)
- class ColormapScaleFromStatsData:
- """Scale the Colormap according to the Image stats
- IMMVISION_API_STRUCT
- """
- # ColorMapStatsTypeId ColorMapStatsType = ColorMapStatsTypeId::FromFullImage; /* original C++ signature */
- # Are we using the stats on the full image, the visible ROI, or are we using Min/Max values
- color_map_stats_type: ColorMapStatsTypeId = ColorMapStatsTypeId.from_full_image
- # double NbSigmas = 1.5; /* original C++ signature */
- # If stats active (either on ROI or on Image), how many sigmas around the mean should the Colormap be applied
- nb_sigmas: float = 1.5
- # bool UseStatsMin = false; /* original C++ signature */
- # If ColorMapScaleType==ColorMapStatsType::FromMinMax, then ColormapScaleMin will be calculated from the matrix min value instead of a sigma based value
- use_stats_min: bool = False
- # bool UseStatsMax = false; /* original C++ signature */
- # If ColorMapScaleType==ColorMapStatsType::FromMinMax, then ColormapScaleMax will be calculated from the matrix min value instead of a sigma based value
- use_stats_max: bool = False
- # ColormapScaleFromStatsData(ColorMapStatsTypeId ColorMapStatsType = ColorMapStatsTypeId::FromFullImage, double NbSigmas = 1.5, bool UseStatsMin = false, bool UseStatsMax = false); /* original C++ signature */
- def __init__(
- self,
- color_map_stats_type: ColorMapStatsTypeId = ColorMapStatsTypeId.from_full_image,
- nb_sigmas: float = 1.5,
- use_stats_min: bool = False,
- use_stats_max: bool = False,
- ) -> None:
- """Auto-generated default constructor with named params"""
- pass
- class ColormapSettingsData:
- """Colormap Settings (useful for matrices with one channel, in order to see colors mapping float values)
- IMMVISION_API_STRUCT
- """
- # std::string Colormap = "None"; /* original C++ signature */
- # Colormap, see available Colormaps with AvailableColormaps()
- # Work only with 1 channel matrices, i.e len(shape)==2
- colormap: str = "None"
- # ColormapScaleMin and ColormapScaleMax indicate how the Colormap is applied:
- # - Values in [ColormapScaleMin, ColomapScaleMax] will use the full colormap.
- # - Values outside this interval will be clamped before coloring
- # by default, the initial values are ignored, and they will be updated automatically
- # via the options in ColormapScaleFromStats
- # double ColormapScaleMin = 0.; /* original C++ signature */
- colormap_scale_min: float = 0.0
- # double ColormapScaleMax = 1.; /* original C++ signature */
- colormap_scale_max: float = 1.0
- # ColormapScaleFromStatsData ColormapScaleFromStats = ColormapScaleFromStatsData(); /* original C++ signature */
- # If ColormapScaleFromStats.ActiveOnFullImage or ColormapScaleFromStats.ActiveOnROI,
- # then ColormapScaleMin/Max are ignored, and the scaling is done according to the image stats.
- # ColormapScaleFromStats.ActiveOnFullImage is True by default
- colormap_scale_from_stats: ColormapScaleFromStatsData = ColormapScaleFromStatsData()
- # std::string internal_ColormapHovered = ""; /* original C++ signature */
- # Internal value: stores the name of the Colormap that is hovered by the mouse
- internal_colormap_hovered: str = ""
- # ColormapSettingsData(std::string Colormap = "None", double ColormapScaleMin = 0., double ColormapScaleMax = 1., ColormapScaleFromStatsData ColormapScaleFromStats = ColormapScaleFromStatsData(), std::string internal_ColormapHovered = ""); /* original C++ signature */
- def __init__(
- self,
- colormap: str = "None",
- colormap_scale_min: float = 0.0,
- colormap_scale_max: float = 1.0,
- colormap_scale_from_stats: Optional[ColormapScaleFromStatsData] = None,
- internal_colormap_hovered: str = "",
- ) -> None:
- """Auto-generated default constructor with named params
- Python bindings defaults:
- If ColormapScaleFromStats is None, then its default value will be: ColormapScaleFromStatsData()
- """
- pass
- class MouseInformation:
- """Contains information about the mouse inside an image
- IMMVISION_API_STRUCT
- """
- # bool IsMouseHovering = false; /* original C++ signature */
- # Is the mouse hovering the image
- is_mouse_hovering: bool = False
- # Point2d MousePosition = (-1., -1.); /* original C++ signature */
- # Mouse position in the original image/matrix
- # This position is given with float coordinates, and will be (-1., -1.) if the mouse is not hovering the image
- mouse_position: Point2d = (-1.0, -1.0)
- # Point MousePosition_Displayed = (-1, -1); /* original C++ signature */
- # Mouse position in the displayed portion of the image (the original image can be zoomed,
- # and only show a subset if it may be shown).
- # This position is given with integer coordinates, and will be (-1, -1) if the mouse is not hovering the image
- mouse_position_displayed: Point = (-1, -1)
- #
- # Note: you can query ImGui::IsMouseDown(mouse_button) (c++) or imgui.is_mouse_down(mouse_button) (Python)
- #
- # MouseInformation(bool IsMouseHovering = false, Point2d MousePosition = (-1., -1.), Point MousePosition_Displayed = (-1, -1)); /* original C++ signature */
- def __init__(
- self,
- is_mouse_hovering: bool = False,
- mouse_position: Optional[Point2d] = None,
- mouse_position_displayed: Optional[Point] = None,
- ) -> None:
- """Auto-generated default constructor with named params
- Python bindings defaults:
- If any of the params below is None, then its default value below will be used:
- * MousePosition: Point2(-1., -1.)
- * MousePosition_Displayed: (-1, -1)
- """
- pass
- class ImageParams:
- """Set of display parameters and options for an Image
- IMMVISION_API_STRUCT
- """
- #
- # ImageParams store the parameters for a displayed image
- # (as well as user selected watched pixels, selected channel, etc.)
- # Its default constructor will give them reasonable choices, which you can adapt to your needs.
- # Its values will be updated when the user pans or zooms the image, adds watched pixels, etc.
- #
- #
- # Refresh Images Textures
- #
- # bool RefreshImage = false; /* original C++ signature */
- # Refresh Image: images textures are cached. Set to True if your image matrix/buffer has changed
- # (for example, for live video images)
- refresh_image: bool = False
- #
- # Display size and title
- #
- # Size ImageDisplaySize = (0, 0); /* original C++ signature */
- # Size of the displayed image (can be different from the matrix size)
- # If you specify only the width or height (e.g (300, 0), then the other dimension
- # will be calculated automatically, respecting the original image w/h ratio.
- image_display_size: Size = (0, 0)
- #
- # Zoom and Pan (represented by an affine transform matrix, of size 3x3)
- #
- # Matrix33d ZoomPanMatrix = [[1,0,0],[0,1,0],[0,0,1]]; /* original C++ signature */
- # ZoomPanMatrix can be created using MakeZoomPanMatrix to create a view centered around a given point
- zoom_pan_matrix: Matrix33d = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
- # std::string ZoomKey = ""; /* original C++ signature */
- # If displaying several images, those with the same ZoomKey will zoom and pan together
- zoom_key: str = ""
- # ColormapSettingsData ColormapSettings = ColormapSettingsData(); /* original C++ signature */
- #
- # Colormap Settings (useful for matrices with one channel, in order to see colors mapping float values)
- #
- # ColormapSettings stores all the parameter concerning the Colormap
- colormap_settings: ColormapSettingsData = ColormapSettingsData()
- # std::string ColormapKey = ""; /* original C++ signature */
- # If displaying several images, those with the same ColormapKey will adjust together
- colormap_key: str = ""
- #
- # Zoom and pan with the mouse
- #
- # bool PanWithMouse = true; /* original C++ signature */
- pan_with_mouse: bool = True
- # bool ZoomWithMouseWheel = true; /* original C++ signature */
- zoom_with_mouse_wheel: bool = True
- # bool CanResize = true; /* original C++ signature */
- # Can the image widget be resized by the user
- can_resize: bool = True
- # bool ResizeKeepAspectRatio = true; /* original C++ signature */
- # Does the widget keep an aspect ratio equal to the image when resized
- resize_keep_aspect_ratio: bool = True
- # int SelectedChannel = -1; /* original C++ signature */
- #
- # Image display options
- #
- # if SelectedChannel >= 0 then only this channel is displayed
- selected_channel: int = -1
- # bool ShowSchoolPaperBackground = true; /* original C++ signature */
- # Show a "school paper" background grid
- show_school_paper_background: bool = True
- # bool ShowAlphaChannelCheckerboard = true; /* original C++ signature */
- # show a checkerboard behind transparent portions of 4 channels RGBA images
- show_alpha_channel_checkerboard: bool = True
- # bool ShowGrid = true; /* original C++ signature */
- # Grid displayed when the zoom is high
- show_grid: bool = True
- # bool DrawValuesOnZoomedPixels = true; /* original C++ signature */
- # Pixel values show when the zoom is high
- draw_values_on_zoomed_pixels: bool = True
- # bool ShowImageInfo = true; /* original C++ signature */
- #
- # Image display options
- #
- # Show matrix type and size
- show_image_info: bool = True
- # bool ShowPixelInfo = true; /* original C++ signature */
- # Show pixel values
- show_pixel_info: bool = True
- # bool ShowZoomButtons = true; /* original C++ signature */
- # Show buttons that enable to zoom in/out (the mouse wheel also zoom)
- show_zoom_buttons: bool = True
- # bool ShowOptionsPanel = false; /* original C++ signature */
- # Open the options panel
- show_options_panel: bool = False
- # bool ShowOptionsInTooltip = false; /* original C++ signature */
- # If set to True, then the option panel will be displayed in a transient tooltip window
- show_options_in_tooltip: bool = False
- # bool ShowOptionsButton = true; /* original C++ signature */
- # If set to False, then the Options button will not be displayed
- show_options_button: bool = True
- # std::vector<Point> WatchedPixels = std::vector<Point>(); /* original C++ signature */
- #
- # Watched Pixels
- #
- # List of Watched Pixel coordinates
- watched_pixels: List[Point] = List[Point]()
- # bool AddWatchedPixelOnDoubleClick = true; /* original C++ signature */
- # Shall we add a watched pixel on double click
- add_watched_pixel_on_double_click: bool = True
- # bool HighlightWatchedPixels = true; /* original C++ signature */
- # Shall the watched pixels be drawn on the image
- highlight_watched_pixels: bool = True
- # MouseInformation MouseInfo = MouseInformation(); /* original C++ signature */
- # Mouse position information. These values are filled after displaying an image
- mouse_info: MouseInformation = MouseInformation()
- # 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 */
- def __init__(
- self,
- refresh_image: bool = False,
- image_display_size: Optional[Size] = None,
- zoom_pan_matrix: Optional[Matrix33d] = None,
- zoom_key: str = "",
- colormap_settings: Optional[ColormapSettingsData] = None,
- colormap_key: str = "",
- pan_with_mouse: bool = True,
- zoom_with_mouse_wheel: bool = True,
- can_resize: bool = True,
- resize_keep_aspect_ratio: bool = True,
- selected_channel: int = -1,
- show_school_paper_background: bool = True,
- show_alpha_channel_checkerboard: bool = True,
- show_grid: bool = True,
- draw_values_on_zoomed_pixels: bool = True,
- show_image_info: bool = True,
- show_pixel_info: bool = True,
- show_zoom_buttons: bool = True,
- show_options_panel: bool = False,
- show_options_in_tooltip: bool = False,
- show_options_button: bool = True,
- watched_pixels: Optional[List[Point]] = None,
- add_watched_pixel_on_double_click: bool = True,
- highlight_watched_pixels: bool = True,
- mouse_info: Optional[MouseInformation] = None,
- ) -> None:
- """Auto-generated default constructor with named params
- Python bindings defaults:
- If any of the params below is None, then its default value below will be used:
- * ImageDisplaySize: (0, 0)
- * ZoomPanMatrix: Matrix33.eye()
- * ColormapSettings: ColormapSettingsData()
- * WatchedPixels: List[Point]()
- * MouseInfo: MouseInformation()
- """
- pass
- # #ifdef IMMVISION_SERIALIZE_JSON
- #
- # IMMVISION_API std::string ImageParamsToJson(const ImageParams& params); /* original C++ signature */
- def image_params_to_json(params: ImageParams) -> str:
- pass
- # IMMVISION_API void FillImageParamsFromJson(const std::string& json, ImageParams* params); /* original C++ signature */
- def fill_image_params_from_json(json: str, params: ImageParams) -> None:
- pass
- # IMMVISION_API ImageParams ImageParamsFromJson(const std::string& json); /* original C++ signature */
- def image_params_from_json(json: str) -> ImageParams:
- pass
- # #endif
- #
- # IMMVISION_API ImageParams FactorImageParamsDisplayOnly(); /* original C++ signature */
- def factor_image_params_display_only() -> ImageParams:
- """Create ImageParams that display the image only, with no decoration, and no user interaction"""
- pass
- # IMMVISION_API Matrix33d MakeZoomPanMatrix( /* original C++ signature */
- # const Point2d & zoomCenter,
- # double zoomRatio,
- # const Size displayedImageSize
- # );
- def make_zoom_pan_matrix(
- zoom_center: Point2d, zoom_ratio: float, displayed_image_size: Size
- ) -> Matrix33d:
- """Create a zoom/pan matrix centered around a given point of interest"""
- pass
- # IMMVISION_API Matrix33d MakeZoomPanMatrix_ScaleOne( /* original C++ signature */
- # Size imageSize,
- # const Size displayedImageSize
- # );
- def make_zoom_pan_matrix_scale_one(
- image_size: Size, displayed_image_size: Size
- ) -> Matrix33d:
- pass
- # IMMVISION_API Matrix33d MakeZoomPanMatrix_FullView( /* original C++ signature */
- # Size imageSize,
- # const Size displayedImageSize
- # );
- def make_zoom_pan_matrix_full_view(
- image_size: Size, displayed_image_size: Size
- ) -> Matrix33d:
- pass
- # IMMVISION_API void Image(const std::string& label, const ImageBuffer& image, ImageParams* params); /* original C++ signature */
- def image(label: str, image: ImageBuffer, params: ImageParams) -> None:
- """Display an image, with full user control: zoom, pan, watch pixels, etc.
- :param label
- A legend that will be displayed.
- Important notes:
- - With ImGui and ImmVision, widgets *must* have a unique Ids.
- For this widget, the id is given by this label.
- Two widgets (for example) two images *cannot* have the same label or the same id!
- (you can use ImGui::PushID / ImGui::PopID to circumvent this, or add suffixes with ##)
- If they do, they might not refresh correctly!
- To circumvent this, you can:
- - Call `ImGui::PushID("some_unique_string")` at the start of your function,
- and `ImGui::PopID()` at the end.
- - Or modify your label like this:
- "MyLabel##some_unique_id"
- (the part after "##" will not be displayed but will be part of the id)
- - To display an empty legend, use "##_some_unique_id"
- :param image
- The image to display. All dense image types are supported (uint8, int16, float32, etc.).
- C++: accepts ImageBuffer directly, or cv::Mat (implicit conversion, zero-copy).
- Python: pass a numpy.ndarray.
- :param params
- Complete options (as modifiable inputs), and outputs (mouse position, watched pixels, etc)
- @see ImageParams structure.
- The ImageParams may be modified by this function: you can extract from them
- the mouse position, watched pixels, etc.
- Important note:
- ImageParams is an input-output parameter, passed as a pointer.
- Its scope should be wide enough so that it is preserved from frame to frame.
- !! If you cannot zoom/pan in a displayed image, extend the scope of the ImageParams !!
- - This function requires that both imgui and OpenGL were initialized.
- (for example, use `imgui_runner.run`for Python, or `HelloImGui::Run` for C++)
- """
- pass
- # IMMVISION_API Point2d ImageDisplay( /* original C++ signature */
- # const std::string& label_id,
- # const ImageBuffer& image,
- # const Size& imageDisplaySize = (0, 0),
- # bool refreshImage = false,
- # bool showOptionsButton = false
- # );
- def image_display(
- label_id: str,
- image: ImageBuffer,
- image_display_size: Optional[Size] = None,
- refresh_image: bool = False,
- show_options_button: bool = False,
- ) -> Point2d:
- """ImageDisplay: Only, display the image, with no user interaction (by default)
- Parameters:
- :param label_id
- A legend that will be displayed.
- Important notes:
- - With ImGui and ImmVision, widgets must have a unique Ids. For this widget, the id is given by this label.
- Two widgets (for example) two images *cannot* have the same label or the same id!
- If they do, they might not refresh correctly!
- To circumvent this, you can modify your label like this:
- "MyLabel##some_unique_id" (the part after "##" will not be displayed but will be part of the id)
- - To display an empty legend, use "##_some_unique_id"
- - if your legend is displayed (i.e. it does not start with "##"),
- then the total size of the widget will be larger than the imageDisplaySize.
- :param image:
- The image to display. All dense image types are supported.
- C++: accepts ImageBuffer directly, or cv::Mat (implicit conversion, zero-copy).
- Python: pass a numpy.ndarray.
- :param imageDisplaySize:
- Size of the displayed image (can be different from the image size)
- If you specify only the width or height (e.g (300, 0), then the other dimension
- will be calculated automatically, respecting the original image w/h ratio.
- :param refreshImage:
- images textures are cached. Set to True if your image has changed
- (for example, for live video images)
- :param showOptionsButton:
- If True, show an option button that opens the option panel.
- In that case, it also becomes possible to zoom & pan, add watched pixel by double-clicking, etc.
- :return:
- The mouse position in the original image coordinates, as double values.
- (i.e. it does not matter if imageDisplaySize is different from the image size)
- It will return (-1., -1.) if the mouse is not hovering the image.
- Note: use ImGui::IsMouseDown(mouse_button) (C++) or imgui.is_mouse_down(mouse_button) (Python)
- to query more information about the mouse.
- Note: this function requires that both imgui and OpenGL were initialized.
- (for example, use `imgui_runner.run`for Python, or `HelloImGui::Run` for C++)
- Python bindings defaults:
- If imageDisplaySize is None, then its default value will be: (0, 0)
- """
- pass
- # IMMVISION_API Point2d ImageDisplayResizable( /* original C++ signature */
- # const std::string& label_id,
- # const ImageBuffer& image,
- # ImVec2* size = nullptr,
- # bool refreshImage = false,
- # bool resizable = true,
- # bool showOptionsButton = false
- # );
- def image_display_resizable(
- label_id: str,
- image: ImageBuffer,
- size: Optional[ImVec2Like] = None,
- refresh_image: bool = False,
- resizable: bool = True,
- show_options_button: bool = False,
- ) -> Point2d:
- """ImageDisplayResizable: display the image, with no user interaction (by default)
- The image can be resized by the user (and the new size will be stored in the size parameter, if provided)
- The label will not be displayed (but it will be used as an id, and must be unique)
- :param image:
- The image to display.
- C++: accepts ImageBuffer directly, or cv::Mat (implicit conversion, zero-copy).
- Python: pass a numpy.ndarray.
- """
- pass
- # IMMVISION_API std::vector<std::string> AvailableColormaps(); /* original C++ signature */
- def available_colormaps() -> List[str]:
- """Return the list of the available color maps
- Taken from https://github.com/yuki-koyama/tinycolormap, thanks to Yuki Koyama
- """
- pass
- # IMMVISION_API void ClearTextureCache(); /* original C++ signature */
- def clear_texture_cache() -> None:
- """Clears the internal texture cache of immvision (this is done automatically at exit time)
- Note: this function requires that both imgui and OpenGL were initialized.
- (for example, use `imgui_runner.run`for Python, or `HelloImGui::Run` for C++)
- """
- pass
- # IMMVISION_API ImageBuffer GetCachedRgbaImage(const std::string& label); /* original C++ signature */
- def get_cached_rgba_image(label: str) -> ImageBuffer:
- """Returns the RGBA image currently displayed by ImmVision::Image or ImmVision::ImageDisplay
- Note: this image must be currently displayed. This function will return the transformed image
- (i.e with ColorMap, Zoom, etc.)
- """
- pass
- # IMMVISION_API std::string VersionInfo(); /* original C++ signature */
- def version_info() -> str:
- """Return immvision version info"""
- pass
- # IMMVISION_API ImageBuffer ImRead(const std::string& filename); /* original C++ signature */
- def im_read(filename: str) -> ImageBuffer:
- """Load an image from file (PNG, JPG, BMP, TGA, HDR, etc.) using stb_image.
- Returns an empty ImageBuffer if loading fails.
- The returned image is always in RGB order (not BGR).
- For uint8 images: channels are as stored in file (1, 3, or 4).
- For HDR images: returns float32 data.
- """
- pass
- #################### </generated_from:image.h> ####################
- #################### <generated_from:inspector.h> ####################
- # IMMVISION_API is a marker for public API functions. IMMVISION_STRUCT_API is a marker for public API structs (in comment lines)
- # Usage of ImmVision as a shared library is not recommended. No guaranty of ABI stability is provided
- # IMMVISION_API void Inspector_AddImage( /* original C++ signature */
- # const ImageBuffer& image,
- # const std::string& legend,
- # const std::string& zoomKey = "",
- # const std::string& colormapKey = "",
- # const Point2d & zoomCenter = (0., 0.),
- # double zoomRatio = -1.
- # );
- def inspector_add_image(
- image: ImageBuffer,
- legend: str,
- zoom_key: str = "",
- colormap_key: str = "",
- zoom_center: Optional[Point2d] = None,
- zoom_ratio: float = -1.0,
- ) -> None:
- """Add an image to the inspector. Call this from anywhere (e.g. at different steps
- of an image processing pipeline). Later, call Inspector_Show() to display all collected images.
- :param image:
- The image to add.
- C++: accepts ImageBuffer directly, or cv::Mat (implicit conversion, zero-copy).
- Python: pass a numpy.ndarray.
- Python bindings defaults:
- If zoomCenter is None, then its default value will be: Point2()
- """
- pass
- # IMMVISION_API void Inspector_Show(); /* original C++ signature */
- def inspector_show() -> None:
- pass
- # IMMVISION_API void Inspector_ClearImages(); /* original C++ signature */
- def inspector_clear_images() -> None:
- pass
- #################### </generated_from:inspector.h> ####################
- #################### <generated_from:gl_texture.h> ####################
- class GlTexture:
- """GlTexture contains an OpenGL texture which can be created or updated from an ImageBuffer (C++), or numpy array (Python)"""
- #
- # Constructors
- #
- # GlTexture(); /* original C++ signature */
- @overload
- def __init__(self) -> None:
- """Create an empty texture"""
- pass
- # GlTexture(const ImageBuffer& image, bool isColorOrderBGR = false); /* original C++ signature */
- @overload
- def __init__(self, image: ImageBuffer, is_color_order_bgr: bool = False) -> None:
- """Create a texture from an image (ImageBuffer in C++, numpy array in Python)
- isColorOrderBGR: if True, the image is assumed to be in BGR order (OpenCV default)
- """
- pass
- # GlTexture(GlTexture&& other) noexcept = default; /* original C++ signature */
- @overload
- def __init__(self, other: GlTexture) -> None:
- pass
- #
- # Methods
- #
- # void UpdateFromImage(const ImageBuffer& image, bool isColorOrderBGR = false); /* original C++ signature */
- def update_from_image(
- self, image: ImageBuffer, is_color_order_bgr: bool = False
- ) -> None:
- """Update the texture from a new image (ImageBuffer in C++, numpy array in Python).
- (private API)
- """
- pass
- # ImVec2 SizeImVec2() const; /* original C++ signature */
- def size_im_vec2(self) -> ImVec2:
- """Returns the size as ImVec2
- (private API)
- """
- pass
- #
- # Members
- #
- # ImTextureID TextureId; /* original C++ signature */
- # OpenGL texture ID on the GPU
- texture_id: ImTextureID
- # Size ImageSize; /* original C++ signature */
- # Image size in pixels
- image_size: Size
- #################### </generated_from:gl_texture.h> ####################
- # </litgen_stub> // Autogenerated code end!
|