Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0e8fafe
PythonK4A: Adding initial directory structure, k4atypes.py which defi…
JonathanESantos Dec 9, 2020
b77771a
PythonK4A: Updating __init__.py to point to the "api" directory (rena…
JonathanESantos Dec 9, 2020
f1e90ba
Python K4A: Rearranging directory tree so that it matches the expecta…
JonathanESantos Dec 9, 2020
b2443dd
Python k4a api: Put ctypes structs inside k4atypes.py.
JonathanESantos Dec 10, 2020
1e8677c
Python k4a api: Adding to setup.py so that "pip install -e .[test]" w…
JonathanESantos Dec 10, 2020
071ab03
Python k4a api: An enum name with AUTO was mistakenly replaced with _…
JonathanESantos Dec 10, 2020
de120dd
Python k4a api: Adding __repr__() functions to structs in order to pr…
JonathanESantos Dec 10, 2020
ad64501
Python k4a api: Adding a check that the required dlls are in the _lib…
JonathanESantos Dec 10, 2020
8e5e3a1
Python k4a api: Adding the rest of the bindings for the functions tha…
JonathanESantos Dec 10, 2020
5d9db7b
Python k4a: Adding tests to call the functions in the dll.
JonathanESantos Dec 11, 2020
744ccb9
Python k4a: Adding missing enum in color resolution, and adding tests…
JonathanESantos Dec 12, 2020
f85d8d2
Python k4a: Changing @unittest.skip to @unittest.expectedfail for tho…
JonathanESantos Dec 12, 2020
c1a85d9
Python k4a: Updating docs. Removing platform tag in building the k4a …
JonathanESantos Dec 12, 2020
3c25d68
Python API: Renaming enums and structs to Python naming convention.
JonathanESantos Dec 16, 2020
88be9e5
Python API: Moving all internal files and symbols into the _bindings/…
JonathanESantos Dec 16, 2020
da31b2a
Python API: Moving handle structs from _k4a.py back to _k4atypes.py s…
JonathanESantos Dec 16, 2020
a080d08
Renaming modules inside _bindings subpackage to not include underscor…
JonathanESantos Dec 16, 2020
ee41c9a
Python api: Adding Device class which corresponds to a device with a …
JonathanESantos Dec 17, 2020
fddad4e
Python API: Adding capture and image classes to encapsulate capture a…
JonathanESantos Dec 22, 2020
c44293c
Python API: Bug in Image class was missing a height_pixels in one lin…
JonathanESantos Dec 22, 2020
76b3e83
Python API: Adding Calibration and Transformation wrapper classes.
JonathanESantos Dec 23, 2020
cd14e98
Python API: Renaming a test file.
JonathanESantos Dec 23, 2020
d023902
Python API: Adding more tests to test the Device, Capture, Image, and…
JonathanESantos Dec 24, 2020
359525d
Python API: Fixing transformation functions and their tests.
JonathanESantos Dec 28, 2020
ef8887b
Python API: Adding example code that makes use of the Python API.
JonathanESantos Dec 29, 2020
456c0b6
Python API: Adding docstrings *.py files and a Doxygen settings file …
JonathanESantos Dec 31, 2020
cd9a0da
Python API: Adding a main page to the documentation, and fixing a bug…
JonathanESantos Dec 31, 2020
f48bf0c
Python API: Adding lines in build_wheel.ps1 to generate the documenta…
JonathanESantos Dec 31, 2020
6bf9c0c
Making minor changes to get this k4a package to work in both Windows …
JonathanESantos Jan 8, 2021
0e53962
Forgot to commit the minor changes to get this k4a package to work in…
JonathanESantos Jan 8, 2021
1b6b6aa
Python API: Specifying specific library names that the python code wi…
JonathanESantos Jan 8, 2021
49a52fd
Python API: Modifying the build_wheel.csh script to look for libdepth…
JonathanESantos Jan 8, 2021
d560c73
Python API: Updating building.md for clarity.
JonathanESantos Jan 15, 2021
c567635
Python API: Fixing bug in tests that causes failure in some of the te…
JonathanESantos Jan 22, 2021
038b9f6
Removing forced-loading of depthengine library. Just load k4a.dll and…
JonathanESantos Mar 23, 2021
ccbc0bf
In the wheel build scripts, adding test to check if doxygen is instal…
JonathanESantos Mar 23, 2021
f1902be
Fixing markdown documents.
JonathanESantos Mar 23, 2021
7b69e00
Adding blurb about installing pip in Linux.
JonathanESantos Mar 23, 2021
55d6ba7
Changing ctypes.c_ulonglong to ctypes.c_size_t where it matches the f…
JonathanESantos Mar 23, 2021
a742479
Changing c_ulonglong to c_size_t in the tests to match the change in …
JonathanESantos Mar 23, 2021
bd1cad9
Fixing build script in Linux to look for depthengine.so* inside a sub…
JonathanESantos Mar 23, 2021
d65d0b7
Fixing documents that say the Linux depthengine.so.2.0 must be in a s…
JonathanESantos Mar 24, 2021
57802b3
The build script for Linux needs to check for depthengine.so* in the …
JonathanESantos Mar 24, 2021
f71cbea
Making slight changes to the building.md documentation for more clarity.
JonathanESantos Mar 24, 2021
cf713d6
Fixing a minor typo in the comments of image_transformations.py, and …
JonathanESantos Mar 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Python API: Adding docstrings *.py files and a Doxygen settings file …
…to generate the html documentation for the Python API.
  • Loading branch information
JonathanESantos committed Dec 31, 2020
commit 456c0b6dfdfb86782c567849b0ae966e2b6aa0dc
2,564 changes: 2,564 additions & 0 deletions src/python/k4a/Doxyfile

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/python/k4a/docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,18 @@ The following tools are optional:
./<env_name>/Scripts/deactivate.bat
Delete the directory <env_name>

### Building the HTML Documentation

A Doxygen settings file is provided in the project directory. Run doxygen using this
settings file to create the html documentation.

## Installing

The build process will create a k4a*.whl wheel file that can be installed via pip.
The wheel file can be distributed and installed as follows.

1. In a command line terminal, install the k4a python library via pip.
Replace <k4a*.whl> with the name of the wheel file.
pip install <k4a*.whl>
pip install <k4a*.whl>

Once installed, the user can "import k4a" in their python code.
4 changes: 3 additions & 1 deletion src/python/k4a/docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ The following are required in order to run the Python K4A tests.
./<env_name>/Scripts/activate

3. Install the k4a package in development mode. This is required in order to
automatically install required Python packages for running the tests.
automatically install required Python packages for running the tests, as
well as to install the code with the k4a package as the root of the
subpackages and modules.
pip install -e .[test] (include "[test]" with square brackets)

4. Run the tests in python. To capture the results, use an additional --junit-xml=./test_results.xml option.
Expand Down
21 changes: 17 additions & 4 deletions src/python/k4a/src/k4a/_bindings/calibration.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'''
calibration.py
'''!
@file calibration.py

Defines a Calibration class that is a container for a device calibration.

Copyright (C) Microsoft Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
'''

import ctypes as _ctypes
Expand All @@ -13,7 +15,18 @@
from .k4a import k4a_calibration_get_from_raw

class Calibration:

'''! Camera calibration contains intrinsic and extrinsic calibration
information for a camera.

Name | Type | Description
----------------- | --------------------- | ----------------------------------------------
extrinsics | CalibrationExtrinsics | Extrinsic calibration data.
intrinsics | CalibrationIntrinsics | Intrinsic calibration data.
resolution_width | int | Resolution width of the calibration sensor.
resolution_height | int | Resolution height of the calibration sensor.
metric_radius | float | Max FOV of the camera.
'''

def __init__(self, _calibration:_Calibration=None):
self._calibration = _calibration
if self._calibration is None:
Expand Down
65 changes: 60 additions & 5 deletions src/python/k4a/src/k4a/_bindings/capture.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'''
capture.py
'''!
@file capture.py

Defines a Capture class that is a container for a single capture of data
from an Azure Kinect device.

Copyright (C) Microsoft Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Kinect For Azure SDK.
'''

import ctypes as _ctypes
Expand All @@ -22,8 +24,53 @@
from .image import Image

class Capture:

def __init__(self, capture_handle:_CaptureHandle=None):
'''! A class that represents a capture from an Azure Kinect device.

Property Name | Type | R/W | Description
------------- | ----- | --- | -----------------------------------------
color | Image | R/W | The color image container.
depth | Image | R/W | The depth image container.
ir | Image | R/W | The IR image container.
temperature | float | R/W | The temperature

@remarks
- A capture represents a set of images that were captured by a
device at approximately the same time. A capture may have a color, IR,
and depth image. A capture may have up to one image of each type. A
capture may have no image for a given type as well.

@remarks
- Do not use the Capture() constructor to get a Capture instance. It
will return an object that does not have a handle to the capture
resources held by the SDK. Instead, use the create() function.

@remarks
- Captures also store a temperature value which represents the
temperature of the device at the time of the capture.

@remarks
- While all the images associated with the capture were collected at
approximately the same time, each image has an individual timestamp
which may differ from each other. If the device was configured to
capture depth and color images separated by a delay,
Device.get_capture() will return a capture containing both image types
separated by the configured delay.

@remarks
- Empty captures are created with create().

@remarks
- Captures can be obtained from a Device object using get_capture().

@remarks
- A Capture object may be copied or deep copied. A shallow copy
shares the same images as the original, and any changes in one will
affect the other. A deep copy does not share any resources with the
original, and changes in one will not affect the other. In both shallow
and deep copies, deleting one will have no effects on the other.
'''

def __init__(self, capture_handle:_CaptureHandle):
self._capture_handle = capture_handle
self._color = None
self._depth = None
Expand All @@ -32,6 +79,14 @@ def __init__(self, capture_handle:_CaptureHandle=None):

@staticmethod
def create():
'''! Create an empty capture object.

@returns Capture instance with empty contents.

@remarks
- If unsuccessful, None is returned.
'''

capture = None

# Create a capture.
Expand Down
Loading