-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
206 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import json | ||
from freenect2 import Device, FrameType | ||
import numpy as np | ||
|
||
def main(): | ||
device = Device() | ||
frames = {} | ||
with device.running(): | ||
for type_, frame in device: | ||
frames[type_] = frame | ||
if FrameType.Color in frames and FrameType.Depth in frames: | ||
break | ||
|
||
rgb, depth = frames[FrameType.Color], frames[FrameType.Depth] | ||
undistorted, registered, big_depth = device.registration.apply( | ||
rgb, depth, with_big_depth=True) | ||
|
||
rgb.to_image().save('output_rgb.png') | ||
big_depth.to_image().save('output_depth.tiff') | ||
|
||
with open('output_calib.json', 'w') as fobj: | ||
json.dump({ | ||
'color': dict( | ||
(k, getattr(device.color_camera_params, k)) | ||
for k in 'fx fy cx cy'.split()), | ||
'ir': dict( | ||
(k, getattr(device.ir_camera_params, k)) | ||
for k in 'fx fy cx cy k1 k2 k3 p1 p2'.split()), | ||
}, fobj) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters