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: Fixing transformation functions and their tests.
  • Loading branch information
JonathanESantos committed Dec 28, 2020
commit 359525d160ee2e2a25fc46c1176fad8b834849f6
5 changes: 3 additions & 2 deletions src/python/k4a/src/k4a/_bindings/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import ctypes as _ctypes

from .k4atypes import _Calibration, EStatus, EDepthMode, EColorResolution
from .k4atypes import _Calibration, EStatus, EDepthMode, EColorResolution, _Calibration

from .k4a import k4a_calibration_get_from_raw

Expand Down Expand Up @@ -46,13 +46,14 @@ def create_from_raw(
buffer_size_bytes = _ctypes.c_ulonglong(len(raw_calibration))
cbuffer = (_ctypes.c_uint8 * buffer_size_bytes.value).from_buffer(raw_calibration)
cbufferptr = _ctypes.cast(cbuffer, _ctypes.POINTER(_ctypes.c_char))
_calibration = _Calibration()

status = k4a_calibration_get_from_raw(
cbufferptr,
buffer_size_bytes,
depth_mode,
color_resolution,
_ctypes.byref(self._calibration))
_ctypes.byref(_calibration))

if status == EStatus.SUCCEEDED:
# Wrap the ctypes struct into a non-ctypes class.
Expand Down
2 changes: 1 addition & 1 deletion src/python/k4a/src/k4a/_bindings/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def __deepcopy__(self, memo):
self.stride_bytes)

# Copy the ndarray data to the new buffer.
_np.copyto(self._data, new_image._data)
_np.copyto(new_image._data, self._data)

# Copy the other image metadata.
new_image.device_timestamp_usec = self.device_timestamp_usec
Expand Down
53 changes: 38 additions & 15 deletions src/python/k4a/src/k4a/_bindings/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def point_3d_to_point_3d(self,
source_camera:ECalibrationType,
target_camera:ECalibrationType)->(float, float, float):

target_point = None
target_point = (None, None, None)

src_pt = _Float3(
x = source_point_3d[0],
y = source_point_3d[1],
z = source_point_3d[3])
z = source_point_3d[2])

tgt_pt = _Float3()

Expand All @@ -81,13 +81,13 @@ def point_2d_to_point_3d(self,
source_camera:ECalibrationType,
target_camera:ECalibrationType)->(float, float, float):

target_point = None
target_point = (None, None, None)

src_pt = _Float2(
x = source_point_2d[0],
y = source_point_2d[1])
tgt_pt = _Float3()
valid_int_flag = ctypes.c_int(0)
valid_int_flag = _ctypes.c_int(0)

status = k4a_calibration_2d_to_3d(
self._calibration._calibration,
Expand All @@ -108,14 +108,14 @@ def point_3d_to_point_2d(self,
source_camera:ECalibrationType,
target_camera:ECalibrationType)->(float, float):

target_point = None
target_point = (None, None)

src_pt = _Float3(
x = source_point_3d[0],
y = source_point_3d[1],
z = source_point_3d[2])
tgt_pt = _Float2()
valid_int_flag = ctypes.c_int(0)
valid_int_flag = _ctypes.c_int(0)

status = k4a_calibration_3d_to_2d(
self._calibration._calibration,
Expand All @@ -136,13 +136,13 @@ def point_2d_to_point_2d(self,
source_camera:ECalibrationType,
target_camera:ECalibrationType)->(float, float):

target_point = None
target_point = (None, None)

src_pt = _Float2(
x = source_point_2d[0],
y = source_point_2d[1])
tgt_pt = _Float2()
valid_int_flag = ctypes.c_int(0)
valid_int_flag = _ctypes.c_int(0)

status = k4a_calibration_2d_to_2d(
self._calibration._calibration,
Expand All @@ -162,13 +162,13 @@ def color_2d_to_depth_2d(self,
source_point_2d:(float, float),
depth:Image)->(float, float):

target_point = None
target_point = (None, None)

src_pt = _Float2(
x = source_point_2d[0],
y = source_point_2d[1])
tgt_pt = _Float2()
valid_int_flag = ctypes.c_int(0)
valid_int_flag = _ctypes.c_int(0)

status = k4a_calibration_color_2d_to_depth_2d(
self._calibration._calibration,
Expand All @@ -183,9 +183,15 @@ def color_2d_to_depth_2d(self,
return target_point

def depth_image_to_color_camera(self,
depth:Image)->Image:
depth:Image,
color:Image)->Image:

transformed_depth_image = _copy.deepcopy(depth)
# Create an output image.
transformed_depth_image = Image.create(
depth.image_format,
color.width_pixels,
color.height_pixels,
color.width_pixels * 2)

status = k4a_transformation_depth_image_to_color_camera(
self.__transform_handle,
Expand All @@ -200,11 +206,23 @@ def depth_image_to_color_camera(self,
def depth_image_to_color_camera_custom(self,
depth:Image,
custom:Image,
color:Image,
interp_type:ETransformInterpolationType,
invalid_value:int)->(Image, Image):

transformed_depth_image = _copy.deepcopy(depth)
transformed_custom_image = _copy.deepcopy(custom)
# Create an output image.
transformed_depth_image = Image.create(
depth.image_format,
color.width_pixels,
color.height_pixels,
color.width_pixels * 2)

# Create an output image.
transformed_custom_image = Image.create(
custom.image_format,
color.width_pixels,
color.height_pixels,
color.width_pixels * 2)

status = k4a_transformation_depth_image_to_color_camera_custom(
self.__transform_handle,
Expand All @@ -225,7 +243,12 @@ def color_image_to_depth_camera(self,
depth:Image,
color:Image)->Image:

transformed_color_image = _copy.deepcopy(color)
# Create an output image.
transformed_color_image = Image.create(
color.image_format,
depth.width_pixels,
depth.height_pixels,
depth.width_pixels * 4)

status = k4a_transformation_color_image_to_depth_camera(
self.__transform_handle,
Expand Down
Loading