合并部分小车上的修改
parent
69cea1b043
commit
a29e37c15d
|
@ -0,0 +1,63 @@
|
|||
SUBSYSTEM=="usb", ATTR{idProduct}=="0401", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astra"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0402", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astra_s"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0403", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astra_pro"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0404", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astra_mini"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0407", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astra_mini_s"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0501", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0502", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0504", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0505", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0508", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0509", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="050a", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="050b", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="050c", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="050d", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="050e", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="050f", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0510", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0511", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0512", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0513", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0514", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0515", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0516", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0517", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0518", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0519", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="051a", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="051b", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="051c", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="051d", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="051e", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="051f", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0520", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0604", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0605", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="super"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0606", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="luna"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0607", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="ado"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0608", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astra d-u"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0609", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="p2"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="060a", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="alien"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="060b", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="deeyea"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="060c", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astrauvc"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="060d", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astra pro plus"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="060e", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="060f", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0610", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0611", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0612", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0613", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0614", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0615", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0616", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0617", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0618", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0619", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="061a", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="061b", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="061c", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="061d", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="061e", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="061f", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
||||
SUBSYSTEM=="usb", ATTR{idProduct}=="0620", ATTR{idVendor}=="2bc5", MODE:="0666", OWNER:="root", GROUP:="video", SYMLINK+="astradepth"
|
|
@ -0,0 +1,19 @@
|
|||
# set the udev rule , make the device_port be fixed by rplidar
|
||||
# pibot
|
||||
KERNEL=="ttyACM*", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0042", MODE:="0777", SYMLINK+="pibot"
|
||||
KERNEL=="ttyACM*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE:="0777", SYMLINK+="pibot"
|
||||
KERNEL=="ttyACM*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="55d4", MODE:="0777", SYMLINK+="pibot"
|
||||
|
||||
KERNEL=="ttyUSB*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE:="0777", SYMLINK+="pibot"
|
||||
KERNEL=="ttyUSB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0777", SYMLINK+="pibot"
|
||||
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{product}=="PIBOT USB to UART Bridge Controller", MODE:="0777", SYMLINK+="pibot"
|
||||
|
||||
# rplidar
|
||||
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{product}=="CP2102 USB to UART Bridge Controller", MODE:="0777", SYMLINK+="rplidar"
|
||||
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{product}=="CP2102N USB to UART Bridge Controller", MODE:="0777", SYMLINK+="rplidar"
|
||||
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{product}=="CP2102 USB to UART Bridge", MODE:="0777", SYMLINK+="rplidar"
|
||||
|
||||
# ydlidar
|
||||
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{product}=="CP2102 USB to UART Bridge Controller", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"
|
||||
KERNEL=="ttyACM*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"
|
||||
KERNEL=="ttyUSB*", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE:="0666", GROUP:="dialout", SYMLINK+="ydlidar"
|
|
@ -0,0 +1,76 @@
|
|||
##Version=1.1##
|
||||
# Device rules for Intel RealSense devices (R200, F200, SR300 LR200, ZR300, D400, L500, T200)
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0a80", MODE:="0666", GROUP:="plugdev", RUN+="/usr/local/bin/usb-R200-in_udev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0a66", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0aa5", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0abf", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0acb", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad0", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="04b4", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad1", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad2", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad3", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad4", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad5", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad6", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0af2", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0af6", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0afe", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0aff", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b00", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b01", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b03", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b07", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b0c", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b0d", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3a", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3d", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b48", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b49", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4b", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4d", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b52", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5b", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5c", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b64", MODE:="0666", GROUP:="plugdev"
|
||||
|
||||
# Intel RealSense recovery devices (DFU)
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ab3", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0adb", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0adc", MODE:="0666", GROUP:="plugdev"
|
||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b55", MODE:="0666", GROUP:="plugdev"
|
||||
|
||||
# Intel RealSense devices (Movidius, T265)
|
||||
SUBSYSTEMS=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0af3", MODE="0666", GROUP="plugdev"
|
||||
SUBSYSTEMS=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="0b37", MODE="0666", GROUP="plugdev"
|
||||
SUBSYSTEMS=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="03e7", ATTRS{idProduct}=="2150", MODE="0666", GROUP="plugdev"
|
||||
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad5", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor_custom", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad5", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0af2", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0af2", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0afe", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor_custom", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0afe", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0aff", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor_custom", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0aff", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b00", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor_custom", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b00", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b01", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor_custom", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b01", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3a", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3a", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3d", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b3d", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4b", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4b", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4d", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b4d", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5b", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5b", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5c", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b5c", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b64", MODE:="0777", GROUP:="plugdev", RUN+="/bin/sh -c 'chmod -R 0777 /sys/%p'"
|
||||
DRIVER=="hid_sensor*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0b64", RUN+="/bin/sh -c ' chmod -R 0777 /sys/%p && chmod 0777 /dev/%k'"
|
||||
|
||||
# For products with motion_module, if (kernels is 4.15 and up) and (device name is "accel_3d") wait, in another process, until (enable flag is set to 1 or 200 mSec passed) and then set it to 0.
|
||||
KERNEL=="iio*", ATTRS{idVendor}=="8086", ATTRS{idProduct}=="0ad5|0afe|0aff|0b00|0b01|0b3a|0b3d|0b64", RUN+="/bin/sh -c '(major=`uname -r | cut -d \".\" -f1` && minor=`uname -r | cut -d \".\" -f2` && (([ $major -eq 4 ] && [ $minor -ge 15 ]) || [ $major -ge 5 ])) && (enamefile=/sys/%p/name && [ `cat $enamefile` = \"accel_3d\" ]) && enfile=/sys/%p/buffer/enable && echo \"COUNTER=0; while [ \$COUNTER -lt 20 ] && grep -q 0 $enfile; do sleep 0.01; COUNTER=\$((COUNTER+1)); done && echo 0 > $enfile\" | at now'"
|
|
@ -0,0 +1,18 @@
|
|||
sudo apt-get install build-essential cmake pkg-config libusb-1.0-0-dev libturbojpeg libjpeg-turbo8-dev libglfw3-dev libopenni2-dev
|
||||
|
||||
if [ ! -d ~/pibot_ros/third_party/libfreenect2/build ]; then
|
||||
mkdir ~/pibot_ros/third_party/libfreenect2/build
|
||||
fi
|
||||
cd ~/pibot_ros/third_party/libfreenect2/build
|
||||
cmake .. -DENABLE_CXX11=ON
|
||||
make
|
||||
sudo make install
|
||||
sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/
|
||||
|
||||
if [ ! -d ~/pibot_ros/third_party/libuvc/build ]; then
|
||||
mkdir ~/pibot_ros/third_party/libuvc/build
|
||||
fi
|
||||
cd ~/pibot_ros/third_party/libuvc/build
|
||||
cmake ..
|
||||
make
|
||||
sudo make install
|
|
@ -0,0 +1,2 @@
|
|||
build
|
||||
create_ap.service
|
|
@ -0,0 +1,23 @@
|
|||
Copyright (c) 2013, oblique
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,24 @@
|
|||
PREFIX=/usr
|
||||
MANDIR=$(PREFIX)/share/man
|
||||
BINDIR=$(PREFIX)/bin
|
||||
|
||||
all:
|
||||
@echo "Run 'make install' for installation."
|
||||
@echo "Run 'make uninstall' for uninstallation."
|
||||
|
||||
install:
|
||||
install -Dm755 create_ap $(DESTDIR)$(BINDIR)/create_ap
|
||||
install -Dm755 lnxrouter $(DESTDIR)$(BINDIR)/lnxrouter
|
||||
install -Dm644 create_ap.conf $(DESTDIR)/etc/create_ap.conf
|
||||
[ ! -d /lib/systemd/system ] || install -Dm644 create_ap.service $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
|
||||
[ ! -e /sbin/openrc-run ] || install -Dm755 create_ap.openrc $(DESTDIR)/etc/init.d/create_ap
|
||||
install -Dm644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
|
||||
install -Dm644 README.md $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(BINDIR)/create_ap
|
||||
rm -f $(DESTDIR)/etc/create_ap.conf
|
||||
[ ! -f /lib/systemd/system/create_ap.service ] || rm -f $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
|
||||
[ ! -e /sbin/openrc-run ] || rm -f $(DESTDIR)/etc/init.d/create_ap
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
|
||||
rm -f $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
|
|
@ -0,0 +1,98 @@
|
|||
## NOT MAINTAINED
|
||||
|
||||
This project is no longer maintained.
|
||||
|
||||
If you are still interested in this project, checkout the following fork that
|
||||
also provides GUI: [lakinduakash/linux-wifi-hotspot]
|
||||
|
||||
|
||||
## Features
|
||||
* Create an AP (Access Point) at any channel.
|
||||
* Choose one of the following encryptions: WPA, WPA2, WPA/WPA2, Open (no encryption).
|
||||
* Hide your SSID.
|
||||
* Disable communication between clients (client isolation).
|
||||
* IEEE 802.11n & 802.11ac support
|
||||
* Internet sharing methods: NATed or Bridged or None (no Internet sharing).
|
||||
* Choose the AP Gateway IP (only for 'NATed' and 'None' Internet sharing methods).
|
||||
* You can create an AP with the same interface you are getting your Internet connection.
|
||||
* You can pass your SSID and password through pipe or through arguments (see examples).
|
||||
|
||||
|
||||
## Dependencies
|
||||
### General
|
||||
* bash (to run this script)
|
||||
* util-linux (for getopt)
|
||||
* procps or procps-ng
|
||||
* hostapd
|
||||
* iproute2
|
||||
* iw
|
||||
* iwconfig (you only need this if 'iw' can not recognize your adapter)
|
||||
* haveged (optional)
|
||||
|
||||
### For 'NATed' or 'None' Internet sharing method
|
||||
* dnsmasq
|
||||
* iptables
|
||||
|
||||
|
||||
## Installation
|
||||
### Generic
|
||||
git clone https://github.com/oblique/create_ap
|
||||
cd create_ap
|
||||
make install
|
||||
|
||||
### ArchLinux
|
||||
pacman -S create_ap
|
||||
|
||||
### Gentoo
|
||||
emerge layman
|
||||
layman -f -a jorgicio
|
||||
emerge net-wireless/create_ap
|
||||
|
||||
## Examples
|
||||
### No passphrase (open network):
|
||||
create_ap wlan0 eth0 MyAccessPoint
|
||||
|
||||
### WPA + WPA2 passphrase:
|
||||
create_ap wlan0 eth0 MyAccessPoint MyPassPhrase
|
||||
|
||||
### AP without Internet sharing:
|
||||
create_ap -n wlan0 MyAccessPoint MyPassPhrase
|
||||
|
||||
### Bridged Internet sharing:
|
||||
create_ap -m bridge wlan0 eth0 MyAccessPoint MyPassPhrase
|
||||
|
||||
### Bridged Internet sharing (pre-configured bridge interface):
|
||||
create_ap -m bridge wlan0 br0 MyAccessPoint MyPassPhrase
|
||||
|
||||
### Internet sharing from the same WiFi interface:
|
||||
create_ap wlan0 wlan0 MyAccessPoint MyPassPhrase
|
||||
|
||||
### Choose a different WiFi adapter driver
|
||||
create_ap --driver rtl871xdrv wlan0 eth0 MyAccessPoint MyPassPhrase
|
||||
|
||||
### No passphrase (open network) using pipe:
|
||||
echo -e "MyAccessPoint" | create_ap wlan0 eth0
|
||||
|
||||
### WPA + WPA2 passphrase using pipe:
|
||||
echo -e "MyAccessPoint\nMyPassPhrase" | create_ap wlan0 eth0
|
||||
|
||||
### Enable IEEE 802.11n
|
||||
create_ap --ieee80211n --ht_capab '[HT40+]' wlan0 eth0 MyAccessPoint MyPassPhrase
|
||||
|
||||
### Client Isolation:
|
||||
create_ap --isolate-clients wlan0 eth0 MyAccessPoint MyPassPhrase
|
||||
|
||||
## Systemd service
|
||||
Using the persistent [systemd](https://wiki.archlinux.org/index.php/systemd#Basic_systemctl_usage) service
|
||||
### Start service immediately:
|
||||
systemctl start create_ap
|
||||
|
||||
### Start on boot:
|
||||
systemctl enable create_ap
|
||||
|
||||
|
||||
## License
|
||||
FreeBSD
|
||||
|
||||
|
||||
[lakinduakash/linux-wifi-hotspot]: https://github.com/lakinduakash/linux-wifi-hotspot
|
|
@ -0,0 +1,168 @@
|
|||
#
|
||||
# Bash Completion routine for create_ap
|
||||
#
|
||||
|
||||
_use_filedir() {
|
||||
if [[ $(type -t _filedir) == "function" ]]; then
|
||||
_filedir
|
||||
return 0
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
_create_ap() {
|
||||
local awk_cmd='
|
||||
($1 ~ /^-/) {
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if ($i ~ /,$/) {
|
||||
print substr ($i, 0, length ($i)-1)
|
||||
}
|
||||
else {
|
||||
print $i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
'
|
||||
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="$2"
|
||||
prev="$3"
|
||||
opts=$("$1" --help | awk "$awk_cmd")
|
||||
|
||||
case "$prev" in
|
||||
-h|--help)
|
||||
# No Options
|
||||
;;
|
||||
--version)
|
||||
# No Options
|
||||
;;
|
||||
-c)
|
||||
# Refer http://en.wikipedia.org/wiki/List_of_WLAN_channels
|
||||
opts=$(
|
||||
iw list | grep ' MHz \[[[:digit:]]\+\] ' |
|
||||
grep -v 'no IR\|disabled' |
|
||||
sed 's/.*\[\(.*\)\].*/\1/' | sort -n | uniq
|
||||
)
|
||||
;;
|
||||
-w)
|
||||
opts="1 2 1+2"
|
||||
;;
|
||||
-n)
|
||||
# No Options
|
||||
;;
|
||||
-m)
|
||||
opts="nat bridge none"
|
||||
;;
|
||||
--psk)
|
||||
# No Options
|
||||
;;
|
||||
--hidden)
|
||||
# No Options
|
||||
;;
|
||||
--mac-filter)
|
||||
# No Options
|
||||
;;
|
||||
--mac-filter-accept)
|
||||
# No Options
|
||||
;;
|
||||
--ieee80211n)
|
||||
# No Options
|
||||
;;
|
||||
--ht_capab)
|
||||
# Refer http://w1.fi/cgit/hostap/plain/hostapd/hostapd.conf
|
||||
opts='
|
||||
[LDPC] [HT40-] [HT40+] [SMPS-STATIC] [SMPS-DYNAMIC]
|
||||
[GF] [SHORT-GI-20] [SHORT-GI-40] [TX-STBC]
|
||||
[RX-STBC1] [RX-STBC12] [RX-STBC123] [DELAYED-BA]
|
||||
[MAX-AMSDU-7935] [DSSS_CCK-40] [40-INTOLERANT]
|
||||
[LSIG-TXOP-PROT]
|
||||
'
|
||||
;;
|
||||
--country)
|
||||
local reg_file=/usr/lib/crda/regulatory.bin
|
||||
if command -v regdbdump > /dev/null && [[ -f "$reg_file" ]]; then
|
||||
local country_awk_cmd='
|
||||
($1 ~ /^country/) {
|
||||
print substr ($2, 0, length ($2)-1)
|
||||
}
|
||||
'
|
||||
opts=$(regdbdump "$reg_file" 2>/dev/null | awk "$country_awk_cmd")
|
||||
else
|
||||
opts='
|
||||
AD AE AF AI AL AM AN AR AS AT AU AW AZ BA BB BD BE
|
||||
BF BG BH BL BM BN BO BR BS BT BY BZ CA CF CH CI CL
|
||||
CN CO CR CX CY CZ DE DK DM DO DZ EC EE EG ES ET FI
|
||||
FM FR GB GD GE GF GH GL GP GR GT GU GY HK HN HR HT
|
||||
HU ID IE IL IN IR IS IT JM JO JP KE KH KN KP KR KW
|
||||
KY KZ LB LC LI LK LS LT LU LV MA MC MD ME MF MH MK
|
||||
MN MO MP MQ MR MT MU MW MX MY NG NI NL NO NP NZ OM
|
||||
PA PE PF PG PH PK PL PM PR PT PW PY QA RE RO RS RU
|
||||
RW SA SE SG SI SK SN SR SV SY TC TD TG TH TN TR TT
|
||||
TW TZ UA UG US UY UZ VC VE VI VN VU WF WS YE YT ZA
|
||||
ZW 00
|
||||
'
|
||||
fi
|
||||
;;
|
||||
--freq-band)
|
||||
opts="2.4 5"
|
||||
;;
|
||||
--driver)
|
||||
# Refer http://w1.fi/cgit/hostap/tree/src/drivers
|
||||
# Not going to implement
|
||||
;;
|
||||
--no-virt)
|
||||
# No Options
|
||||
;;
|
||||
--no-haveged)
|
||||
# No Options
|
||||
;;
|
||||
--fix-unmanaged)
|
||||
# No Options
|
||||
;;
|
||||
--mac)
|
||||
# Not going to implement
|
||||
;;
|
||||
--daemon)
|
||||
# No Options
|
||||
;;
|
||||
--stop)
|
||||
local stop_awk_cmd='$1 ~ /^[0-9]+$/'
|
||||
opts=$("$1" --list-running | awk "$stop_awk_cmd")
|
||||
;;
|
||||
--list-running)
|
||||
# No Options
|
||||
;;
|
||||
--list-clients)
|
||||
local clients_awk_cmd='$1 ~ /^[0-9]+$/'
|
||||
opts=$("$1" --list-running | awk "$clients_awk_cmd")
|
||||
;;
|
||||
--no-dns)
|
||||
# No Options
|
||||
;;
|
||||
--dhcp-dns)
|
||||
# Not going to implement
|
||||
;;
|
||||
--mkconfig)
|
||||
_use_filedir && return 0
|
||||
;;
|
||||
--config)
|
||||
_use_filedir && return 0
|
||||
;;
|
||||
-g)
|
||||
# Not going to implement
|
||||
;;
|
||||
-d)
|
||||
# No Options
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
COMPREPLY=( $(compgen -W "$opts" -- $cur) )
|
||||
return 0
|
||||
}
|
||||
complete -F _create_ap create_ap
|
||||
|
||||
# vim: set ft=sh:
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
sudo apt-get install -y hostapd
|
||||
|
||||
SERIAL_ID=`cat /proc/cpuinfo | grep Serial | awk -F ':' '{print \$2}'`
|
||||
SHORT_SERIAL_ID=${SERIAL_ID: -8}
|
||||
|
||||
if [ "$SHORT_SERIAL_ID"_X!=""_X ]; then
|
||||
SHORT_SERIAL_ID=`udevadm info --name=mmcblk0 --query=property | grep ID_SERIAL | awk -F '=' '{print $2}'`
|
||||
fi
|
||||
|
||||
if [ "$SHORT_SERIAL_ID"_X!=""_X ]; then
|
||||
SERIAL_ID=`udevadm info --name=sda --query=property | grep ID_SERIAL_SHORT | awk -F '=' '{print \$2}'`
|
||||
SHORT_SERIAL_ID=${SERIAL_ID: -8}
|
||||
fi
|
||||
|
||||
cp create_ap.service.template create_ap.service
|
||||
sed -i "s|SSID|pibot_ap_$SHORT_SERIAL_ID|g" create_ap.service
|
||||
|
||||
sudo make install
|
||||
|
||||
sudo systemctl daemon-reload
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,28 @@
|
|||
CHANNEL=default
|
||||
GATEWAY=10.0.0.1
|
||||
WPA_VERSION=2
|
||||
ETC_HOSTS=0
|
||||
DHCP_DNS=gateway
|
||||
NO_DNS=0
|
||||
NO_DNSMASQ=0
|
||||
HIDDEN=0
|
||||
MAC_FILTER=0
|
||||
MAC_FILTER_ACCEPT=/etc/hostapd/hostapd.accept
|
||||
ISOLATE_CLIENTS=0
|
||||
SHARE_METHOD=nat
|
||||
IEEE80211N=0
|
||||
IEEE80211AC=0
|
||||
HT_CAPAB=[HT40+]
|
||||
VHT_CAPAB=
|
||||
DRIVER=nl80211
|
||||
NO_VIRT=0
|
||||
COUNTRY=
|
||||
FREQ_BAND=2.4
|
||||
NEW_MACADDR=
|
||||
DAEMONIZE=0
|
||||
NO_HAVEGED=0
|
||||
WIFI_IFACE=wlan0
|
||||
INTERNET_IFACE=eth0
|
||||
SSID=MyAccessPoint
|
||||
PASSPHRASE=12345678
|
||||
USE_PSK=0
|
|
@ -0,0 +1,11 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
name=$RC_SVCNAME
|
||||
|
||||
cfgfile=/etc/$RC_SVCNAME.conf
|
||||
pidfile=/run/$RC_SVCNAME.pid
|
||||
|
||||
command=/usr/bin/create_ap
|
||||
command_args="--config $cfgfile"
|
||||
command_args_background="--daemon --pidfile $pidfile"
|
||||
stopsig=USR1
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=Create AP Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/lnxrouter -n --ap wlan0 SSID -p pibot_ap --no-virt -g 12
|
||||
KillSignal=SIGINT
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,74 @@
|
|||
## Try this first
|
||||
|
||||
If you are facing any problems with Realtek adapters (e.g. Edimax EW-7811Un)
|
||||
first try to run create_ap with `-w 2` (i.e. use WPA2 only) or use it
|
||||
without passphrase. If you are still facing any problems or you want to
|
||||
also use WPA1, then follow the instructions below.
|
||||
|
||||
NOTE: The instructions below are only valid for Realtek adapters with 8192 chipset.
|
||||
|
||||
## Before installation
|
||||
|
||||
If you're using ArchLinux, run:
|
||||
|
||||
```
|
||||
pacman -S base-devel linux-headers dkms git
|
||||
pacman -R hostapd
|
||||
```
|
||||
|
||||
If you're using Debian, Ubuntu, or any Debian-based distribution, run:
|
||||
|
||||
```
|
||||
apt-get install build-essential linux-headers-generic dkms git
|
||||
apt-get remove hostapd
|
||||
apt-get build-dep hostapd
|
||||
```
|
||||
|
||||
## Install driver
|
||||
|
||||
The driver in the mainline of Linux kernel doesn't work well with the 8192 adapters.
|
||||
For this reason you need to install the driver that is provided from Realtek. Their
|
||||
driver can not be compiled with newer kernels, but since it was an open-source
|
||||
release under GPL license some people were able to fixed it and make it compile.
|
||||
|
||||
With the following commands you can install a fixed version of Realtek's driver:
|
||||
|
||||
```
|
||||
git clone https://github.com/pvaret/rtl8192cu-fixes.git
|
||||
dkms add rtl8192cu-fixes
|
||||
dkms install 8192cu/1.9
|
||||
cp rtl8192cu-fixes/blacklist-native-rtl8192.conf /etc/modprobe.d
|
||||
cp rtl8192cu-fixes/8192cu-disable-power-management.conf /etc/modprobe.d
|
||||
```
|
||||
|
||||
After installation, unload the previous driver and load the new one, or just reboot.
|
||||
|
||||
## Install hostapd
|
||||
|
||||
Realtek's driver is using an old subsystem which is called `wireless-extensions`
|
||||
(or `wext`). Hostapd works only with the new subsystem (which is called `nl80211`).
|
||||
For this reason Realtek wrote a patch for hostapd. You can install it with the
|
||||
following commands:
|
||||
|
||||
If you have ArchLinux install [hostapd-rtl871xdrv](https://aur.archlinux.org/packages/hostapd-rtl871xdrv)
|
||||
from AUR or just run:
|
||||
|
||||
```
|
||||
yaourt -S hostapd-rtl871xdrv
|
||||
```
|
||||
|
||||
If you're using any other distribution, run:
|
||||
|
||||
```
|
||||
git clone https://github.com/pritambaral/hostapd-rtl871xdrv.git
|
||||
wget http://w1.fi/releases/hostapd-2.2.tar.gz
|
||||
tar zxvf hostapd-2.2.tar.gz
|
||||
cd hostapd-2.2
|
||||
patch -p1 -i ../hostapd-rtl871xdrv/rtlxdrv.patch
|
||||
cp ../hostapd-rtl871xdrv/driver_* src/drivers
|
||||
cd hostapd
|
||||
cp defconfig .config
|
||||
echo CONFIG_DRIVER_RTW=y >> .config
|
||||
make
|
||||
make install
|
||||
```
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,242 @@
|
|||
# IAI Kinect2
|
||||
|
||||
## Maintainer
|
||||
|
||||
- [Thiemo Wiedemeyer](https://ai.uni-bremen.de/team/thiemo_wiedemeyer) <<wiedemeyer@cs.uni-bremen.de>>, [Institute for Artificial Intelligence](http://ai.uni-bremen.de/), University of Bremen
|
||||
|
||||
## Read this first
|
||||
|
||||
Please read this README and the ones of the individual components throughly before asking questions. We get a lot of repeated questions, so when you have a problem, we urge everyone to check the [github issues (including closed ones)](https://github.com/code-iai/iai_kinect2/issues?utf8=%E2%9C%93&q=is%3Aissue). Your issue is very likely discussed there already.
|
||||
|
||||
The goal of this project is to give you a driver and the tools needed to receive data from the Kinect-2 sensor, in a way useful for robotics. You will still need to know how to use ROS to make use of it. Please follow the [ROS tutorials](http://wiki.ros.org/ROS/Tutorials). You will also need to learn how to work with point-clouds, or depth-clouds, or images (computer vision) to do useful things with the data.
|
||||
|
||||
*Note:* ***Please use the GitHub issues*** *for questions and problems regarding the iai_kinect2 package and its components.* ***Do not write emails.***
|
||||
|
||||
## Table of contents
|
||||
- [Description](#description)
|
||||
- [FAQ](#faq)
|
||||
- [Dependencies](#dependencies)
|
||||
- [Install](#install)
|
||||
- [GPU acceleration](#gpu-acceleration)
|
||||
- [OpenCL with AMD](#opencl-with-amd)
|
||||
- [OpenCL/CUDA with Nvidia](#openclcuda-with-nvidia)
|
||||
- [OpenCL with Intel](#opencl-with-intel)
|
||||
- [Citation](#citation)
|
||||
- [Screenshots](#screenshots)
|
||||
|
||||
## Description
|
||||
|
||||
This is a collection of tools and libraries for a ROS Interface to the Kinect One (Kinect v2).
|
||||
|
||||
It contains:
|
||||
- [a calibration tool](kinect2_calibration) for calibrating the IR sensor of the Kinect One to the RGB sensor and the depth measurements
|
||||
- [a library](kinect2_registration) for depth registration with OpenCL support
|
||||
- [the bridge](kinect2_bridge) between [libfreenect2](https://github.com/OpenKinect/libfreenect2) and [ROS](http://www.ros.org/)
|
||||
- [a viewer](kinect2_viewer) for the images / point clouds
|
||||
|
||||
## FAQ
|
||||
|
||||
#### If I have any question or someting is not working, what should I do first?
|
||||
|
||||
First you should look at this FAQ and the [FAQ from libfreenect2](https://github.com/OpenKinect/libfreenect2#faq).
|
||||
Secondly, look at [issue page from libfreenect2](https://github.com/OpenKinect/libfreenect2/issues) and
|
||||
the [issue page of iai_kinect2](https://github.com/code-iai/iai_kinect2/issues) for similar issues and solutions.
|
||||
|
||||
#### Point clouds are not being published?
|
||||
|
||||
Point clouds are only published when the launch file is used. Make sure to start kinect2_bridge with `roslaunch kinect2_bridge kinect2_bridge.launch`.
|
||||
|
||||
#### Will it work with OpenCV 3.0
|
||||
|
||||
Short answer: No.
|
||||
|
||||
Long answer: Yes, it is possible to compile this package with OpenCV 3.0, but it will not work.
|
||||
This is because cv_bridge is used, which itself is compiled with OpenCV 2.4.x in ROS Indigo/Jade and
|
||||
linking against both OpenCV versions is not possible. Working support for OpenCV 3.0 might come with a future ROS release.
|
||||
|
||||
#### kinect2_bridge is not working / crashing, what is wrong?
|
||||
|
||||
There are many reasons why `kinect2_bridge` might not working. The first thing to find out whether the problem is related to `kinect2_bridge` or `libfreenect2`.
|
||||
A good tool for testing is `Protonect`, it is a binary located in `libfreenect2/build/bin/Protonect`.
|
||||
It uses libfreenect2 directly with a minimal dependency on other libraries, so it is a good tool for the first tests.
|
||||
|
||||
Execute:
|
||||
- `./Protonect gl` to test OpenGL support.
|
||||
- `./Protonect cl` to test OpenCL support.
|
||||
- `./Protonect cpu` to test CPU support.
|
||||
|
||||
Before running `kinect2_bridge` please make sure `Protonect` is working and showing color, depth and ir images.
|
||||
If some of them are black, than there is a problem not related to `kinect2_bridge` and you should look at the issues from the libfreenect2 GitHub page for help.
|
||||
|
||||
If one of them works, try out the one that worked with `kinect2_bridge`: `rosrun kinect2_bridge kinect2_bridge _depth_method:=<opengl|opencl|cpu>`.
|
||||
You can also change the registration method with `_reg_method:=<cpu|opencl>`.
|
||||
|
||||
#### Protonect works fine, but kinect2_bridge is still not working / crashing.
|
||||
|
||||
If that is the case, you have to make sure that `Protonect` uses the same version of `libfreenect2` as `kinect2_bridge` does.
|
||||
To do so, run `make` and `sudo make install` in the build folder again. And try out `kinect2_bridge` again.
|
||||
|
||||
```bash
|
||||
cd libfreenect2/build
|
||||
make & sudo make install
|
||||
```
|
||||
|
||||
Also make sure that you are not using OpenCV 3.0.
|
||||
|
||||
If it is still crashing, compile it in debug and run it with gdb:
|
||||
|
||||
```bash
|
||||
cd <catkin_ws>
|
||||
catkin_make -DCMAKE_BUILD_TYPE="Debug"
|
||||
cd devel/lib/kinect2_bridge
|
||||
gdb kinect2_bridge
|
||||
# inside gdb: run until it crashes and do a backtrace
|
||||
run
|
||||
bt
|
||||
quit
|
||||
```
|
||||
|
||||
Open an issue and post the problem description and the output from the backtrace (`bt`).
|
||||
|
||||
#### kinect2_bridge hangs and prints "waiting for clients to connect"
|
||||
|
||||
This is the normal behavior. 'kinect2_bridge' will only process data when clients are connected (ROS nodes listening to at least one of the topics).
|
||||
This saves CPU and GPU resources. As soon as you start the `kinect_viewer` or `rostopic hz` on one of the topics, processing should start.
|
||||
|
||||
#### rosdep: Cannot locate rosdep definition for [kinect2_bridge] or [kinect2_registration]
|
||||
|
||||
`rosdep` will output errors on not being able to locate `[kinect2_bridge]` and `[kinect2_registration]`.
|
||||
That is fine because they are all part of the iai_kinect2 package and `rosdep` does not know these packages.
|
||||
|
||||
#### Protonect or kinect2_bridge outputs [TransferPool::submit] failed to submit transfer
|
||||
|
||||
This indicates problems with the USB connection.
|
||||
|
||||
#### I still have an issue, what should I do?
|
||||
|
||||
First of all, check the issue pages on GitHub for similar issues, as they might contain solutions for them.
|
||||
By default you will only see the open issues, but if you click on `closed` you will the the ones solved. There is also a search field which helps to find similar issues.
|
||||
|
||||
If you found no solution in the issues, feel free to open a new issue for your problem. Please describe your problem in detail and provide error messages and log output.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- ROS Hydro/Indigo
|
||||
- OpenCV (2.4.x, using the one from the official Ubuntu repositories is recommended)
|
||||
- PCL (1.7.x, using the one from the official Ubuntu repositories is recommended)
|
||||
- Eigen (optional, but recommended)
|
||||
- OpenCL (optional, but recommended)
|
||||
- [libfreenect2](https://github.com/OpenKinect/libfreenect2) (>= v0.2.0, for stability checkout the latest stable release)
|
||||
|
||||
## Install
|
||||
|
||||
1. Install the ROS. [Instructions for Ubuntu 14.04](http://wiki.ros.org/indigo/Installation/Ubuntu)
|
||||
2. [Setup your ROS environment](http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment)
|
||||
3. Install [libfreenect2](https://github.com/OpenKinect/libfreenect2):
|
||||
|
||||
Follow [the instructions](https://github.com/OpenKinect/libfreenect2#debianubuntu-1404) and enable C++11 by using `cmake .. -DENABLE_CXX11=ON` instead of `cmake ..`. If you are compiling libfreenect2 with CUDA, use `cmake .. -DENABLE_CXX11=ON -DCUDA_PROPAGATE_HOST_FLAGS=off`.
|
||||
|
||||
If something is not working, check out the latest stable release, for example `git checkout v0.2.0`.
|
||||
|
||||
4. Clone this repository into your catkin workspace, install the dependencies and build it:
|
||||
|
||||
```bash
|
||||
cd ~/catkin_ws/src/
|
||||
git clone https://github.com/code-iai/iai_kinect2.git
|
||||
cd iai_kinect2
|
||||
rosdep install -r --from-paths .
|
||||
cd ~/catkin_ws
|
||||
catkin_make -DCMAKE_BUILD_TYPE="Release"
|
||||
```
|
||||
|
||||
*Note: `rosdep` will output errors on not being able to locate `[kinect2_bridge]` and `[depth_registration]`.
|
||||
That is fine because they are all part of the iai_kinect2 package and `rosdep` does not know these packages.*
|
||||
|
||||
*Note: If you installed libfreenect2 somewhere else than in `$HOME/freenect2` or a standard location like `/usr/local`
|
||||
you have to specify the path to it by adding `-Dfreenect2_DIR=path_to_freenect2/lib/cmake/freenect2` to `catkin_make`.*
|
||||
|
||||
5. Connect your sensor and run `kinect2_bridge`:
|
||||
|
||||
```bash
|
||||
roslaunch kinect2_bridge kinect2_bridge.launch
|
||||
```
|
||||
|
||||
6. Calibrate your sensor using the `kinect2_calibration`. [Further details](kinect2_calibration#calibrating-the-kinect-one)
|
||||
7. Add the calibration files to the `kinect2_bridge/data/<serialnumber>` folder. [Further details](kinect2_bridge#first-steps)
|
||||
8. Restart `kinect2_bridge` and view the results using `rosrun kinect2_viewer kinect2_viewer kinect2 sd cloud`.
|
||||
|
||||
## GPU acceleration
|
||||
|
||||
### OpenCL with AMD
|
||||
|
||||
Install the latest version of the AMD Catalyst drivers from https://support.amd.com and follow the instructions. Also install `opencl-headers`.
|
||||
|
||||
```bash
|
||||
sudo apt-get install opencl-headers
|
||||
```
|
||||
|
||||
### OpenCL/CUDA with Nvidia
|
||||
|
||||
Go to [developer.nvidia.com/cuda-downloads](https://developer.nvidia.com/cuda-downloads) and select `linux`, `x86_64`, `Ubuntu`, `14.04`, `deb(network)`.
|
||||
Download the file and follow the instructions. Also install `nvidia-modprobe` and `opencl-headers`.
|
||||
|
||||
```bash
|
||||
sudo apt-get install nvidia-modprobe opencl-headers
|
||||
```
|
||||
|
||||
You also need to add CUDA paths to the system environment, add these lines to you `~/.bashrc`:
|
||||
|
||||
```bash
|
||||
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
|
||||
export PATH="/usr/local/cuda/bin:${PATH}"
|
||||
```
|
||||
|
||||
A system-wide configuration of the libary path can be created with the following commands:
|
||||
|
||||
```bash
|
||||
echo "/usr/local/cuda/lib64" | sudo tee /etc/ld.so.conf.d/cuda.conf
|
||||
sudo ldconfig
|
||||
```
|
||||
|
||||
### OpenCL with Intel
|
||||
|
||||
You can either install a binary package from a PPA like [ppa:floe/beignet](https://launchpad.net/~floe/+archive/ubuntu/beignet), or build beignet yourself.
|
||||
It's recommended to use the binary from the PPA.
|
||||
|
||||
```bash
|
||||
sudo add-apt-repository ppa:floe/beignet && sudo apt-get update
|
||||
sudo apt-get install beignet beignet-dev opencl-headers
|
||||
```
|
||||
|
||||
## Citation
|
||||
|
||||
If you used `iai_kinect2` for your work, please cite it.
|
||||
|
||||
```tex
|
||||
@misc{iai_kinect2,
|
||||
author = {Wiedemeyer, Thiemo},
|
||||
title = {{IAI Kinect2}},
|
||||
organization = {Institute for Artificial Intelligence},
|
||||
address = {University Bremen},
|
||||
year = {2014 -- 2015},
|
||||
howpublished = {\url{https://github.com/code-iai/iai\_kinect2}},
|
||||
note = {Accessed June 12, 2015}
|
||||
}
|
||||
```
|
||||
|
||||
The result should look something similar to this (may depend on the bibliography style used):
|
||||
|
||||
```
|
||||
T. Wiedemeyer, “IAI Kinect2,” https://github.com/code-iai/iai_kinect2,
|
||||
Institute for Artificial Intelligence, University Bremen, 2014 – 2015,
|
||||
accessed June 12, 2015.
|
||||
```
|
||||
|
||||
## Screenshots
|
||||
|
||||
Here are some screenshots from our toolkit:
|
||||
![color image](http://ai.uni-bremen.de/wiki/_media/software/kinect2_color.jpg)
|
||||
![depth image](http://ai.uni-bremen.de/wiki/_media/software/kinect2_depth_colored.png)
|
||||
![point cloud](http://ai.uni-bremen.de/wiki/_media/software/kinect2_cloud.png)
|
||||
![image viewer](http://ai.uni-bremen.de/wiki/_media/software/kinect2_viewer.png)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(iai_kinect2)
|
||||
find_package(catkin REQUIRED)
|
||||
catkin_metapackage()
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>iai_kinect2</name>
|
||||
<version>0.0.1</version>
|
||||
<description>
|
||||
The iai_kinect2 metapackage
|
||||
</description>
|
||||
|
||||
<maintainer email="wiedemeyer@informatik.uni-bremen.de">Thiemo Wiedemeyer</maintainer>
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
|
||||
<run_depend>kinect2_calibration</run_depend>
|
||||
<run_depend>kinect2_viewer</run_depend>
|
||||
<run_depend>kinect2_bridge</run_depend>
|
||||
<run_depend>kinect2_registration</run_depend>
|
||||
|
||||
<export>
|
||||
<metapackage/>
|
||||
</export>
|
||||
</package>
|
144
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/CMakeLists.txt
vendored
Normal file
144
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(kinect2_bridge CXX)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBT_USE_DOUBLE_PRECISION -Wall")
|
||||
# Unused warnings
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Winit-self -Wunused-function -Wunused-label -Wunused-variable -Wunused-but-set-variable -Wunused-but-set-parameter")
|
||||
# Additional warnings
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Warray-bounds -Wtype-limits -Wreturn-type -Wsequence-point -Wparentheses -Wmissing-braces -Wchar-subscripts -Wswitch -Wwrite-strings -Wenum-compare -Wempty-body -Wlogical-op")
|
||||
|
||||
# Check for c++11 support
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
IF(COMPILER_SUPPORTS_CXX11)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
ELSEIF(COMPILER_SUPPORTS_CXX0X)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
ELSE()
|
||||
MESSAGE(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
ENDIF()
|
||||
|
||||
find_package(freenect2 REQUIRED HINTS "$ENV{HOME}/freenect2")
|
||||
|
||||
find_package(catkin REQUIRED COMPONENTS roscpp rostime tf std_msgs sensor_msgs nodelet cv_bridge compressed_depth_image_transport kinect2_registration)
|
||||
|
||||
## System dependencies are found with CMake's conventions
|
||||
find_package(OpenCV REQUIRED)
|
||||
|
||||
################################################
|
||||
## Declare ROS messages, services and actions ##
|
||||
################################################
|
||||
|
||||
###################################
|
||||
## catkin specific configuration ##
|
||||
###################################
|
||||
## The catkin_package macro generates cmake config files for your package
|
||||
## Declare things to be passed to dependent projects
|
||||
## INCLUDE_DIRS: uncomment this if you package contains header files
|
||||
## LIBRARIES: libraries you create in this project that dependent projects also need
|
||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
||||
catkin_package(
|
||||
INCLUDE_DIRS include
|
||||
# LIBRARIES kinect2_bridge
|
||||
CATKIN_DEPENDS kinect2_registration
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
###########
|
||||
## Build ##
|
||||
###########
|
||||
|
||||
# Display additional files in qtcreator
|
||||
execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f OUTPUT_VARIABLE FILES_STRING)
|
||||
string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
|
||||
add_custom_target(additional_files_${PROJECT_NAME}
|
||||
SOURCES
|
||||
${FILES_LIST}
|
||||
${PROJECT_SOURCE_DIR}/../README.md
|
||||
)
|
||||
|
||||
include_directories(include
|
||||
${catkin_INCLUDE_DIRS}
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
${freenect2_INCLUDE_DIRS}
|
||||
${kinect2_registration_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
if(DEPTH_REG_OPENCL)
|
||||
add_definitions(-DDEPTH_REG_OPENCL)
|
||||
endif()
|
||||
if(DEPTH_REG_CPU)
|
||||
add_definitions(-DDEPTH_REG_CPU)
|
||||
endif()
|
||||
add_definitions(-DK2_CALIB_PATH="${PROJECT_SOURCE_DIR}/data/")
|
||||
|
||||
add_library(kinect2_bridge_nodelet SHARED src/kinect2_bridge.cpp)
|
||||
target_link_libraries(kinect2_bridge_nodelet
|
||||
${catkin_LIBRARIES}
|
||||
${OpenCV_LIBRARIES}
|
||||
${freenect2_LIBRARY}
|
||||
${kinect2_registration_LIBRARY}
|
||||
)
|
||||
|
||||
add_executable(kinect2_bridge src/kinect2_bridge.cpp)
|
||||
target_link_libraries(kinect2_bridge
|
||||
${catkin_LIBRARIES}
|
||||
${OpenCV_LIBRARIES}
|
||||
${freenect2_LIBRARY}
|
||||
${kinect2_registration_LIBRARY}
|
||||
)
|
||||
|
||||
#############
|
||||
## Install ##
|
||||
#############
|
||||
|
||||
# all install targets should use catkin DESTINATION variables
|
||||
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
|
||||
|
||||
## Mark executable scripts (Python etc.) for installation
|
||||
## in contrast to setup.py, you can choose the destination
|
||||
# install(PROGRAMS
|
||||
# scripts/my_python_script
|
||||
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark executables and/or libraries for installation
|
||||
install(TARGETS kinect2_bridge kinect2_bridge_nodelet
|
||||
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
)
|
||||
|
||||
## Mark cpp header files for installation
|
||||
install(DIRECTORY include/${PROJECT_NAME}/
|
||||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
## Mark other files for installation (e.g. launch and bag files, etc.)
|
||||
install(DIRECTORY
|
||||
launch
|
||||
# myfile2
|
||||
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
)
|
||||
install(FILES
|
||||
nodelet_plugins.xml
|
||||
# myfile2
|
||||
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
)
|
||||
|
||||
#############
|
||||
## Testing ##
|
||||
#############
|
||||
|
||||
## Add gtest based cpp test target and link libraries
|
||||
# catkin_add_gtest(${PROJECT_NAME}-test test/test_kinect2_bridge.cpp)
|
||||
# if(TARGET ${PROJECT_NAME}-test)
|
||||
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||
# endif()
|
||||
|
||||
## Add folders to be run by python nosetests
|
||||
# catkin_add_nosetests(test)
|
|
@ -0,0 +1,171 @@
|
|||
# Kinect2 Bridge
|
||||
|
||||
## Maintainer
|
||||
|
||||
- [Thiemo Wiedemeyer](https://ai.uni-bremen.de/team/thiemo_wiedemeyer) <<wiedemeyer@cs.uni-bremen.de>>, [Institute for Artificial Intelligence](http://ai.uni-bremen.de/), University of Bremen
|
||||
|
||||
*Note:* ***Please use the GitHub issues*** *for questions and problems regarding the iai_kinect2 package and its components.* ***Do not write emails.***
|
||||
|
||||
## Description
|
||||
|
||||
This is a bridge between [libfreenect2](https://github.com/OpenKinect/libfreenect2) and ROS.
|
||||
|
||||
### Highlights
|
||||
|
||||
- delivers up to 30 frames per second on non high end hardware
|
||||
- delivers up to 30 frames per second over gigabit ethernet
|
||||
- support for compressed image transport
|
||||
- utilizes multiple cores and uses special OpenCL based implementation of the depth registration
|
||||
|
||||
## Dependencies
|
||||
|
||||
- ROS Hydro/Indigo
|
||||
- OpenCV
|
||||
- [libfreenect2](https://github.com/OpenKinect/libfreenect2)
|
||||
|
||||
*for the ROS packages look at the package.xml*
|
||||
|
||||
## First steps
|
||||
|
||||
For the depth registration the camera intrinsic and extrinsic parameters need to be known. The program reads in the values from the `data/<serialnumber>` folder. For each new sensor you need to add a sub-folder with the serial number of the device as the folder name. In this folder you need to provide 4 yaml files with the intrinsic and extrinsic parameters. These files can be created by the `kinect2_calibration` tool (or you can copy the files provided in one of the other folders, but results can be sub optimal). The device serial number is shown when `kinect2_bridge` or `Protonect` from libfreenect2 is started, it also appears in `dmesg` when you connect the sensor. [More information on calibration](../kinect2_calibration#calibrating-the-kinect-one).
|
||||
|
||||
When `kinect2_bridge` is running you can use the `kinect2_viewer` to display the images or point cloud: `rosrun kinect2_viewer kinect2_viewer sd image` or `rosrun kinect2_viewer kinect2_viewer sd cloud`.
|
||||
|
||||
## Topics
|
||||
|
||||
### HD Topics
|
||||
|
||||
The images in this topics have a FullHD resolution (1920x1080).
|
||||
|
||||
*Note: For correct registration of the depth image to the color image it is needed to perform a calibration.*
|
||||
|
||||
```
|
||||
/kinect2/hd/camera_info
|
||||
/kinect2/hd/image_color
|
||||
/kinect2/hd/image_color/compressed
|
||||
/kinect2/hd/image_color_rect
|
||||
/kinect2/hd/image_color_rect/compressed
|
||||
/kinect2/hd/image_depth_rect
|
||||
/kinect2/hd/image_depth_rect/compressed
|
||||
/kinect2/hd/image_mono
|
||||
/kinect2/hd/image_mono/compressed
|
||||
/kinect2/hd/image_mono_rect
|
||||
/kinect2/hd/image_mono_rect/compressed
|
||||
/kinect2/hd/points
|
||||
```
|
||||
|
||||
### Quater HD Topics
|
||||
|
||||
The images in this topics have a quarter FullHD resolution (960x540).
|
||||
|
||||
*Note: For correct registration of the depth image to the color image it is needed to perform a calibration.*
|
||||
|
||||
```
|
||||
/kinect2/qhd/camera_info
|
||||
/kinect2/qhd/image_color
|
||||
/kinect2/qhd/image_color/compressed
|
||||
/kinect2/qhd/image_color_rect
|
||||
/kinect2/qhd/image_color_rect/compressed
|
||||
/kinect2/qhd/image_depth_rect
|
||||
/kinect2/qhd/image_depth_rect/compressed
|
||||
/kinect2/qhd/image_mono
|
||||
/kinect2/qhd/image_mono/compressed
|
||||
/kinect2/qhd/image_mono_rect
|
||||
/kinect2/qhd/image_mono_rect/compressed
|
||||
/kinect2/qhd/points
|
||||
```
|
||||
|
||||
### IR/Depth Topics
|
||||
|
||||
This are the raw IR and depth images from the sensor (512x424).
|
||||
|
||||
*Note: The registration of the color image is available without a calibration. Parameters for the registration are provided by the sensor itself.*
|
||||
|
||||
```
|
||||
/kinect2/sd/camera_info
|
||||
/kinect2/sd/image_color_rect
|
||||
/kinect2/sd/image_color_rect/compressed
|
||||
/kinect2/sd/image_depth
|
||||
/kinect2/sd/image_depth/compressed
|
||||
/kinect2/sd/image_depth_rect
|
||||
/kinect2/sd/image_depth_rect/compressed
|
||||
/kinect2/sd/image_ir
|
||||
/kinect2/sd/image_ir/compressed
|
||||
/kinect2/sd/image_ir_rect
|
||||
/kinect2/sd/image_ir_rect/compressed
|
||||
/kinect2/sd/points
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Point clouds are only published when the launch file is used. Run `roslaunch kinect2_bridge kinect2_bridge.launch`.
|
||||
- Images from the same frame have the same timestamp. Using the `message_filters::sync_policies::ExactTime` policy is recommended.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
roslaunch kinect2_bridge kinect2_bridge.launch [options:=value]
|
||||
base_name:=<string>
|
||||
default: kinect2
|
||||
info: set base name for all topics
|
||||
sensor:=<string>
|
||||
default:
|
||||
info: serial of the sensor to use
|
||||
fps_limit:=<double>
|
||||
default: -1.0
|
||||
info: limit the frames per second
|
||||
calib_path:=<string>
|
||||
default: /home/wiedemeyer/work/src/iai_kinect2/kinect2_bridge/data/
|
||||
info: path to the calibration files
|
||||
use_png:=<bool>
|
||||
default: false
|
||||
info: Use PNG compression instead of TIFF
|
||||
jpeg_quality:=<int>
|
||||
default: 90
|
||||
info: JPEG quality level from 0 to 100
|
||||
png_level:=<int>
|
||||
default: 1
|
||||
info: PNG compression level from 0 to 9
|
||||
depth_method:=<string>
|
||||
default: cuda
|
||||
info: Use specific depth processing: default, cpu, opengl, opencl, cuda, clkde, cudakde
|
||||
depth_device:=<int>
|
||||
default: -1
|
||||
info: openCL device to use for depth processing
|
||||
reg_method:=<string>
|
||||
default: opencl
|
||||
info: Use specific depth registration: default, cpu, opencl
|
||||
reg_device:=<int>
|
||||
default: -1
|
||||
info: openCL device to use for depth registration
|
||||
max_depth:=<double>
|
||||
default: 12.0
|
||||
info: max depth value
|
||||
min_depth:=<double>
|
||||
default: 0.1
|
||||
info: min depth value
|
||||
queue_size:=<int>
|
||||
default: 2
|
||||
info: queue size of publisher
|
||||
bilateral_filter:=<bool>
|
||||
default: true
|
||||
info: enable bilateral filtering of depth images
|
||||
edge_aware_filter:=<bool>
|
||||
default: true
|
||||
info: enable edge aware filtering of depth images
|
||||
publish_tf:=<bool>
|
||||
default: false
|
||||
info: publish static tf transforms for camera
|
||||
base_name_tf:=<string>
|
||||
default: as base_name
|
||||
info: base name for the tf frames
|
||||
worker_threads:=<int>
|
||||
default: 4
|
||||
info: number of threads used for processing the images
|
||||
```
|
||||
|
||||
## Key bindings
|
||||
|
||||
Terminal:
|
||||
- `CRTL`+`c`: Quit
|
||||
|
26
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/196605135147/calib_color.yaml
vendored
Normal file
26
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/196605135147/calib_color.yaml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
%YAML:1.0
|
||||
cameraMatrix: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 1.0599465578241038e+03, 0., 9.5488326677588441e+02, 0.,
|
||||
1.0539326808799726e+03, 5.2373858291060583e+02, 0., 0., 1. ]
|
||||
distortionCoefficients: !!opencv-matrix
|
||||
rows: 1
|
||||
cols: 5
|
||||
dt: d
|
||||
data: [ 5.6268441170930321e-02, -7.4199141308694802e-02,
|
||||
1.4250797540545752e-03, -1.6951722389720336e-03,
|
||||
2.4107681263086548e-02 ]
|
||||
rotation: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||
projection: !!opencv-matrix
|
||||
rows: 4
|
||||
cols: 4
|
||||
dt: d
|
||||
data: [ 1.0599465578241038e+03, 0., 9.5488326677588441e+02, 0., 0.,
|
||||
1.0539326808799726e+03, 5.2373858291060583e+02, 0., 0., 0., 1.,
|
||||
0., 0., 0., 0., 1. ]
|
|
@ -0,0 +1,2 @@
|
|||
%YAML:1.0
|
||||
depthShift: -1.3354238655403018e+01
|
26
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/196605135147/calib_ir.yaml
vendored
Normal file
26
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/196605135147/calib_ir.yaml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
%YAML:1.0
|
||||
cameraMatrix: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 3.6694757270064110e+02, 0., 2.4298551682775121e+02, 0.,
|
||||
3.6479117165721783e+02, 2.0769853575457685e+02, 0., 0., 1. ]
|
||||
distortionCoefficients: !!opencv-matrix
|
||||
rows: 1
|
||||
cols: 5
|
||||
dt: d
|
||||
data: [ 9.6558110377123016e-02, -2.8298244017989416e-01,
|
||||
1.5889951609432634e-04, -5.0751483524871712e-04,
|
||||
1.0523948765859192e-01 ]
|
||||
rotation: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||
projection: !!opencv-matrix
|
||||
rows: 4
|
||||
cols: 4
|
||||
dt: d
|
||||
data: [ 3.6694757270064110e+02, 0., 2.4298551682775121e+02, 0., 0.,
|
||||
3.6479117165721783e+02, 2.0769853575457685e+02, 0., 0., 0., 1.,
|
||||
0., 0., 0., 0., 1. ]
|
33
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/196605135147/calib_pose.yaml
vendored
Normal file
33
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/196605135147/calib_pose.yaml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
%YAML:1.0
|
||||
rotation: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 9.9979883926593693e-01, -1.6871335541758126e-02,
|
||||
-1.0846153213119176e-02, 1.6891097527572209e-02,
|
||||
9.9985583336600126e-01, 1.7330055664057141e-03,
|
||||
1.0815351441312036e-02, -1.9158603854556545e-03,
|
||||
9.9993967700666042e-01 ]
|
||||
translation: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 1
|
||||
dt: d
|
||||
data: [ -5.2052476112081990e-02, -4.6313865353939110e-04,
|
||||
8.8806735554907584e-04 ]
|
||||
essential: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ -2.0009439617717153e-05, -8.8705201686837285e-04,
|
||||
-4.6464974129998811e-04, 1.4508545338106024e-03,
|
||||
-1.1470815928716492e-04, 5.2039704036310315e-02,
|
||||
-4.1617796233292743e-04, -5.2052785649435836e-02,
|
||||
-9.5230503642644511e-05 ]
|
||||
fundamental: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ -1.1817221592596941e-08, -5.2697406371005770e-07,
|
||||
1.1627629703684574e-05, 8.6173835202613450e-07,
|
||||
-6.8533918097934840e-08, 1.1146863908955499e-02,
|
||||
-7.0056301516242358e-04, -3.2237824184460216e-02, 1. ]
|
26
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/299150235147/calib_color.yaml
vendored
Normal file
26
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/299150235147/calib_color.yaml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
%YAML:1.0
|
||||
cameraMatrix: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 1.0660120360637927e+03, 0., 9.4558752751085558e+02, 0.,
|
||||
1.0688708399911650e+03, 5.2006994012356529e+02, 0., 0., 1. ]
|
||||
distortionCoefficients: !!opencv-matrix
|
||||
rows: 1
|
||||
cols: 5
|
||||
dt: d
|
||||
data: [ 5.9360108008991816e-02, -6.2758287999836640e-02,
|
||||
-1.5766859436148536e-03, -1.1502971845708829e-03,
|
||||
7.7657531491476016e-03 ]
|
||||
rotation: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||
projection: !!opencv-matrix
|
||||
rows: 4
|
||||
cols: 4
|
||||
dt: d
|
||||
data: [ 1.0705899358803581e+03, 0., 9.4912209493857927e+02, 0., 0.,
|
||||
1.0734714110656350e+03, 5.1739403678512770e+02, 0., 0., 0., 1.,
|
||||
0., 0., 0., 0., 1. ]
|
26
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/299150235147/calib_ir.yaml
vendored
Normal file
26
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/299150235147/calib_ir.yaml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
%YAML:1.0
|
||||
cameraMatrix: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 3.6638346288148574e+02, 0., 2.5564531890330468e+02, 0.,
|
||||
3.6714380707081017e+02, 2.0398020160452000e+02, 0., 0., 1. ]
|
||||
distortionCoefficients: !!opencv-matrix
|
||||
rows: 1
|
||||
cols: 5
|
||||
dt: d
|
||||
data: [ 1.0952761399998089e-01, -3.1461678804886056e-01,
|
||||
-1.2613602146463686e-03, -7.1815538262097348e-04,
|
||||
1.2565382780717374e-01 ]
|
||||
rotation: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
|
||||
projection: !!opencv-matrix
|
||||
rows: 4
|
||||
cols: 4
|
||||
dt: d
|
||||
data: [ 3.6677544568158339e+02, 0., 2.5556683247282524e+02, 0., 0.,
|
||||
3.6781383188070873e+02, 2.0379944675671842e+02, 0., 0., 0., 1.,
|
||||
0., 0., 0., 0., 1. ]
|
33
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/299150235147/calib_pose.yaml
vendored
Normal file
33
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/data/299150235147/calib_pose.yaml
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
%YAML:1.0
|
||||
rotation: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 9.9999932279092762e-01, 1.1418659978192800e-03,
|
||||
-2.2485490683788145e-04, -1.1422648685177200e-03,
|
||||
9.9999776014165309e-01, -1.7818368744440499e-03,
|
||||
2.2281978425420061e-04, 1.7820925116285419e-03,
|
||||
9.9999838724751144e-01 ]
|
||||
translation: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 1
|
||||
dt: d
|
||||
data: [ -5.2017152124108991e-02, -2.4045118112262469e-04,
|
||||
2.9454469402941368e-04 ]
|
||||
essential: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 2.8287077589668930e-07, -2.9497254054031309e-04,
|
||||
-2.3992596273739050e-04, 3.0613494517488655e-04,
|
||||
9.3035707847567608e-05, 5.2017002003497723e-02,
|
||||
2.9986838371861500e-04, -5.2016761050028761e-02,
|
||||
9.2632013130372647e-05 ]
|
||||
fundamental: !!opencv-matrix
|
||||
rows: 3
|
||||
cols: 3
|
||||
dt: d
|
||||
data: [ 1.9731570930693606e-10, -2.0533114366326771e-07,
|
||||
-1.9484772545527813e-05, 2.1297242074431652e-07,
|
||||
6.4589181747782925e-08, 1.3190795684430680e-02,
|
||||
1.1203310138770501e-04, -3.8438663277953075e-02, 1. ]
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __KINECT2_DEFINITIONS_H__
|
||||
#define __KINECT2_DEFINITIONS_H__
|
||||
|
||||
#include <kinect2_registration/kinect2_console.h>
|
||||
|
||||
#define K2_DEFAULT_NS "kinect2"
|
||||
|
||||
#define K2_TF_LINK "_link"
|
||||
#define K2_TF_RGB_OPT_FRAME "_rgb_optical_frame"
|
||||
#define K2_TF_IR_OPT_FRAME "_ir_optical_frame"
|
||||
|
||||
#define K2_TOPIC_HD "/hd"
|
||||
#define K2_TOPIC_QHD "/qhd"
|
||||
#define K2_TOPIC_SD "/sd"
|
||||
|
||||
#define K2_TOPIC_IMAGE_RECT "_rect"
|
||||
#define K2_TOPIC_IMAGE_COLOR "/image_color"
|
||||
#define K2_TOPIC_IMAGE_MONO "/image_mono"
|
||||
#define K2_TOPIC_IMAGE_DEPTH "/image_depth"
|
||||
#define K2_TOPIC_IMAGE_IR "/image_ir"
|
||||
|
||||
#define K2_TOPIC_COMPRESSED "/compressed"
|
||||
#define K2_TOPIC_INFO "/camera_info"
|
||||
|
||||
#define K2_CALIB_COLOR "calib_color.yaml"
|
||||
#define K2_CALIB_IR "calib_ir.yaml"
|
||||
#define K2_CALIB_POSE "calib_pose.yaml"
|
||||
#define K2_CALIB_DEPTH "calib_depth.yaml"
|
||||
|
||||
#define K2_CALIB_CAMERA_MATRIX "cameraMatrix"
|
||||
#define K2_CALIB_DISTORTION "distortionCoefficients"
|
||||
#define K2_CALIB_ROTATION "rotation"
|
||||
#define K2_CALIB_PROJECTION "projection"
|
||||
#define K2_CALIB_TRANSLATION "translation"
|
||||
#define K2_CALIB_ESSENTIAL "essential"
|
||||
#define K2_CALIB_FUNDAMENTAL "fundamental"
|
||||
#define K2_CALIB_DEPTH_SHIFT "depthShift"
|
||||
|
||||
#endif //__KINECT2_DEFINITIONS_H__
|
113
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/launch/kinect2_bridge.launch
vendored
Normal file
113
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/launch/kinect2_bridge.launch
vendored
Normal file
|
@ -0,0 +1,113 @@
|
|||
<launch>
|
||||
|
||||
<arg name="base_name" default="kinect2"/>
|
||||
<arg name="sensor" default=""/>
|
||||
<arg name="publish_tf" default="false"/>
|
||||
<arg name="base_name_tf" default="$(arg base_name)"/>
|
||||
<arg name="fps_limit" default="-1.0"/>
|
||||
<arg name="calib_path" default="$(find kinect2_bridge)/data/"/>
|
||||
<arg name="use_png" default="false"/>
|
||||
<arg name="jpeg_quality" default="90"/>
|
||||
<arg name="png_level" default="1"/>
|
||||
<arg name="depth_method" default="default"/>
|
||||
<arg name="depth_device" default="-1"/>
|
||||
<arg name="reg_method" default="default"/>
|
||||
<arg name="reg_device" default="-1"/>
|
||||
<arg name="max_depth" default="12.0"/>
|
||||
<arg name="min_depth" default="0.1"/>
|
||||
<arg name="queue_size" default="5"/>
|
||||
<arg name="bilateral_filter" default="true"/>
|
||||
<arg name="edge_aware_filter" default="true"/>
|
||||
<arg name="worker_threads" default="4"/>
|
||||
<arg name="machine" default="localhost"/>
|
||||
<arg name="nodelet_manager" default="$(arg base_name)"/>
|
||||
<arg name="start_manager" default="true"/>
|
||||
<arg name="use_machine" default="true"/>
|
||||
<arg name="respawn" default="true"/>
|
||||
<arg name="use_nodelet" default="true"/>
|
||||
<arg name="output" default="screen"/>
|
||||
|
||||
<machine name="localhost" address="localhost" if="$(arg use_machine)"/>
|
||||
|
||||
<node pkg="nodelet" type="nodelet" name="$(arg nodelet_manager)" args="manager"
|
||||
if="$(arg start_manager)" machine="$(arg machine)" output="screen"/>
|
||||
|
||||
<!-- Nodelet version of kinect2_bridge -->
|
||||
<node pkg="nodelet" type="nodelet" name="$(arg base_name)_bridge" machine="$(arg machine)"
|
||||
args="load kinect2_bridge/kinect2_bridge_nodelet $(arg nodelet_manager)"
|
||||
respawn="$(arg respawn)" output="$(arg output)" if="$(arg use_nodelet)">
|
||||
<param name="base_name" type="str" value="$(arg base_name)"/>
|
||||
<param name="sensor" type="str" value="$(arg sensor)"/>
|
||||
<param name="publish_tf" type="bool" value="$(arg publish_tf)"/>
|
||||
<param name="base_name_tf" type="str" value="$(arg base_name_tf)"/>
|
||||
<param name="fps_limit" type="double" value="$(arg fps_limit)"/>
|
||||
<param name="calib_path" type="str" value="$(arg calib_path)"/>
|
||||
<param name="use_png" type="bool" value="$(arg use_png)"/>
|
||||
<param name="jpeg_quality" type="int" value="$(arg jpeg_quality)"/>
|
||||
<param name="png_level" type="int" value="$(arg png_level)"/>
|
||||
<param name="depth_method" type="str" value="$(arg depth_method)"/>
|
||||
<param name="depth_device" type="int" value="$(arg depth_device)"/>
|
||||
<param name="reg_method" type="str" value="$(arg reg_method)"/>
|
||||
<param name="reg_device" type="int" value="$(arg reg_device)"/>
|
||||
<param name="max_depth" type="double" value="$(arg max_depth)"/>
|
||||
<param name="min_depth" type="double" value="$(arg min_depth)"/>
|
||||
<param name="queue_size" type="int" value="$(arg queue_size)"/>
|
||||
<param name="bilateral_filter" type="bool" value="$(arg bilateral_filter)"/>
|
||||
<param name="edge_aware_filter" type="bool" value="$(arg edge_aware_filter)"/>
|
||||
<param name="worker_threads" type="int" value="$(arg worker_threads)"/>
|
||||
</node>
|
||||
|
||||
<!-- Node version of kinect2_bridge -->
|
||||
<node pkg="kinect2_bridge" type="kinect2_bridge" name="$(arg base_name)_bridge" machine="$(arg machine)"
|
||||
respawn="$(arg respawn)" output="$(arg output)" unless="$(arg use_nodelet)">
|
||||
<param name="base_name" type="str" value="$(arg base_name)"/>
|
||||
<param name="sensor" type="str" value="$(arg sensor)"/>
|
||||
<param name="publish_tf" type="bool" value="$(arg publish_tf)"/>
|
||||
<param name="base_name_tf" type="str" value="$(arg base_name_tf)"/>
|
||||
<param name="fps_limit" type="double" value="$(arg fps_limit)"/>
|
||||
<param name="calib_path" type="str" value="$(arg calib_path)"/>
|
||||
<param name="use_png" type="bool" value="$(arg use_png)"/>
|
||||
<param name="jpeg_quality" type="int" value="$(arg jpeg_quality)"/>
|
||||
<param name="png_level" type="int" value="$(arg png_level)"/>
|
||||
<param name="depth_method" type="str" value="$(arg depth_method)"/>
|
||||
<param name="depth_device" type="int" value="$(arg depth_device)"/>
|
||||
<param name="reg_method" type="str" value="$(arg reg_method)"/>
|
||||
<param name="reg_device" type="int" value="$(arg reg_device)"/>
|
||||
<param name="max_depth" type="double" value="$(arg max_depth)"/>
|
||||
<param name="min_depth" type="double" value="$(arg min_depth)"/>
|
||||
<param name="queue_size" type="int" value="$(arg queue_size)"/>
|
||||
<param name="bilateral_filter" type="bool" value="$(arg bilateral_filter)"/>
|
||||
<param name="edge_aware_filter" type="bool" value="$(arg edge_aware_filter)"/>
|
||||
<param name="worker_threads" type="int" value="$(arg worker_threads)"/>
|
||||
</node>
|
||||
|
||||
<!-- sd point cloud (512 x 424) -->
|
||||
<node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_sd" machine="$(arg machine)"
|
||||
args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)">
|
||||
<remap from="rgb/camera_info" to="$(arg base_name)/sd/camera_info"/>
|
||||
<remap from="rgb/image_rect_color" to="$(arg base_name)/sd/image_color_rect"/>
|
||||
<remap from="depth_registered/image_rect" to="$(arg base_name)/sd/image_depth_rect"/>
|
||||
<remap from="depth_registered/points" to="$(arg base_name)/sd/points"/>
|
||||
<param name="queue_size" type="int" value="$(arg queue_size)"/>
|
||||
</node>
|
||||
|
||||
<!-- qhd point cloud (960 x 540) -->
|
||||
<node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_qhd" machine="$(arg machine)"
|
||||
args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)">
|
||||
<remap from="rgb/camera_info" to="$(arg base_name)/qhd/camera_info"/>
|
||||
<remap from="rgb/image_rect_color" to="$(arg base_name)/qhd/image_color_rect"/>
|
||||
<remap from="depth_registered/image_rect" to="$(arg base_name)/qhd/image_depth_rect"/>
|
||||
<remap from="depth_registered/points" to="$(arg base_name)/qhd/points"/>
|
||||
<param name="queue_size" type="int" value="$(arg queue_size)"/>
|
||||
</node>
|
||||
|
||||
<!-- hd point cloud (1920 x 1080) -->
|
||||
<node pkg="nodelet" type="nodelet" name="$(arg base_name)_points_xyzrgb_hd" machine="$(arg machine)"
|
||||
args="load depth_image_proc/point_cloud_xyzrgb $(arg nodelet_manager)" respawn="$(arg respawn)">
|
||||
<remap from="rgb/camera_info" to="$(arg base_name)/hd/camera_info"/>
|
||||
<remap from="rgb/image_rect_color" to="$(arg base_name)/hd/image_color_rect"/>
|
||||
<remap from="depth_registered/image_rect" to="$(arg base_name)/hd/image_depth_rect"/>
|
||||
<remap from="depth_registered/points" to="$(arg base_name)/hd/points"/>
|
||||
<param name="queue_size" type="int" value="$(arg queue_size)"/>
|
||||
</node>
|
||||
</launch>
|
5
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/nodelet_plugins.xml
vendored
Normal file
5
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/nodelet_plugins.xml
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<library path="lib/libkinect2_bridge_nodelet">
|
||||
<class name="kinect2_bridge/kinect2_bridge_nodelet" type="Kinect2BridgeNodelet" base_class_type="nodelet::Nodelet">
|
||||
<description>Kinect2Bridge nodelet</description>
|
||||
</class>
|
||||
</library>
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>kinect2_bridge</name>
|
||||
<version>0.0.1</version>
|
||||
<description>The kinect2_bridge package</description>
|
||||
|
||||
<maintainer email="wiedemeyer@informatik.uni-bremen.de">Thiemo Wiedemeyer</maintainer>
|
||||
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
|
||||
<build_depend>roscpp</build_depend>
|
||||
<build_depend>rostime</build_depend>
|
||||
<build_depend>tf</build_depend>
|
||||
<build_depend>std_msgs</build_depend>
|
||||
<build_depend>sensor_msgs</build_depend>
|
||||
<build_depend>message_filters</build_depend>
|
||||
<build_depend>compressed_depth_image_transport</build_depend>
|
||||
<build_depend>kinect2_registration</build_depend>
|
||||
<build_depend>nodelet</build_depend>
|
||||
<build_depend>cv_bridge</build_depend><!-- Depend on cv_bridge instead of libopencv-dev to support ROS Hydro.-->
|
||||
|
||||
<run_depend>message_runtime</run_depend>
|
||||
<run_depend>roscpp</run_depend>
|
||||
<run_depend>rostime</run_depend>
|
||||
<run_depend>tf</run_depend>
|
||||
<run_depend>std_msgs</run_depend>
|
||||
<run_depend>sensor_msgs</run_depend>
|
||||
<run_depend>compressed_depth_image_transport</run_depend>
|
||||
<run_depend>kinect2_registration</run_depend>
|
||||
<run_depend>nodelet</run_depend>
|
||||
<run_depend>depth_image_proc</run_depend>
|
||||
<run_depend>cv_bridge</run_depend><!-- Depend on cv_bridge instead of libopencv-dev to support ROS Hydro.-->
|
||||
|
||||
<export>
|
||||
<nodelet plugin="${prefix}/nodelet_plugins.xml" />
|
||||
</export>
|
||||
</package>
|
1632
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp
vendored
Normal file
1632
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_bridge/src/kinect2_bridge.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
122
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/CMakeLists.txt
vendored
Normal file
122
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(kinect2_calibration CXX)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBT_USE_DOUBLE_PRECISION -Wall")
|
||||
# Unused warnings
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Winit-self -Wunused-function -Wunused-label -Wunused-variable -Wunused-but-set-variable -Wunused-but-set-parameter")
|
||||
# Additional warnings
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Warray-bounds -Wtype-limits -Wreturn-type -Wsequence-point -Wparentheses -Wmissing-braces -Wchar-subscripts -Wswitch -Wwrite-strings -Wenum-compare -Wempty-body -Wlogical-op")
|
||||
|
||||
# Check for c++11 support
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
IF(COMPILER_SUPPORTS_CXX11)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
ELSEIF(COMPILER_SUPPORTS_CXX0X)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
ELSE()
|
||||
MESSAGE(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
ENDIF()
|
||||
|
||||
find_package(catkin REQUIRED COMPONENTS roscpp rostime std_msgs sensor_msgs message_filters cv_bridge image_transport compressed_image_transport compressed_depth_image_transport kinect2_bridge)
|
||||
|
||||
## System dependencies are found with CMake's conventions
|
||||
find_package(OpenCV REQUIRED)
|
||||
find_package(OpenMP)
|
||||
|
||||
if(OPENMP_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
################################################
|
||||
## Declare ROS messages, services and actions ##
|
||||
################################################
|
||||
|
||||
###################################
|
||||
## catkin specific configuration ##
|
||||
###################################
|
||||
## The catkin_package macro generates cmake config files for your package
|
||||
## Declare things to be passed to dependent projects
|
||||
## INCLUDE_DIRS: uncomment this if you package contains header files
|
||||
## LIBRARIES: libraries you create in this project that dependent projects also need
|
||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
||||
catkin_package(
|
||||
# INCLUDE_DIRS include
|
||||
# LIBRARIES kinect2_bridge
|
||||
# CATKIN_DEPENDS other_catkin_pkg
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
###########
|
||||
## Build ##
|
||||
###########
|
||||
|
||||
# Display additional files in qtcreator
|
||||
execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f OUTPUT_VARIABLE FILES_STRING)
|
||||
string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
|
||||
add_custom_target(additional_files_${PROJECT_NAME}
|
||||
SOURCES
|
||||
${FILES_LIST}
|
||||
)
|
||||
|
||||
include_directories(include
|
||||
${catkin_INCLUDE_DIRS}
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
${kinect2_bridge_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
add_executable(kinect2_calibration src/kinect2_calibration.cpp)
|
||||
target_link_libraries(kinect2_calibration
|
||||
${catkin_LIBRARIES}
|
||||
${OpenCV_LIBRARIES}
|
||||
)
|
||||
|
||||
#############
|
||||
## Install ##
|
||||
#############
|
||||
|
||||
# all install targets should use catkin DESTINATION variables
|
||||
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
|
||||
|
||||
## Mark executable scripts (Python etc.) for installation
|
||||
## in contrast to setup.py, you can choose the destination
|
||||
# install(PROGRAMS
|
||||
# scripts/my_python_script
|
||||
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark executables and/or libraries for installation
|
||||
# install(TARGETS kinect2_bridge kinect2_bridge_node
|
||||
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark cpp header files for installation
|
||||
# install(DIRECTORY include/${PROJECT_NAME}/
|
||||
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
# FILES_MATCHING PATTERN "*.h"
|
||||
# PATTERN ".svn" EXCLUDE
|
||||
# )
|
||||
|
||||
## Mark other files for installation (e.g. launch and bag files, etc.)
|
||||
# install(FILES
|
||||
# # myfile1
|
||||
# # myfile2
|
||||
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
# )
|
||||
|
||||
#############
|
||||
## Testing ##
|
||||
#############
|
||||
|
||||
## Add gtest based cpp test target and link libraries
|
||||
# catkin_add_gtest(${PROJECT_NAME}-test test/test_kinect2_bridge.cpp)
|
||||
# if(TARGET ${PROJECT_NAME}-test)
|
||||
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||
# endif()
|
||||
|
||||
## Add folders to be run by python nosetests
|
||||
# catkin_add_nosetests(test)
|
169
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/README.md
vendored
Normal file
169
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/README.md
vendored
Normal file
|
@ -0,0 +1,169 @@
|
|||
# Kinect2 Calibration
|
||||
|
||||
## Maintainer
|
||||
|
||||
- [Thiemo Wiedemeyer](https://ai.uni-bremen.de/team/thiemo_wiedemeyer) <<wiedemeyer@cs.uni-bremen.de>>, [Institute for Artificial Intelligence](http://ai.uni-bremen.de/), University of Bremen
|
||||
|
||||
*Note:* ***Please use the GitHub issues*** *for questions and problems regarding the iai_kinect2 package and its components.* ***Do not write emails.***
|
||||
|
||||
## Description
|
||||
|
||||
This tool uses OpenCV to calibrate two cameras to each other. It is specially designed for the Kinect One. It uses chess or circle boards.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- ROS Hydro/Indigo
|
||||
- OpenCV
|
||||
|
||||
*for the ROS packages look at the package.xml*
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
kinect2_calibration [options]
|
||||
name: 'any string' equals to the kinect2_bridge topic base name
|
||||
mode: 'record' or 'calibrate'
|
||||
source: 'color', 'ir', 'sync', 'depth'
|
||||
board:
|
||||
'circle<WIDTH>x<HEIGHT>x<SIZE>' for symmetric circle grid
|
||||
'acircle<WIDTH>x<HEIGHT>x<SIZE>' for asymmetric circle grid
|
||||
'chess<WIDTH>x<HEIGHT>x<SIZE>' for chessboard pattern
|
||||
distortion model: 'rational' for using model with 8 instead of 5 coefficients
|
||||
output path: '-path <PATH>'
|
||||
```
|
||||
|
||||
## Key bindings
|
||||
|
||||
Windows:
|
||||
- `ESC`, `q`: Quit
|
||||
- `SPACE`, `s`: Save the current image for calibration
|
||||
- `l`: decrease min and max value for IR value rage
|
||||
- `h`: increase min and max value for IR value rage
|
||||
- `1`: decrease min value for IR value rage
|
||||
- `2`: increase min value for IR value rage
|
||||
- `3`: decrease max value for IR value rage
|
||||
- `4`: increase max value for IR value rage
|
||||
|
||||
Terminal:
|
||||
- `CRTL`+`c`: Quit
|
||||
|
||||
## Calibration patterns
|
||||
|
||||
Any chessboard pattern or symmetric or asymmetric circle grid should work. Three different chessboard patterns are located inside the `kinect2_calibration/patterns` folder:
|
||||
- [chess5x7x0.03.pdf](patterns/chess5x7x0.03.pdf)
|
||||
- [chess7x9x0.025.pdf](patterns/chess7x9x0.025.pdf)
|
||||
- [chess9x11x0.02.pdf](patterns/chess9x11x0.02.pdf)
|
||||
|
||||
Other patterns are available at OpenCV:
|
||||
- [Chessboard pattern](http://docs.opencv.org/2.4.2/_downloads/pattern.png)
|
||||
- [Asymmetric circle grid](http://docs.opencv.org/2.4.2/_downloads/acircles_pattern.png)
|
||||
|
||||
The standard board is a 7x6 0.108m chessboard from the PR2. But any other board can be specified with as parameter. For example a circle board with 8x7 circles in 0.02m distance between them `rosrun kinect2_calibration kinect2_calibration record color circle8x7x0.02`.
|
||||
|
||||
Recently, to calibrate our sensors, we have used the chess5x7x0.03 pattern, as it can be printed easily on a good laser printer on A4 paper.
|
||||
|
||||
|
||||
## Calibrating the Kinect One
|
||||
|
||||
*Recommended preparation:*
|
||||
- Print your calibration pattern (for the examples, we used chess5x7x0.03) and glue it to a flat object. It is very important that the calibration pattern is very flat. Also, check with a caliper that the distance between the features of the printed pattern is correct. Sometimes printers scale the document, and the calibration won't work. For the mentioned pattern, the distance between intersections of black and white corners should be 3cm exactly.
|
||||
- Get two tripods, one for holding the calibration pattern, and another one for holding the kinect2 sensor. Ideally, the tripod for the kinect2 will have a ball head, to allow you to move it easily and lock it in place before you take an image. It is very important that the sensor is stable (and the image is clear and not blurred) before you take an image. The tripod will specially help you to make sure that the sensor has not moved between the moment the IR and the RGB images are taken.
|
||||
- When recording images for all the steps indicated below (RGB, IR, SYNC), start the recording program, then press spacebar to record each image. The calibration pattern should be detected (indicated by color lines overlayed on the calibration pattern), and the image should be clear and stable.
|
||||
- It is recommended to take images that show the calibration pattern in all areas of the image, and with different orientations of the pattern (tilting the pattern relative to the plane of the image), and at least two distances. So you can easily reach 100 images per calibration set.
|
||||
- We normally start at a short distance, where the calibration pattern covers most of the image, there we take several pictures tilting the calibration pattern vertically, then horizontally. Imagine a ray coming out of the camera sensor, this makes sure that you have images where the calibration pattern is not perpendicular to that ray.
|
||||
- Then we move the calibration pattern further away, and for different orientations (tilting) of the pattern, we take many images so that we calibration pattern is present around most of the camera image. For example, at first the calibration pattern is on the left upper corner. Then on the next image on the upper middle, then on the upper right corner. Then some images where the calibration pattern is in the middle vertically, etc...
|
||||
|
||||
*Typical calibration setup*
|
||||
![kinect2_calibration_setup_small.jpg](https://ai.uni-bremen.de/_media/kinect2_calibration_setup_small.jpg)
|
||||
|
||||
*Detailed steps:*
|
||||
|
||||
0. If you haven't already, start the kinect2_bridge with a low number of frames per second (to make it easy on your CPU): `rosrun kinect2_bridge kinect2_bridge _fps_limit:=2`
|
||||
1. create a directory for your calibration data files, for example: `mkdir ~/kinect_cal_data; cd ~/kinect_cal_data`
|
||||
2. Record images for the color camera: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record color`
|
||||
3. Calibrate the intrinsics: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate color`
|
||||
4. Record images for the ir camera: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record ir`
|
||||
5. Calibrate the intrinsics of the ir camera: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate ir`
|
||||
6. Record images on both cameras synchronized: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 record sync`
|
||||
7. Calibrate the extrinsics: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate sync`
|
||||
8. Calibrate the depth measurements: `rosrun kinect2_calibration kinect2_calibration chess5x7x0.03 calibrate depth`
|
||||
9. Find out the serial number of your kinect2 by looking at the first lines printed out by the kinect2_bridge. The line looks like this:
|
||||
`device serial: 012526541941`
|
||||
10. Create the calibration results directory in kinect2_bridge/data/$serial: `roscd kinect2_bridge/data; mkdir 012526541941`
|
||||
11. Copy the following files from your calibration directory (~/kinect_cal_data) into the directory you just created: `calib_color.yaml calib_depth.yaml calib_ir.yaml calib_pose.yaml`
|
||||
12. Restart the kinect2_bridge and be amazed at the better data.
|
||||
|
||||
|
||||
|
||||
## Calibration of the depth measurements
|
||||
|
||||
I did some tests on the measured and the computed distance based on the detected chess board. It seems like the Kinect2 (or at least the Kinect2s I am using) has a static offset of around 24 mm. As shown in the following images, one can see, that the difference between measured and computed distance is unrelated to the x and y coordinates of the pixel and also unrelated to the distance.
|
||||
|
||||
![plot.png](http://ai.uni-bremen.de/wiki/_media/software/plot.png)
|
||||
![plot_x.png](http://ai.uni-bremen.de/wiki/_media/software/plot_x.png)
|
||||
![plot_y.png](http://ai.uni-bremen.de/wiki/_media/software/plot_y.png)
|
||||
![plot_xy.png](http://ai.uni-bremen.de/wiki/_media/software/plot_xy.png)
|
||||
|
||||
For the images above ~400 images of a 4x5x0.03 chessboard in different orientations, distances and image positions were used. The code for computing the depth offset is added to the calibration tool.
|
||||
|
||||
### GNUPlot
|
||||
|
||||
The depth calibration creates a file named `plot.dat` inside the calibration folder. This files contains the results of the calibration in 5 columns: x, y, computed depth, measured depth, difference between computed and measured depth.
|
||||
|
||||
- Difference between measured/computed distance
|
||||
|
||||
```
|
||||
set xlabel "Measured distance"
|
||||
set ylabel "Computed distance"
|
||||
plot 'plot.dat' using 3:4 with dots title "Difference between measured/computed distance"
|
||||
```
|
||||
|
||||
- Difference relative to x coordinate
|
||||
|
||||
```
|
||||
set xlabel "X"
|
||||
set ylabel "Distance difference"
|
||||
plot 'plot.dat' using 1:5 with dots title "Difference relative to X-coordinate"
|
||||
```
|
||||
|
||||
- Difference relative to y coordinate
|
||||
|
||||
```
|
||||
set xlabel "Y"
|
||||
set ylabel "Distance difference"
|
||||
plot 'plot.dat' using 2:5 with dots title "Difference relative to Y-coordinate"
|
||||
```
|
||||
|
||||
- Difference relative to XY-coordinate
|
||||
|
||||
```
|
||||
set xlabel "X"
|
||||
set ylabel "Y"
|
||||
set zlabel "Distance difference"
|
||||
splot 'plot.dat' using 1:2:5 with dots palette title "Difference relative to XY-coordinate"
|
||||
```
|
||||
|
||||
## Example results
|
||||
|
||||
Example calibration results can be found in the directory [kinect2_bridge/data/](../kinect2_bridge/data).
|
||||
|
||||
The following images were made before and after the calibration, using the kinect2 viewer.
|
||||
- For the superimposed images: `rosrun kinect2_viewer kinect2_viewer hd image`
|
||||
- For the point cloud images: `rosrun kinect2_viewer kinect2_viewer hd cloud`
|
||||
- For the superimposed and point cloud images: `rosrun kinect2_viewer kinect2_viewer hd both`
|
||||
|
||||
raw here stands for raw data transmission aka uncompressed.
|
||||
|
||||
Uncalibrated rectified images (depth and RGB superimposed):
|
||||
![kinect2_cloud_calib](https://ai.uni-bremen.de/_media/kinect2_raw_nocalib.png)
|
||||
|
||||
Calibrated rectified images (depth and RGB superimposed):
|
||||
![kinect2_cloud_calib](https://ai.uni-bremen.de/_media/kinect2_raw_calib.png)
|
||||
|
||||
Uncalibrated depth cloud:
|
||||
![kinect2_cloud_calib](https://ai.uni-bremen.de/_media/kinect2_cloud_nocalib.png)
|
||||
|
||||
Calibrated depth cloud:
|
||||
![kinect2_cloud_calib](https://ai.uni-bremen.de/_media/kinect2_cloud_calib.png)
|
||||
|
||||
Note how the color is now correctly applied on the depth data. This is specially evident around strong edges, like the edge of the white column on the left.
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __KINECT2_CALIBRATION_DEFINITIONS_H__
|
||||
#define __KINECT2_CALIBRATION_DEFINITIONS_H__
|
||||
|
||||
#define CALIB_FILE_EXT ".png"
|
||||
#define CALIB_FILE_COLOR "_color" CALIB_FILE_EXT
|
||||
#define CALIB_FILE_IR "_ir" CALIB_FILE_EXT
|
||||
#define CALIB_FILE_IR_GREY "_grey_ir" CALIB_FILE_EXT
|
||||
#define CALIB_FILE_DEPTH "_depth" CALIB_FILE_EXT
|
||||
|
||||
#define CALIB_POINTS_COLOR "_color_points.yaml"
|
||||
#define CALIB_POINTS_IR "_ir_points.yaml"
|
||||
|
||||
#define CALIB_SYNC "_sync"
|
||||
#define CALIB_SYNC_COLOR CALIB_SYNC CALIB_FILE_COLOR
|
||||
#define CALIB_SYNC_IR CALIB_SYNC CALIB_FILE_IR
|
||||
#define CALIB_SYNC_IR_GREY CALIB_SYNC CALIB_FILE_IR_GREY
|
||||
|
||||
#endif //__KINECT2_CALIBRATION_DEFINITIONS_H__
|
37
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/package.xml
vendored
Normal file
37
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/package.xml
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>kinect2_calibration</name>
|
||||
<version>0.0.1</version>
|
||||
<description>The kinect2_calibration package</description>
|
||||
|
||||
<maintainer email="wiedemeyer@informatik.uni-bremen.de">Thiemo Wiedemeyer</maintainer>
|
||||
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
|
||||
<build_depend>roscpp</build_depend>
|
||||
<build_depend>rostime</build_depend>
|
||||
<build_depend>std_msgs</build_depend>
|
||||
<build_depend>sensor_msgs</build_depend>
|
||||
<build_depend>message_filters</build_depend>
|
||||
<build_depend>image_transport</build_depend>
|
||||
<build_depend>compressed_image_transport</build_depend>
|
||||
<build_depend>compressed_depth_image_transport</build_depend>
|
||||
<build_depend>kinect2_bridge</build_depend>
|
||||
<build_depend>cv_bridge</build_depend><!-- Depend on cv_bridge instead of libopencv-dev to support ROS Hydro.-->
|
||||
|
||||
<run_depend>message_runtime</run_depend>
|
||||
<run_depend>roscpp</run_depend>
|
||||
<run_depend>rostime</run_depend>
|
||||
<run_depend>std_msgs</run_depend>
|
||||
<run_depend>sensor_msgs</run_depend>
|
||||
<run_depend>message_filters</run_depend>
|
||||
<run_depend>image_transport</run_depend>
|
||||
<run_depend>compressed_image_transport</run_depend>
|
||||
<run_depend>compressed_depth_image_transport</run_depend>
|
||||
<run_depend>cv_bridge</run_depend><!-- Depend on cv_bridge instead of libopencv-dev to support ROS Hydro.-->
|
||||
|
||||
<export>
|
||||
</export>
|
||||
</package>
|
1
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/patterns/chess5x7x0.03.pdf
vendored
Normal file
1
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/patterns/chess5x7x0.03.pdf
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
|
280
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/patterns/chess5x7x0.03.svg
vendored
Normal file
280
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/patterns/chess5x7x0.03.svg
vendored
Normal file
|
@ -0,0 +1,280 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="210mm"
|
||||
height="297mm"
|
||||
id="svg3312"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="New document 9">
|
||||
<defs
|
||||
id="defs3" />
|
||||
<sodipodi:namedview
|
||||
inkscape:document-units="mm"
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.98994949"
|
||||
inkscape:cx="411.31764"
|
||||
inkscape:cy="424.03657"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
units="mm"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1141"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3318"
|
||||
empspacing="2"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true"
|
||||
units="mm"
|
||||
spacingx="15mm"
|
||||
spacingy="15mm"
|
||||
originx="5mm"
|
||||
originy="5mm" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g3386">
|
||||
<g
|
||||
id="g3354">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="17.716536"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-7"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="230.31496"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-4"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="442.91339"
|
||||
y="928.34644" />
|
||||
</g>
|
||||
<g
|
||||
id="g3354-9"
|
||||
transform="translate(106.29921,-106.29921)">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-71"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="17.716536"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-7-0"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="230.31496"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-4-8"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="442.91339"
|
||||
y="928.34644" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-212.59842)"
|
||||
id="g3386-7">
|
||||
<g
|
||||
id="g3354-4">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-0"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="17.716536"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-7-9"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="230.31496"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-4-9"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="442.91339"
|
||||
y="928.34644" />
|
||||
</g>
|
||||
<g
|
||||
id="g3354-9-8"
|
||||
transform="translate(106.29921,-106.29921)">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-71-8"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="17.716536"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-7-0-4"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="230.31496"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-4-8-0"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="442.91339"
|
||||
y="928.34644" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516649e-7,-425.19685)"
|
||||
id="g3386-0">
|
||||
<g
|
||||
id="g3354-1">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-2"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="17.716536"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-7-6"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="230.31496"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-4-0"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="442.91339"
|
||||
y="928.34644" />
|
||||
</g>
|
||||
<g
|
||||
id="g3354-9-6"
|
||||
transform="translate(106.29921,-106.29921)">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-71-4"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="17.716536"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-7-0-5"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="230.31496"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-4-8-5"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="442.91339"
|
||||
y="928.34644" />
|
||||
</g>
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516649e-7,-637.79527)"
|
||||
id="g3386-9">
|
||||
<g
|
||||
id="g3354-8">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-1"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="17.716536"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-7-3"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="230.31496"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-4-1"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="442.91339"
|
||||
y="928.34644" />
|
||||
</g>
|
||||
<g
|
||||
id="g3354-9-0"
|
||||
transform="translate(106.29921,-106.29921)">
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-71-7"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="17.716536"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-7-0-40"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="230.31496"
|
||||
y="928.34644" />
|
||||
<rect
|
||||
style="fill:#000000"
|
||||
id="rect3320-4-8-6"
|
||||
width="106.29921"
|
||||
height="106.29921"
|
||||
x="442.91339"
|
||||
y="928.34644" />
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 7.1 KiB |
|
@ -0,0 +1 @@
|
|||
|
368
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/patterns/chess7x9x0.025.svg
vendored
Normal file
368
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/patterns/chess7x9x0.025.svg
vendored
Normal file
|
@ -0,0 +1,368 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="210mm"
|
||||
height="297mm"
|
||||
id="svg3560"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="New document 17">
|
||||
<defs
|
||||
id="defs3" />
|
||||
<sodipodi:namedview
|
||||
inkscape:document-units="mm"
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.98994949"
|
||||
inkscape:cx="533.79419"
|
||||
inkscape:cy="456.02326"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
units="mm"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1141"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3566"
|
||||
empspacing="1"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true"
|
||||
units="mm"
|
||||
originx="5mm"
|
||||
originy="5mm"
|
||||
spacingx="25mm"
|
||||
spacingy="25mm" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata4">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1">
|
||||
<g
|
||||
id="g3584">
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="17.716536"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3568"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="194.8819"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3570"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="372.04724"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3572"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="549.21259"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3574"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="106.29921"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3576"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="283.46457"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3578"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="460.62991"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3580"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="637.79529"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3582"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516649e-7,-177.16538)"
|
||||
id="g3584-5">
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="17.716536"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3568-2"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="194.8819"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3570-7"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="372.04724"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3572-4"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="549.21259"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3574-6"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="106.29921"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3576-7"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="283.46457"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3578-3"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="460.62991"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3580-6"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="637.79529"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3582-5"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-354.33073)"
|
||||
id="g3584-4">
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="17.716536"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3568-28"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="194.8819"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3570-6"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="372.04724"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3572-3"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="549.21259"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3574-0"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="106.29921"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3576-4"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="283.46457"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3578-5"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="460.62991"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3580-8"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="637.79529"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3582-0"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-531.49611)"
|
||||
id="g3584-5-0">
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="17.716536"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3568-2-4"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="194.8819"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3570-7-9"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="372.04724"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3572-4-8"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="549.21259"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3574-6-5"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="106.29921"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3576-7-3"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="283.46457"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3578-3-1"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="460.62991"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3580-6-6"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="637.79529"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3582-5-2"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-708.66144)"
|
||||
id="g3584-5-0-6">
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="17.716536"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3568-2-4-8"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="194.8819"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3570-7-9-1"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="372.04724"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3572-4-8-3"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="946.06299"
|
||||
x="549.21259"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3574-6-5-0"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="106.29921"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3576-7-3-0"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="283.46457"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3578-3-1-0"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="460.62991"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3580-6-6-7"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="857.48029"
|
||||
x="637.79529"
|
||||
height="88.58268"
|
||||
width="88.58268"
|
||||
id="rect3582-5-2-7"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 8.9 KiB |
|
@ -0,0 +1 @@
|
|||
|
540
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/patterns/chess9x11x0.02.svg
vendored
Normal file
540
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/patterns/chess9x11x0.02.svg
vendored
Normal file
|
@ -0,0 +1,540 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="744.09448"
|
||||
height="1052.3622"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="chessboard9x10x20.svg">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.98994949"
|
||||
inkscape:cx="413.79692"
|
||||
inkscape:cy="464.70362"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
units="cm"
|
||||
objecttolerance="20"
|
||||
inkscape:snap-global="false"
|
||||
showguides="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1141"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="27"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3026"
|
||||
empspacing="2"
|
||||
visible="true"
|
||||
enabled="true"
|
||||
snapvisiblegridlinesonly="true"
|
||||
units="mm"
|
||||
spacingx="10mm"
|
||||
spacingy="10mm"
|
||||
originx="5mm"
|
||||
originy="5mm" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,0.00130762)">
|
||||
<g
|
||||
id="g3043">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(70.866142,-70.866143)"
|
||||
id="g3043-1">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-7"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-5"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-5"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-4"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-8"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-141.73228)"
|
||||
id="g3043-8">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-4"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-2"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-1"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-3"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-6"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(70.866142,-212.59843)"
|
||||
id="g3043-3">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-9"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-3"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-8"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-2"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-4"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-283.46457)"
|
||||
id="g3043-4">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-45"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-8"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-7"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-35"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-0"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(70.866142,-354.33071)"
|
||||
id="g3043-6">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-80"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-82"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-2"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-7"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-9"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-425.19685)"
|
||||
id="g3043-9">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-3"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-0"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-9"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-72"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-03"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(70.866142,-496.06299)"
|
||||
id="g3043-0">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-6"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-24"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-6"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-70"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-037"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-566.92913)"
|
||||
id="g3043-00">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-37"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-1"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-96"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-1"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-90"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(70.866142,-637.79528)"
|
||||
id="g3043-5">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-89"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-52"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-94"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-9"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-47"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-1.3516643e-7,-708.66142)"
|
||||
id="g3043-46">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-5"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-7"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-21"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-44"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-3"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(70.866142,-779.52756)"
|
||||
id="g3043-46-6">
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="17.716536"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-5-4"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="159.44882"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-1-7-4"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="301.18109"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-11-21-3"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="442.91339"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-8-44-6"
|
||||
style="fill:#000000" />
|
||||
<rect
|
||||
y="963.7782"
|
||||
x="584.64569"
|
||||
height="70.866142"
|
||||
width="70.866142"
|
||||
id="rect2985-13-3-3"
|
||||
style="fill:#000000" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 13 KiB |
|
@ -0,0 +1,50 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import argparse
|
||||
import numpy as np
|
||||
import os
|
||||
import tempfile
|
||||
import tf
|
||||
import yaml
|
||||
|
||||
def read_calib_pose(fname):
|
||||
tmp = tempfile.TemporaryFile()
|
||||
# we need modify original yaml file because yaml.load(fname) simply will fail
|
||||
with open(fname, "r") as f:
|
||||
reader = f.readlines()
|
||||
for row in reader:
|
||||
if row[0] == "%":
|
||||
# remove first line: "%YAML:1.0"
|
||||
continue
|
||||
if row.find("!!") != -1:
|
||||
# remove "!!opencv-matrix"
|
||||
row = row[:row.find("!!")] + os.linesep
|
||||
tmp.write(row)
|
||||
tmp.seek(0)
|
||||
data = yaml.load(tmp)
|
||||
return data
|
||||
|
||||
def calc_xyz_rpy(data):
|
||||
mat = np.resize(data["rotation"]["data"], (3, 3))
|
||||
xyz = data["translation"]["data"]
|
||||
rpy = tf.transformations.euler_from_matrix(mat)
|
||||
return xyz, rpy
|
||||
|
||||
def print_urdf(xyz, rpy):
|
||||
print("""
|
||||
<joint name=\"kinect2_rgb_joint\" type=\"fixed\">
|
||||
<origin xyz=\"{x} {y} {z}\" rpy=\"{roll} {pitch} {yaw}\"/>
|
||||
<parent link=\"kinect2_rgb_optical_frame\"/>
|
||||
<child link=\"kinect2_ir_optical_frame\"/>
|
||||
</joint>
|
||||
""".format(x=xyz[0], y=xyz[1], z=xyz[2],
|
||||
roll=rpy[0], pitch=rpy[1], yaw=rpy[2]))
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='calculate transform from kinect2_rgb_optical_frame to kinect2_ir_optical_frame')
|
||||
parser.add_argument('-f', type=str, help='path to calib_pose.yaml', metavar='file', required=True)
|
||||
args = parser.parse_args()
|
||||
data = read_calib_pose(args.f)
|
||||
xyz, rpy = calc_xyz_rpy(data)
|
||||
print_urdf(xyz, rpy)
|
1400
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp
vendored
Normal file
1400
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_calibration/src/kinect2_calibration.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
178
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/CMakeLists.txt
vendored
Normal file
178
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,178 @@
|
|||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(kinect2_registration CXX)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBT_USE_DOUBLE_PRECISION -Wall")
|
||||
# Unused warnings
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Winit-self -Wunused-function -Wunused-label -Wunused-variable -Wunused-but-set-variable -Wunused-but-set-parameter")
|
||||
# Additional warnings
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Warray-bounds -Wtype-limits -Wreturn-type -Wsequence-point -Wparentheses -Wmissing-braces -Wchar-subscripts -Wswitch -Wwrite-strings -Wenum-compare -Wempty-body")# -Wlogical-op")
|
||||
|
||||
# Check for c++11 support
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
IF(COMPILER_SUPPORTS_CXX11)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
ELSEIF(COMPILER_SUPPORTS_CXX0X)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
ELSE()
|
||||
MESSAGE(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
ENDIF()
|
||||
|
||||
# additional cmake modules
|
||||
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
|
||||
find_package(catkin REQUIRED COMPONENTS roscpp)
|
||||
find_package(cmake_modules QUIET)
|
||||
|
||||
## System dependencies are found with CMake's conventions
|
||||
find_package(OpenCV REQUIRED)
|
||||
find_package(OpenMP)
|
||||
find_package(Eigen3)
|
||||
find_package(OpenCL)
|
||||
|
||||
if(OPENMP_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
############################################################
|
||||
## Check for modules being build based on found libraries ##
|
||||
############################################################
|
||||
|
||||
if(EIGEN3_FOUND)
|
||||
message(STATUS "CPU based depth registration enabled")
|
||||
include_directories(${EIGEN3_INCLUDE_DIR})
|
||||
set(DEPTH_REG_CPU ON)
|
||||
add_definitions(-DDEPTH_REG_CPU)
|
||||
else()
|
||||
message(STATUS "CPU based depth registration disabled")
|
||||
set(DEPTH_REG_CPU OFF)
|
||||
endif()
|
||||
|
||||
if(OpenCL_FOUND)
|
||||
message(STATUS "OpenCL based depth registration enabled")
|
||||
set(EXPORTED_DEPENDENCIES OpenCL)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
include(CheckOpenCLICDLoader)
|
||||
if(OpenCL_C_WORKS AND NOT OpenCL_CXX_WORKS)
|
||||
set(KINECT2_OPENCL_ICD_LOADER_IS_OLD 1)
|
||||
message(WARNING "Your libOpenCL.so is incompatible with CL/cl.h. Install ocl-icd-opencl-dev to update libOpenCL.so?")
|
||||
endif()
|
||||
endif()
|
||||
include_directories(${OpenCL_INCLUDE_DIRS})
|
||||
|
||||
set(DEPTH_REG_OPENCL ON)
|
||||
add_definitions(-DDEPTH_REG_OPENCL)
|
||||
else()
|
||||
message(STATUS "OpenCL based depth registration disabled")
|
||||
set(DEPTH_REG_OPENCL OFF)
|
||||
endif()
|
||||
|
||||
if(NOT DEPTH_REG_CPU AND NOT DEPTH_REG_OPENCL)
|
||||
message(FATAL_ERROR "No registration method available!")
|
||||
endif()
|
||||
|
||||
################################################
|
||||
## Declare ROS messages, services and actions ##
|
||||
################################################
|
||||
|
||||
###################################
|
||||
## catkin specific configuration ##
|
||||
###################################
|
||||
## The catkin_package macro generates cmake config files for your package
|
||||
## Declare things to be passed to dependent projects
|
||||
## INCLUDE_DIRS: uncomment this if you package contains header files
|
||||
## LIBRARIES: libraries you create in this project that dependent projects also need
|
||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
||||
catkin_package(
|
||||
INCLUDE_DIRS include
|
||||
LIBRARIES kinect2_registration
|
||||
# CATKIN_DEPENDS other_catkin_pkg
|
||||
DEPENDS ${EXPORTED_DEPENDENCIES}
|
||||
CFG_EXTRAS kinect2_registration.cmake
|
||||
)
|
||||
|
||||
###########
|
||||
## Build ##
|
||||
###########
|
||||
|
||||
# Display additional files in qtcreator
|
||||
execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f OUTPUT_VARIABLE FILES_STRING)
|
||||
string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
|
||||
add_custom_target(additional_files_${PROJECT_NAME}
|
||||
SOURCES
|
||||
${FILES_LIST}
|
||||
)
|
||||
|
||||
include_directories(include
|
||||
${catkin_INCLUDE_DIRS}
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/internal"
|
||||
)
|
||||
|
||||
if(DEPTH_REG_CPU)
|
||||
set(MODULES ${MODULES} src/depth_registration_cpu.cpp)
|
||||
endif()
|
||||
|
||||
if(DEPTH_REG_OPENCL)
|
||||
add_definitions(-DREG_OPENCL_FILE="${PROJECT_SOURCE_DIR}/src/depth_registration.cl")
|
||||
set(MODULES ${MODULES} src/depth_registration_opencl.cpp)
|
||||
set(MODULE_LIBS ${MODULE_LIBS} ${OpenCL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_library(kinect2_registration SHARED src/kinect2_registration.cpp ${MODULES})
|
||||
target_link_libraries(kinect2_registration
|
||||
${catkin_LIBRARIES}
|
||||
${OpenCV_LIBRARIES}
|
||||
${MODULE_LIBS}
|
||||
)
|
||||
|
||||
#############
|
||||
## Install ##
|
||||
#############
|
||||
|
||||
# all install targets should use catkin DESTINATION variables
|
||||
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
|
||||
|
||||
## Mark executable scripts (Python etc.) for installation
|
||||
## in contrast to setup.py, you can choose the destination
|
||||
# install(PROGRAMS
|
||||
# scripts/my_python_script
|
||||
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark executables and/or libraries for installation
|
||||
install(TARGETS kinect2_registration
|
||||
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
)
|
||||
|
||||
## Mark cpp header files for installation
|
||||
install(DIRECTORY include/${PROJECT_NAME}/
|
||||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
|
||||
## Mark other files for installation (e.g. launch and bag files, etc.)
|
||||
# install(FILES
|
||||
# # myfile1
|
||||
# # myfile2
|
||||
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
# )
|
||||
|
||||
#############
|
||||
## Testing ##
|
||||
#############
|
||||
|
||||
## Add gtest based cpp test target and link libraries
|
||||
# catkin_add_gtest(${PROJECT_NAME}-test test/test_kinect2_bridge.cpp)
|
||||
# if(TARGET ${PROJECT_NAME}-test)
|
||||
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||
# endif()
|
||||
|
||||
## Add folders to be run by python nosetests
|
||||
# catkin_add_nosetests(test)
|
23
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/README.md
vendored
Normal file
23
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/README.md
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Kinect2 Registration
|
||||
|
||||
## Maintainer
|
||||
|
||||
- [Thiemo Wiedemeyer](https://ai.uni-bremen.de/team/thiemo_wiedemeyer) <<wiedemeyer@cs.uni-bremen.de>>, [Institute for Artificial Intelligence](http://ai.uni-bremen.de/), University of Bremen
|
||||
|
||||
*Note:* ***Please use the GitHub issues*** *for questions and problems regarding the iai_kinect2 package and its components.* ***Do not write emails.***
|
||||
|
||||
## Description
|
||||
|
||||
This is a library for projecting the depth image obtained by Kinect like sensors to a color image. It has a OpenCL implementation for registering the depth image, to reduce CPU load.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- ROS Hydro/Indigo
|
||||
- OpenCV
|
||||
- Eigen (optional, but recommended)
|
||||
- OpenCL (optional, but recommended)
|
||||
|
||||
At least one of OpenCL or Eigen has to be installed. If OpenCL is not installed the CPU will be used. For optimal performance OpenCL is recommended.
|
||||
|
||||
*for the ROS packages look at the package.xml*
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
INCLUDE(CheckCXXSourceCompiles)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
|
||||
SET(CMAKE_REQUIRED_INCLUDES "${MY_DIR}/include/internal" ${OpenCL_INCLUDE_DIRS})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${OpenCL_LIBRARIES})
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <CL/cl.h>
|
||||
int main() {
|
||||
clGetPlatformIDs(0, 0, 0);
|
||||
return 0;
|
||||
}" OpenCL_C_WORKS)
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <CL/cl.hpp>
|
||||
int main() {
|
||||
cl::Context context;
|
||||
cl::Platform platform;
|
||||
cl::Device device;
|
||||
return 0;
|
||||
}" OpenCL_CXX_WORKS)
|
||||
SET(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES)
|
155
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/cmake/FindOpenCL.cmake
vendored
Normal file
155
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/cmake/FindOpenCL.cmake
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
#.rst:
|
||||
# FindOpenCL
|
||||
# ----------
|
||||
#
|
||||
# Try to find OpenCL
|
||||
#
|
||||
# Once done this will define::
|
||||
#
|
||||
# OpenCL_FOUND - True if OpenCL was found
|
||||
# OpenCL_INCLUDE_DIRS - include directories for OpenCL
|
||||
# OpenCL_LIBRARIES - link against this library to use OpenCL
|
||||
# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
|
||||
# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
|
||||
# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation
|
||||
#
|
||||
# The module will also define two cache variables::
|
||||
#
|
||||
# OpenCL_INCLUDE_DIR - the OpenCL include directory
|
||||
# OpenCL_LIBRARY - the path to the OpenCL library
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2014 Matthaeus G. Chajdas
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
# nor the names of their contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
function(_FIND_OPENCL_VERSION)
|
||||
include(CheckSymbolExists)
|
||||
include(CMakePushCheckState)
|
||||
set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
|
||||
|
||||
CMAKE_PUSH_CHECK_STATE()
|
||||
foreach(VERSION "2_0" "1_2" "1_1" "1_0")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
|
||||
|
||||
if(APPLE)
|
||||
CHECK_SYMBOL_EXISTS(
|
||||
CL_VERSION_${VERSION}
|
||||
"${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
|
||||
OPENCL_VERSION_${VERSION})
|
||||
else()
|
||||
CHECK_SYMBOL_EXISTS(
|
||||
CL_VERSION_${VERSION}
|
||||
"${OpenCL_INCLUDE_DIR}/CL/cl.h"
|
||||
OPENCL_VERSION_${VERSION})
|
||||
endif()
|
||||
|
||||
if(OPENCL_VERSION_${VERSION})
|
||||
string(REPLACE "_" "." VERSION "${VERSION}")
|
||||
set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
|
||||
string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
|
||||
list(GET version_components 0 major_version)
|
||||
list(GET version_components 1 minor_version)
|
||||
set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
|
||||
set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
CMAKE_POP_CHECK_STATE()
|
||||
endfunction()
|
||||
|
||||
find_path(OpenCL_INCLUDE_DIR
|
||||
NAMES
|
||||
CL/cl.h OpenCL/cl.h
|
||||
PATHS
|
||||
ENV "PROGRAMFILES(X86)"
|
||||
ENV AMDAPPSDKROOT
|
||||
ENV INTELOCLSDKROOT
|
||||
ENV NVSDKCOMPUTE_ROOT
|
||||
ENV CUDA_PATH
|
||||
ENV ATISTREAMSDKROOT
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
OpenCL/common/inc
|
||||
"AMD APP/include")
|
||||
|
||||
_FIND_OPENCL_VERSION()
|
||||
|
||||
if(WIN32)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
find_library(OpenCL_LIBRARY
|
||||
NAMES OpenCL
|
||||
PATHS
|
||||
ENV "PROGRAMFILES(X86)"
|
||||
ENV AMDAPPSDKROOT
|
||||
ENV INTELOCLSDKROOT
|
||||
ENV CUDA_PATH
|
||||
ENV NVSDKCOMPUTE_ROOT
|
||||
ENV ATISTREAMSDKROOT
|
||||
PATH_SUFFIXES
|
||||
"AMD APP/lib/x86"
|
||||
lib/x86
|
||||
lib/Win32
|
||||
OpenCL/common/lib/Win32)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
find_library(OpenCL_LIBRARY
|
||||
NAMES OpenCL
|
||||
PATHS
|
||||
ENV "PROGRAMFILES(X86)"
|
||||
ENV AMDAPPSDKROOT
|
||||
ENV INTELOCLSDKROOT
|
||||
ENV CUDA_PATH
|
||||
ENV NVSDKCOMPUTE_ROOT
|
||||
ENV ATISTREAMSDKROOT
|
||||
PATH_SUFFIXES
|
||||
"AMD APP/lib/x86_64"
|
||||
lib/x86_64
|
||||
lib/x64
|
||||
OpenCL/common/lib/x64)
|
||||
endif()
|
||||
else()
|
||||
find_library(OpenCL_LIBRARY
|
||||
NAMES OpenCL)
|
||||
endif()
|
||||
|
||||
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
|
||||
set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
OpenCL
|
||||
FOUND_VAR OpenCL_FOUND
|
||||
REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
|
||||
VERSION_VAR OpenCL_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(
|
||||
OpenCL_INCLUDE_DIR
|
||||
OpenCL_LIBRARY)
|
|
@ -0,0 +1,2 @@
|
|||
set(DEPTH_REG_CPU "@DEPTH_REG_CPU@")
|
||||
set(DEPTH_REG_OPENCL "@DEPTH_REG_OPENCL@")
|
12934
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/include/internal/CL/cl.hpp
vendored
Normal file
12934
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/include/internal/CL/cl.hpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* Copyright 2015 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __KINECT2_CONSOLE_H__
|
||||
#define __KINECT2_CONSOLE_H__
|
||||
|
||||
#include <string>
|
||||
#include <ros/console.h>
|
||||
|
||||
// Set this to '0' to disable the extended colored output
|
||||
#define EXTENDED_OUTPUT 1
|
||||
|
||||
#if EXTENDED_OUTPUT
|
||||
|
||||
#define NO_COLOR "\033[0m"
|
||||
#define FG_BLACK "\033[30m"
|
||||
#define FG_RED "\033[31m"
|
||||
#define FG_GREEN "\033[32m"
|
||||
#define FG_YELLOW "\033[33m"
|
||||
#define FG_BLUE "\033[34m"
|
||||
#define FG_MAGENTA "\033[35m"
|
||||
#define FG_CYAN "\033[36m"
|
||||
|
||||
const std::string getFunctionName(const std::string &name);
|
||||
#define OUT_AUX(FUNC_COLOR, MSG_COLOR, STREAM, MSG) STREAM(FUNC_COLOR "[" << getFunctionName(__PRETTY_FUNCTION__) << "] " MSG_COLOR << MSG << NO_COLOR)
|
||||
|
||||
#define OUT_DEBUG(msg) OUT_AUX(FG_BLUE, NO_COLOR, ROS_DEBUG_STREAM, msg)
|
||||
#define OUT_INFO(msg) OUT_AUX(FG_GREEN, NO_COLOR, ROS_INFO_STREAM, msg)
|
||||
#define OUT_WARN(msg) OUT_AUX(FG_YELLOW, FG_YELLOW, ROS_WARN_STREAM, msg)
|
||||
#define OUT_ERROR(msg) OUT_AUX(FG_RED, FG_RED, ROS_ERROR_STREAM, msg)
|
||||
|
||||
#else
|
||||
|
||||
#define NO_COLOR ""
|
||||
#define FG_BLACK ""
|
||||
#define FG_RED ""
|
||||
#define FG_GREEN ""
|
||||
#define FG_YELLOW ""
|
||||
#define FG_BLUE ""
|
||||
#define FG_MAGENTA ""
|
||||
#define FG_CYAN ""
|
||||
|
||||
#define OUT_DEBUG(msg) ROS_DEBUG_STREAM(msg)
|
||||
#define OUT_INFO(msg) ROS_INFO_STREAM(msg)
|
||||
#define OUT_WARN(msg) ROS_WARN_STREAM(msg)
|
||||
#define OUT_ERROR(msg) ROS_WARN_STREAM(msg)
|
||||
|
||||
#endif
|
||||
|
||||
#endif //__KINECT2_CONSOLE_H__
|
|
@ -0,0 +1,57 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __KINECT2_REGISTRATION_H__
|
||||
#define __KINECT2_REGISTRATION_H__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
class DepthRegistration
|
||||
{
|
||||
public:
|
||||
enum Method
|
||||
{
|
||||
DEFAULT = 0,
|
||||
CPU,
|
||||
OPENCL
|
||||
};
|
||||
|
||||
protected:
|
||||
cv::Mat cameraMatrixRegistered, cameraMatrixDepth, rotation, translation, mapX, mapY;
|
||||
cv::Size sizeRegistered, sizeDepth;
|
||||
float zNear, zFar;
|
||||
|
||||
DepthRegistration();
|
||||
|
||||
virtual bool init(const int deviceId) = 0;
|
||||
|
||||
public:
|
||||
virtual ~DepthRegistration();
|
||||
|
||||
bool init(const cv::Mat &cameraMatrixRegistered, const cv::Size &sizeRegistered, const cv::Mat &cameraMatrixDepth, const cv::Size &sizeDepth,
|
||||
const cv::Mat &distortionDepth, const cv::Mat &rotation, const cv::Mat &translation,
|
||||
const float zNear = 0.5f, const float zFar = 12.0f, const int deviceId = -1);
|
||||
|
||||
virtual bool registerDepth(const cv::Mat &depth, cv::Mat ®istered) = 0;
|
||||
|
||||
static DepthRegistration *New(Method method = DEFAULT);
|
||||
};
|
||||
|
||||
#endif //__KINECT2_REGISTRATION_H__
|
21
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/package.xml
vendored
Normal file
21
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/package.xml
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>kinect2_registration</name>
|
||||
<version>0.0.1</version>
|
||||
<description>The kinect2_registration package</description>
|
||||
|
||||
<maintainer email="wiedemeyer@informatik.uni-bremen.de">Thiemo Wiedemeyer</maintainer>
|
||||
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
|
||||
<build_depend>roscpp</build_depend>
|
||||
<build_depend>cv_bridge</build_depend><!-- Depend on cv_bridge instead of libopencv-dev to support ROS Hydro.-->
|
||||
|
||||
<run_depend>roscpp</run_depend>
|
||||
<run_depend>cv_bridge</run_depend><!-- Depend on cv_bridge instead of libopencv-dev to support ROS Hydro.-->
|
||||
|
||||
<export>
|
||||
</export>
|
||||
</package>
|
196
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/depth_registration.cl
vendored
Normal file
196
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/depth_registration.cl
vendored
Normal file
|
@ -0,0 +1,196 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Set render buffer to zero
|
||||
void kernel setZero(global ushort* rendered, global float *selDist){
|
||||
const uint i = get_global_id(0);
|
||||
rendered[i] = 0;
|
||||
selDist[i] = 10;
|
||||
}
|
||||
|
||||
// Calculate 3d point, project them to color camera coordinate system and create rendered depth image
|
||||
void kernel project(global const ushort *depth, global int4 *idx, global ushort *zImg, global float4 *dists, global float *selDist, global ushort *rendered){
|
||||
const uint i = get_global_id(0);
|
||||
|
||||
const int xR = i % widthR;
|
||||
const int yR = i / widthR;
|
||||
|
||||
const ushort d = depth[i];
|
||||
|
||||
// Projection matrix coloumns
|
||||
const float4 projX = (float4)(r00, r01, r02, tx);
|
||||
const float4 projY = (float4)(r10, r11, r12, ty);
|
||||
const float4 projZ = (float4)(r20, r21, r22, tz);
|
||||
|
||||
// Compute 3D point
|
||||
const float z = d / 1000.0f;
|
||||
const float4 point = (float4)((xR - cxR) * fxRInv * z, (yR - cyR) * fyRInv * z, z, 1.0f);
|
||||
|
||||
// Rotate and translate
|
||||
const float3 projected = (float3)(dot(point, projX), dot(point, projY), dot(point, projZ));
|
||||
|
||||
const float invZ = 1.0f / projected.z;
|
||||
|
||||
// Compute projected image coordinates
|
||||
const float x = (fxR * projected.x) * invZ + cxR;
|
||||
const float y = (fyR * projected.y) * invZ + cyR;
|
||||
const short xL = (short)floor(x);
|
||||
const short yL = (short)floor(y);
|
||||
const short xH = xL + 1;
|
||||
const short yH = yL + 1;
|
||||
|
||||
const float4 distXY = (float4)((x - xL) * (x - xL), (xH - x) * (xH - x), (y - yL) * (y - yL), (yH - y) * (yH - y));
|
||||
const float4 dist2 = (float4)(distXY.s0 + distXY.s2, distXY.s1 + distXY.s2, distXY.s0 + distXY.s3, distXY.s1 + distXY.s3);
|
||||
|
||||
const int yLI = yL * widthR;
|
||||
const int yHI = yH * widthR;
|
||||
int4 indices = (int4)(yLI + xL, yLI + xH, yHI + xL, yHI + xH);
|
||||
|
||||
const ushort zI = (ushort)(projected.z * 1000.0f);
|
||||
|
||||
// Check if depth is valid and projection is inside the image
|
||||
if(xL < 0 || xL >= widthR)
|
||||
{
|
||||
indices.s0 = indices.s2 = -1;
|
||||
}
|
||||
if(yL < 0 || yL >= heightR)
|
||||
{
|
||||
indices.s0 = indices.s1 = -1;
|
||||
}
|
||||
if(xH < 0 || xH >= widthR)
|
||||
{
|
||||
indices.s1 = indices.s3 = -1;
|
||||
}
|
||||
if(yH < 0 || yH >= heightR)
|
||||
{
|
||||
indices.s2 = indices.s3 = -1;
|
||||
}
|
||||
if(indices.s0 >= 0)
|
||||
{
|
||||
selDist[indices.s0] = dist2.s0;
|
||||
rendered[indices.s0] = zI;
|
||||
}
|
||||
if(indices.s1 >= 0)
|
||||
{
|
||||
selDist[indices.s1] = dist2.s1;
|
||||
rendered[indices.s1] = zI;
|
||||
}
|
||||
if(indices.s2 >= 0)
|
||||
{
|
||||
selDist[indices.s2] = dist2.s2;
|
||||
rendered[indices.s2] = zI;
|
||||
}
|
||||
if(indices.s3 >= 0)
|
||||
{
|
||||
selDist[indices.s3] = dist2.s3;
|
||||
rendered[indices.s3] = zI;
|
||||
}
|
||||
|
||||
idx[i] = indices;
|
||||
dists[i] = dist2;
|
||||
zImg[i] = zI;
|
||||
}
|
||||
|
||||
// checks and updates registered depth image to make sure nearest depth values are used
|
||||
void kernel checkDepth(global const int4 *idx, global const ushort *zImg, global const float4 *dists, global float *selDist, global ushort *rendered){
|
||||
const uint i = get_global_id(0);
|
||||
|
||||
const int4 index = idx[i];
|
||||
const ushort zI = zImg[i];
|
||||
const ushort thres = 0.01 * zI;
|
||||
const ushort zIThres = zI + thres;
|
||||
const float4 dist2 = dists[i];
|
||||
|
||||
ushort zRen;
|
||||
zRen = rendered[index.s0];
|
||||
if(index.s0 >= 0 && ((abs_diff(zRen, zI) < thres && selDist[index.s0] > dist2.s0) || zRen > zIThres))
|
||||
{
|
||||
selDist[index.s0] = dist2.s0;
|
||||
rendered[index.s0] = zI;
|
||||
}
|
||||
zRen = rendered[index.s1];
|
||||
if(index.s1 >= 0 && ((abs_diff(zRen, zI) < thres && selDist[index.s1] > dist2.s1) || zRen > zIThres))
|
||||
{
|
||||
selDist[index.s1] = dist2.s1;
|
||||
rendered[index.s1] = zI;
|
||||
}
|
||||
zRen = rendered[index.s2];
|
||||
if(index.s2 >= 0 && ((abs_diff(zRen, zI) < thres && selDist[index.s2] > dist2.s2) || zRen > zIThres))
|
||||
{
|
||||
selDist[index.s2] = dist2.s2;
|
||||
rendered[index.s2] = zI;
|
||||
}
|
||||
zRen = rendered[index.s3];
|
||||
if(index.s3 >= 0 && ((abs_diff(zRen, zI) < thres && selDist[index.s3] > dist2.s3) || zRen > zIThres))
|
||||
{
|
||||
selDist[index.s3] = dist2.s3;
|
||||
rendered[index.s3] = zI;
|
||||
}
|
||||
}
|
||||
|
||||
// remap depth image
|
||||
void kernel remapDepth(global const ushort *in, global ushort *out, global const float *mapX, global const float *mapY)
|
||||
{
|
||||
const uint i = get_global_id(0);
|
||||
|
||||
const float x = mapX[i];
|
||||
const float y = mapY[i];
|
||||
const int xL = (int)floor(x);
|
||||
const int xH = xL + 1;
|
||||
const int yL = (int)floor(y);
|
||||
const int yH = yL + 1;
|
||||
|
||||
if(xL < 0 || yL < 0 || xH >= widthD || yH >= heightD)
|
||||
{
|
||||
out[i] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const uint iLT = yL * widthD + xL;
|
||||
const uint iRT = iLT + 1;
|
||||
const uint iLB = iLT + widthD;
|
||||
const uint iRB = iLB + 1;
|
||||
|
||||
const float4 p = (float4)(in[iLT], in[iRT], in[iLB], in[iRB]);
|
||||
int4 valid = isgreaterequal(p, (float4)(1));
|
||||
int count = abs(valid.s0 + valid.s1 + valid.s2 + valid.s3);
|
||||
|
||||
if(count < 3)
|
||||
{
|
||||
out[i] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const float avg = (p.s0 + p.s1 + p.s2 + p.s3) / count;
|
||||
const float thres = 0.01 * avg;
|
||||
valid = isless(fabs(p - avg), (float4)(thres));
|
||||
count = abs(valid.s0 + valid.s1 + valid.s2 + valid.s3);
|
||||
|
||||
if(count < 3)
|
||||
{
|
||||
out[i] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
const float4 distXY = (float4)((x - xL) * (x - xL), (xH - x) * (xH - x), (y - yL) * (y - yL), (yH - y) * (yH - y));
|
||||
const float4 tmp = (float4)(sqrt(2.0));
|
||||
const float4 dist2 = (float4)(distXY.s0 + distXY.s2, distXY.s1 + distXY.s2, distXY.s0 + distXY.s3, distXY.s1 + distXY.s3);
|
||||
const float4 dist = select((float4)(0), tmp - sqrt(dist2), valid);
|
||||
const float sum = dist.s0 + dist.s1 + dist.s2 + dist.s3;
|
||||
|
||||
out[i] = (dot(p, dist) / sum) + 0.5;
|
||||
}
|
203
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/depth_registration_cpu.cpp
vendored
Normal file
203
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/depth_registration_cpu.cpp
vendored
Normal file
|
@ -0,0 +1,203 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "depth_registration_cpu.h"
|
||||
|
||||
DepthRegistrationCPU::DepthRegistrationCPU()
|
||||
: DepthRegistration()
|
||||
{
|
||||
}
|
||||
|
||||
DepthRegistrationCPU::~DepthRegistrationCPU()
|
||||
{
|
||||
}
|
||||
|
||||
bool DepthRegistrationCPU::init(const int deviceId)
|
||||
{
|
||||
createLookup();
|
||||
|
||||
proj(0, 0) = rotation.at<double>(0, 0);
|
||||
proj(0, 1) = rotation.at<double>(0, 1);
|
||||
proj(0, 2) = rotation.at<double>(0, 2);
|
||||
proj(0, 3) = translation.at<double>(0, 0);
|
||||
proj(1, 0) = rotation.at<double>(1, 0);
|
||||
proj(1, 1) = rotation.at<double>(1, 1);
|
||||
proj(1, 2) = rotation.at<double>(1, 2);
|
||||
proj(1, 3) = translation.at<double>(1, 0);
|
||||
proj(2, 0) = rotation.at<double>(2, 0);
|
||||
proj(2, 1) = rotation.at<double>(2, 1);
|
||||
proj(2, 2) = rotation.at<double>(2, 2);
|
||||
proj(2, 3) = translation.at<double>(2, 0);
|
||||
proj(3, 0) = 0;
|
||||
proj(3, 1) = 0;
|
||||
proj(3, 2) = 0;
|
||||
proj(3, 3) = 1;
|
||||
|
||||
fx = cameraMatrixRegistered.at<double>(0, 0);
|
||||
fy = cameraMatrixRegistered.at<double>(1, 1);
|
||||
cx = cameraMatrixRegistered.at<double>(0, 2) + 0.5;
|
||||
cy = cameraMatrixRegistered.at<double>(1, 2) + 0.5;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
inline uint16_t DepthRegistrationCPU::interpolate(const cv::Mat &in, const float &x, const float &y) const
|
||||
{
|
||||
const int xL = (int)floor(x);
|
||||
const int xH = (int)ceil(x);
|
||||
const int yL = (int)floor(y);
|
||||
const int yH = (int)ceil(y);
|
||||
|
||||
if(xL < 0 || yL < 0 || xH >= in.cols || yH >= in.rows)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const uint16_t pLT = in.at<uint16_t>(yL, xL);
|
||||
const uint16_t pRT = in.at<uint16_t>(yL, xH);
|
||||
const uint16_t pLB = in.at<uint16_t>(yH, xL);
|
||||
const uint16_t pRB = in.at<uint16_t>(yH, xH);
|
||||
int vLT = pLT > 0;
|
||||
int vRT = pRT > 0;
|
||||
int vLB = pLB > 0;
|
||||
int vRB = pRB > 0;
|
||||
int count = vLT + vRT + vLB + vRB;
|
||||
|
||||
if(count < 3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
const uint16_t avg = (pLT + pRT + pLB + pRB) / count;
|
||||
const uint16_t thres = 0.01 * avg;
|
||||
vLT = abs(pLT - avg) < thres;
|
||||
vRT = abs(pRT - avg) < thres;
|
||||
vLB = abs(pLB - avg) < thres;
|
||||
vRB = abs(pRB - avg) < thres;
|
||||
count = vLT + vRT + vLB + vRB;
|
||||
|
||||
if(count < 3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double distXL = x - xL;
|
||||
double distXH = 1.0 - distXL;
|
||||
double distYL = y - yL;
|
||||
double distYH = 1.0 - distYL;
|
||||
distXL *= distXL;
|
||||
distXH *= distXH;
|
||||
distYL *= distYL;
|
||||
distYH *= distYH;
|
||||
const double tmp = sqrt(2.0);
|
||||
const double fLT = vLT ? tmp - sqrt(distXL + distYL) : 0;
|
||||
const double fRT = vRT ? tmp - sqrt(distXH + distYL) : 0;
|
||||
const double fLB = vLB ? tmp - sqrt(distXL + distYH) : 0;
|
||||
const double fRB = vRB ? tmp - sqrt(distXH + distYH) : 0;
|
||||
const double sum = fLT + fRT + fLB + fRB;
|
||||
|
||||
return ((pLT * fLT + pRT * fRT + pLB * fLB + pRB * fRB) / sum) + 0.5;
|
||||
}
|
||||
|
||||
void DepthRegistrationCPU::remapDepth(const cv::Mat &depth, cv::Mat &scaled) const
|
||||
{
|
||||
scaled.create(sizeRegistered, CV_16U);
|
||||
#pragma omp parallel for
|
||||
for(size_t r = 0; r < (size_t)sizeRegistered.height; ++r)
|
||||
{
|
||||
uint16_t *itO = scaled.ptr<uint16_t>(r);
|
||||
const float *itX = mapX.ptr<float>(r);
|
||||
const float *itY = mapY.ptr<float>(r);
|
||||
for(size_t c = 0; c < (size_t)sizeRegistered.width; ++c, ++itO, ++itX, ++itY)
|
||||
{
|
||||
*itO = interpolate(depth, *itX, *itY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DepthRegistrationCPU::projectDepth(const cv::Mat &scaled, cv::Mat ®istered) const
|
||||
{
|
||||
registered = cv::Mat::zeros(sizeRegistered, CV_16U);
|
||||
|
||||
#pragma omp parallel for
|
||||
for(size_t r = 0; r < (size_t)sizeRegistered.height; ++r)
|
||||
{
|
||||
const uint16_t *itD = scaled.ptr<uint16_t>(r);
|
||||
const double y = lookupY.at<double>(0, r);
|
||||
const double *itX = lookupX.ptr<double>();
|
||||
|
||||
for(size_t c = 0; c < (size_t)sizeRegistered.width; ++c, ++itD, ++itX)
|
||||
{
|
||||
const double depthValue = *itD / 1000.0;
|
||||
|
||||
if(depthValue < zNear || depthValue > zFar)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Eigen::Vector4d pointD(*itX * depthValue, y * depthValue, depthValue, 1);
|
||||
Eigen::Vector4d pointP = proj * pointD;
|
||||
|
||||
const double z = pointP[2];
|
||||
|
||||
const double invZ = 1 / z;
|
||||
const int xP = (fx * pointP[0]) * invZ + cx;
|
||||
const int yP = (fy * pointP[1]) * invZ + cy;
|
||||
|
||||
if(xP >= 0 && xP < sizeRegistered.width && yP >= 0 && yP < sizeRegistered.height)
|
||||
{
|
||||
const uint16_t z16 = z * 1000;
|
||||
uint16_t &zReg = registered.at<uint16_t>(yP, xP);
|
||||
if(zReg == 0 || z16 < zReg)
|
||||
{
|
||||
zReg = z16;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DepthRegistrationCPU::registerDepth(const cv::Mat &depth, cv::Mat ®istered)
|
||||
{
|
||||
cv::Mat scaled;
|
||||
remapDepth(depth, scaled);
|
||||
projectDepth(scaled, registered);
|
||||
return true;
|
||||
}
|
||||
|
||||
void DepthRegistrationCPU::createLookup()
|
||||
{
|
||||
const double fx = 1.0 / cameraMatrixRegistered.at<double>(0, 0);
|
||||
const double fy = 1.0 / cameraMatrixRegistered.at<double>(1, 1);
|
||||
const double cx = cameraMatrixRegistered.at<double>(0, 2);
|
||||
const double cy = cameraMatrixRegistered.at<double>(1, 2);
|
||||
double *it;
|
||||
|
||||
lookupY = cv::Mat(1, sizeRegistered.height, CV_64F);
|
||||
it = lookupY.ptr<double>();
|
||||
for(size_t r = 0; r < (size_t)sizeRegistered.height; ++r, ++it)
|
||||
{
|
||||
*it = (r - cy) * fy;
|
||||
}
|
||||
|
||||
lookupX = cv::Mat(1, sizeRegistered.width, CV_64F);
|
||||
it = lookupX.ptr<double>();
|
||||
for(size_t c = 0; c < (size_t)sizeRegistered.width; ++c, ++it)
|
||||
{
|
||||
*it = (c - cx) * fx;
|
||||
}
|
||||
}
|
51
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/depth_registration_cpu.h
vendored
Normal file
51
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/depth_registration_cpu.h
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __DEPTH_REGISTRATION_CPU_H__
|
||||
#define __DEPTH_REGISTRATION_CPU_H__
|
||||
|
||||
#include <Eigen/Geometry>
|
||||
|
||||
#include <kinect2_registration/kinect2_registration.h>
|
||||
|
||||
class DepthRegistrationCPU : public DepthRegistration
|
||||
{
|
||||
private:
|
||||
cv::Mat lookupX, lookupY;
|
||||
Eigen::Matrix4d proj;
|
||||
double fx, fy, cx, cy;
|
||||
|
||||
public:
|
||||
DepthRegistrationCPU();
|
||||
|
||||
~DepthRegistrationCPU();
|
||||
|
||||
bool init(const int deviceId);
|
||||
|
||||
bool registerDepth(const cv::Mat &depth, cv::Mat ®istered);
|
||||
|
||||
private:
|
||||
void createLookup();
|
||||
|
||||
uint16_t interpolate(const cv::Mat &in, const float &x, const float &y) const;
|
||||
|
||||
void remapDepth(const cv::Mat &depth, cv::Mat &scaled) const;
|
||||
void projectDepth(const cv::Mat &scaled, cv::Mat ®istered) const;
|
||||
};
|
||||
|
||||
#endif //__DEPTH_REGISTRATION_CPU_H__
|
389
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/depth_registration_opencl.cpp
vendored
Normal file
389
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/depth_registration_opencl.cpp
vendored
Normal file
|
@ -0,0 +1,389 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
|
||||
#include <kinect2_registration/kinect2_console.h>
|
||||
|
||||
#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
|
||||
#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
|
||||
|
||||
#ifdef KINECT2_OPENCL_ICD_LOADER_IS_OLD
|
||||
#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
|
||||
#include <CL/cl.h>
|
||||
#ifdef CL_VERSION_1_2
|
||||
#undef CL_VERSION_1_2
|
||||
#endif //CL_VERSION_1_2
|
||||
#endif //LIBFREENECT2_OPENCL_ICD_LOADER_IS_OLD
|
||||
|
||||
#include <CL/cl.hpp>
|
||||
|
||||
#ifndef REG_OPENCL_FILE
|
||||
#define REG_OPENCL_FILE ""
|
||||
#endif
|
||||
|
||||
#include "depth_registration_opencl.h"
|
||||
|
||||
//#define ENABLE_PROFILING_CL
|
||||
|
||||
#define CL_FILENAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||
#define PRINT_CL_ERROR(expr, err) OUT_ERROR(FG_BLUE "[" << CL_FILENAME << "]" FG_CYAN "(" << __LINE__ << ") " FG_YELLOW << expr << FG_RED " failed: " << err)
|
||||
|
||||
#define CHECK_CL_PARAM(expr) do { cl_int err = CL_SUCCESS; (expr); if (err != CL_SUCCESS) { PRINT_CL_ERROR(#expr, err); return false; } } while(0)
|
||||
#define CHECK_CL_RETURN(expr) do { cl_int err = (expr); if (err != CL_SUCCESS) { PRINT_CL_ERROR(#expr, err); return false; } } while(0)
|
||||
#define CHECK_CL_ON_FAIL(expr, on_fail) do { cl_int err = (expr); if (err != CL_SUCCESS) { PRINT_CL_ERROR(#expr, err); on_fail; return false; } } while(0)
|
||||
|
||||
struct DepthRegistrationOpenCL::OCLData
|
||||
{
|
||||
cl::Context context;
|
||||
cl::Device device;
|
||||
|
||||
cl::Program program;
|
||||
cl::CommandQueue queue;
|
||||
|
||||
cl::Kernel kernelSetZero;
|
||||
cl::Kernel kernelProject;
|
||||
cl::Kernel kernelCheckDepth;
|
||||
cl::Kernel kernelRemap;
|
||||
|
||||
size_t sizeDepth;
|
||||
size_t sizeRegistered;
|
||||
size_t sizeIndex;
|
||||
size_t sizeImgZ;
|
||||
size_t sizeDists;
|
||||
size_t sizeSelDist;
|
||||
size_t sizeMap;
|
||||
|
||||
cl::Buffer bufferDepth;
|
||||
cl::Buffer bufferScaled;
|
||||
cl::Buffer bufferRegistered;
|
||||
cl::Buffer bufferIndex;
|
||||
cl::Buffer bufferImgZ;
|
||||
cl::Buffer bufferDists;
|
||||
cl::Buffer bufferSelDist;
|
||||
cl::Buffer bufferMapX;
|
||||
cl::Buffer bufferMapY;
|
||||
|
||||
cl::Buffer bufferOutput;
|
||||
unsigned char *dataOutput;
|
||||
|
||||
#ifdef ENABLE_PROFILING_CL
|
||||
std::vector<double> timings;
|
||||
int count;
|
||||
#endif
|
||||
};
|
||||
|
||||
DepthRegistrationOpenCL::DepthRegistrationOpenCL()
|
||||
: DepthRegistration()
|
||||
{
|
||||
data = new OCLData;
|
||||
}
|
||||
|
||||
DepthRegistrationOpenCL::~DepthRegistrationOpenCL()
|
||||
{
|
||||
delete data;
|
||||
}
|
||||
|
||||
void getDevices(const std::vector<cl::Platform> &platforms, std::vector<cl::Device> &devices)
|
||||
{
|
||||
devices.clear();
|
||||
for(size_t i = 0; i < platforms.size(); ++i)
|
||||
{
|
||||
const cl::Platform &platform = platforms[i];
|
||||
|
||||
std::vector<cl::Device> devs;
|
||||
if(platform.getDevices(CL_DEVICE_TYPE_ALL, &devs) != CL_SUCCESS)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
devices.insert(devices.end(), devs.begin(), devs.end());
|
||||
}
|
||||
}
|
||||
|
||||
std::string deviceString(cl::Device &dev)
|
||||
{
|
||||
std::string devName, devVendor, devType;
|
||||
cl_device_type devTypeID;
|
||||
dev.getInfo(CL_DEVICE_NAME, &devName);
|
||||
dev.getInfo(CL_DEVICE_VENDOR, &devVendor);
|
||||
dev.getInfo(CL_DEVICE_TYPE, &devTypeID);
|
||||
|
||||
switch(devTypeID)
|
||||
{
|
||||
case CL_DEVICE_TYPE_CPU:
|
||||
devType = "CPU";
|
||||
break;
|
||||
case CL_DEVICE_TYPE_GPU:
|
||||
devType = "GPU";
|
||||
break;
|
||||
case CL_DEVICE_TYPE_ACCELERATOR:
|
||||
devType = "ACCELERATOR";
|
||||
break;
|
||||
default:
|
||||
devType = "CUSTOM/UNKNOWN";
|
||||
}
|
||||
|
||||
return devName + " (" + devType + ")[" + devVendor + ']';
|
||||
}
|
||||
|
||||
bool selectDevice(std::vector<cl::Device> &devices, cl::Device &device, const int deviceId = -1)
|
||||
{
|
||||
if(deviceId != -1 && devices.size() > (size_t)deviceId)
|
||||
{
|
||||
device = devices[deviceId];
|
||||
return true;
|
||||
}
|
||||
|
||||
bool selected = false;
|
||||
cl_device_type selectedType = 0;
|
||||
|
||||
for(size_t i = 0; i < devices.size(); ++i)
|
||||
{
|
||||
cl::Device &dev = devices[i];
|
||||
cl_device_type devTypeID;
|
||||
dev.getInfo(CL_DEVICE_TYPE, &devTypeID);
|
||||
|
||||
if(!selected || (selectedType != CL_DEVICE_TYPE_GPU && devTypeID == CL_DEVICE_TYPE_GPU))
|
||||
{
|
||||
selectedType = devTypeID;
|
||||
selected = true;
|
||||
device = dev;
|
||||
}
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
|
||||
bool DepthRegistrationOpenCL::init(const int deviceId)
|
||||
{
|
||||
std::string sourceCode;
|
||||
if(!readProgram(sourceCode))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<cl::Platform> platforms;
|
||||
CHECK_CL_RETURN(cl::Platform::get(&platforms));
|
||||
|
||||
if(platforms.empty())
|
||||
{
|
||||
OUT_ERROR("no opencl platforms found.");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<cl::Device> devices;
|
||||
getDevices(platforms, devices);
|
||||
|
||||
OUT_INFO("devices:");
|
||||
for(size_t i = 0; i < devices.size(); ++i)
|
||||
{
|
||||
OUT_INFO(" " << i << ": " FG_CYAN << deviceString(devices[i]) << NO_COLOR);
|
||||
}
|
||||
|
||||
if(!selectDevice(devices, data->device, deviceId))
|
||||
{
|
||||
OUT_ERROR("could not find any suitable device");
|
||||
return false;
|
||||
}
|
||||
OUT_INFO("selected device: " FG_YELLOW << deviceString(data->device) << NO_COLOR);
|
||||
|
||||
CHECK_CL_PARAM(data->context = cl::Context(data->device, NULL, NULL, NULL, &err));
|
||||
|
||||
std::string options;
|
||||
generateOptions(options);
|
||||
|
||||
cl::Program::Sources source(1, std::make_pair(sourceCode.c_str(), sourceCode.length()));
|
||||
CHECK_CL_PARAM(data->program = cl::Program(data->context, source, &err));
|
||||
|
||||
CHECK_CL_ON_FAIL(data->program.build(options.c_str()),
|
||||
OUT_ERROR("failed to build program: " << err);
|
||||
OUT_ERROR("Build Status: " << data->program.getBuildInfo<CL_PROGRAM_BUILD_STATUS>(data->device));
|
||||
OUT_ERROR("Build Options:\t" << data->program.getBuildInfo<CL_PROGRAM_BUILD_OPTIONS>(data->device));
|
||||
OUT_ERROR("Build Log:\t " << data->program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(data->device)));
|
||||
|
||||
#ifdef ENABLE_PROFILING_CL
|
||||
data->count = 0;
|
||||
CHECK_CL_PARAM(data->queue = cl::CommandQueue(data->context, data->device, CL_QUEUE_PROFILING_ENABLE, &err));
|
||||
#else
|
||||
CHECK_CL_PARAM(data->queue = cl::CommandQueue(data->context, data->device, 0, &err));
|
||||
#endif
|
||||
|
||||
data->sizeDepth = sizeDepth.height * sizeDepth.width * sizeof(uint16_t);
|
||||
data->sizeRegistered = sizeRegistered.height * sizeRegistered.width * sizeof(uint16_t);
|
||||
data->sizeIndex = sizeRegistered.height * sizeRegistered.width * sizeof(cl_int4);
|
||||
data->sizeImgZ = sizeRegistered.height * sizeRegistered.width * sizeof(uint16_t);
|
||||
data->sizeDists = sizeRegistered.height * sizeRegistered.width * sizeof(cl_float4);
|
||||
data->sizeSelDist = sizeRegistered.height * sizeRegistered.width * sizeof(float);
|
||||
data->sizeMap = sizeRegistered.height * sizeRegistered.width * sizeof(float);
|
||||
|
||||
CHECK_CL_PARAM(data->bufferDepth = cl::Buffer(data->context, CL_MEM_READ_ONLY, data->sizeDepth, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferScaled = cl::Buffer(data->context, CL_MEM_READ_WRITE, data->sizeRegistered, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferRegistered = cl::Buffer(data->context, CL_MEM_READ_WRITE, data->sizeRegistered, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferIndex = cl::Buffer(data->context, CL_MEM_READ_WRITE, data->sizeIndex, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferImgZ = cl::Buffer(data->context, CL_MEM_READ_WRITE, data->sizeImgZ, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferDists = cl::Buffer(data->context, CL_MEM_READ_WRITE, data->sizeDists, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferSelDist = cl::Buffer(data->context, CL_MEM_READ_WRITE, data->sizeSelDist, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferMapX = cl::Buffer(data->context, CL_MEM_READ_ONLY, data->sizeMap, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferMapY = cl::Buffer(data->context, CL_MEM_READ_ONLY, data->sizeMap, NULL, &err));
|
||||
CHECK_CL_PARAM(data->bufferOutput = cl::Buffer(data->context, CL_MEM_WRITE_ONLY | CL_MEM_ALLOC_HOST_PTR, data->sizeRegistered, NULL, &err));
|
||||
|
||||
CHECK_CL_PARAM(data->kernelSetZero = cl::Kernel(data->program, "setZero", &err));
|
||||
CHECK_CL_RETURN(data->kernelSetZero.setArg(0, data->bufferRegistered));
|
||||
CHECK_CL_RETURN(data->kernelSetZero.setArg(1, data->bufferSelDist));
|
||||
|
||||
CHECK_CL_PARAM(data->kernelProject = cl::Kernel(data->program, "project", &err));
|
||||
CHECK_CL_RETURN(data->kernelProject.setArg(0, data->bufferScaled));
|
||||
CHECK_CL_RETURN(data->kernelProject.setArg(1, data->bufferIndex));
|
||||
CHECK_CL_RETURN(data->kernelProject.setArg(2, data->bufferImgZ));
|
||||
CHECK_CL_RETURN(data->kernelProject.setArg(3, data->bufferDists));
|
||||
CHECK_CL_RETURN(data->kernelProject.setArg(4, data->bufferSelDist));
|
||||
CHECK_CL_RETURN(data->kernelProject.setArg(5, data->bufferRegistered));
|
||||
|
||||
CHECK_CL_PARAM(data->kernelCheckDepth = cl::Kernel(data->program, "checkDepth", &err));
|
||||
CHECK_CL_RETURN(data->kernelCheckDepth.setArg(0, data->bufferIndex));
|
||||
CHECK_CL_RETURN(data->kernelCheckDepth.setArg(1, data->bufferImgZ));
|
||||
CHECK_CL_RETURN(data->kernelCheckDepth.setArg(2, data->bufferDists));
|
||||
CHECK_CL_RETURN(data->kernelCheckDepth.setArg(3, data->bufferSelDist));
|
||||
CHECK_CL_RETURN(data->kernelCheckDepth.setArg(4, data->bufferRegistered));
|
||||
|
||||
CHECK_CL_PARAM(data->kernelRemap = cl::Kernel(data->program, "remapDepth", &err));
|
||||
CHECK_CL_RETURN(data->kernelRemap.setArg(0, data->bufferDepth));
|
||||
CHECK_CL_RETURN(data->kernelRemap.setArg(1, data->bufferScaled));
|
||||
CHECK_CL_RETURN(data->kernelRemap.setArg(2, data->bufferMapX));
|
||||
CHECK_CL_RETURN(data->kernelRemap.setArg(3, data->bufferMapY));
|
||||
|
||||
CHECK_CL_RETURN(data->queue.enqueueWriteBuffer(data->bufferMapX, CL_TRUE, 0, data->sizeMap, mapX.data));
|
||||
CHECK_CL_RETURN(data->queue.enqueueWriteBuffer(data->bufferMapY, CL_TRUE, 0, data->sizeMap, mapY.data));
|
||||
|
||||
CHECK_CL_PARAM(data->dataOutput = (unsigned char *)data->queue.enqueueMapBuffer(data->bufferOutput, CL_TRUE, CL_MAP_READ, 0, data->sizeRegistered, NULL, NULL, &err));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DepthRegistrationOpenCL::registerDepth(const cv::Mat &depth, cv::Mat ®istered)
|
||||
{
|
||||
cl::Event eventRead;
|
||||
std::vector<cl::Event> eventZero(2), eventRemap(1), eventProject(1), eventCheckDepth1(1), eventCheckDepth2(1);
|
||||
cl::NDRange range(sizeRegistered.height * sizeRegistered.width);
|
||||
|
||||
CHECK_CL_RETURN(data->queue.enqueueWriteBuffer(data->bufferDepth, CL_FALSE, 0, data->sizeDepth, depth.data, NULL, &eventZero[0]));
|
||||
CHECK_CL_RETURN(data->queue.enqueueNDRangeKernel(data->kernelSetZero, cl::NullRange, range, cl::NullRange, NULL, &eventZero[1]));
|
||||
|
||||
CHECK_CL_RETURN(data->queue.enqueueNDRangeKernel(data->kernelRemap, cl::NullRange, range, cl::NullRange, &eventZero, &eventRemap[0]));
|
||||
|
||||
CHECK_CL_RETURN(data->queue.enqueueNDRangeKernel(data->kernelProject, cl::NullRange, range, cl::NullRange, &eventRemap, &eventProject[0]));
|
||||
|
||||
CHECK_CL_RETURN(data->queue.enqueueNDRangeKernel(data->kernelCheckDepth, cl::NullRange, range, cl::NullRange, &eventProject, &eventCheckDepth1[0]));
|
||||
|
||||
CHECK_CL_RETURN(data->queue.enqueueNDRangeKernel(data->kernelCheckDepth, cl::NullRange, range, cl::NullRange, &eventCheckDepth1, &eventCheckDepth2[0]));
|
||||
|
||||
CHECK_CL_RETURN(data->queue.enqueueReadBuffer(data->bufferRegistered, CL_FALSE, 0, data->sizeRegistered, data->dataOutput, &eventCheckDepth2, &eventRead));
|
||||
|
||||
CHECK_CL_RETURN(eventRead.wait());
|
||||
|
||||
registered = cv::Mat(sizeRegistered, CV_16U, data->dataOutput);
|
||||
|
||||
#ifdef ENABLE_PROFILING_CL
|
||||
if(data->count == 0)
|
||||
{
|
||||
data->timings.clear();
|
||||
data->timings.resize(7, 0.0);
|
||||
}
|
||||
|
||||
data->timings[0] += eventZero[0].getProfilingInfo<CL_PROFILING_COMMAND_END>() - eventZero[0].getProfilingInfo<CL_PROFILING_COMMAND_START>();
|
||||
data->timings[1] += eventZero[1].getProfilingInfo<CL_PROFILING_COMMAND_END>() - eventZero[1].getProfilingInfo<CL_PROFILING_COMMAND_START>();
|
||||
data->timings[2] += eventRemap[0].getProfilingInfo<CL_PROFILING_COMMAND_END>() - eventRemap[0].getProfilingInfo<CL_PROFILING_COMMAND_START>();
|
||||
data->timings[3] += eventProject[0].getProfilingInfo<CL_PROFILING_COMMAND_END>() - eventProject[0].getProfilingInfo<CL_PROFILING_COMMAND_START>();
|
||||
data->timings[4] += eventCheckDepth1[0].getProfilingInfo<CL_PROFILING_COMMAND_END>() - eventCheckDepth1[0].getProfilingInfo<CL_PROFILING_COMMAND_START>();
|
||||
data->timings[5] += eventCheckDepth2[0].getProfilingInfo<CL_PROFILING_COMMAND_END>() - eventCheckDepth2[0].getProfilingInfo<CL_PROFILING_COMMAND_START>();
|
||||
data->timings[6] += eventRead.getProfilingInfo<CL_PROFILING_COMMAND_END>() - eventRead.getProfilingInfo<CL_PROFILING_COMMAND_START>();
|
||||
|
||||
if(++data->count == 100)
|
||||
{
|
||||
double sum = data->timings[0] + data->timings[1] + data->timings[2] + data->timings[3] + data->timings[4] + data->timings[5] + data->timings[6];
|
||||
OUT_INFO("writing depth: " << data->timings[0] / 100000000.0 << " ms.");
|
||||
OUT_INFO("setting zero: " << data->timings[1] / 100000000.0 << " ms.");
|
||||
OUT_INFO("remap: " << data->timings[2] / 100000000.0 << " ms.");
|
||||
OUT_INFO("project: " << data->timings[3] / 100000000.0 << " ms.");
|
||||
OUT_INFO("check depth 1: " << data->timings[4] / 100000000.0 << " ms.");
|
||||
OUT_INFO("check depth 2: " << data->timings[5] / 100000000.0 << " ms.");
|
||||
OUT_INFO("read registered: " << data->timings[6] / 100000000.0 << " ms.");
|
||||
OUT_INFO("overall: " << sum / 100000000.0 << " ms.");
|
||||
data->count = 0;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
void DepthRegistrationOpenCL::generateOptions(std::string &options) const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss.precision(16);
|
||||
oss << std::scientific;
|
||||
|
||||
// Rotation
|
||||
oss << " -D r00=" << rotation.at<double>(0, 0) << "f";
|
||||
oss << " -D r01=" << rotation.at<double>(0, 1) << "f";
|
||||
oss << " -D r02=" << rotation.at<double>(0, 2) << "f";
|
||||
oss << " -D r10=" << rotation.at<double>(1, 0) << "f";
|
||||
oss << " -D r11=" << rotation.at<double>(1, 1) << "f";
|
||||
oss << " -D r12=" << rotation.at<double>(1, 2) << "f";
|
||||
oss << " -D r20=" << rotation.at<double>(2, 0) << "f";
|
||||
oss << " -D r21=" << rotation.at<double>(2, 1) << "f";
|
||||
oss << " -D r22=" << rotation.at<double>(2, 2) << "f";
|
||||
|
||||
// Translation
|
||||
oss << " -D tx=" << translation.at<double>(0, 0) << "f";
|
||||
oss << " -D ty=" << translation.at<double>(1, 0) << "f";
|
||||
oss << " -D tz=" << translation.at<double>(2, 0) << "f";
|
||||
|
||||
// Camera parameter upscaled depth
|
||||
oss << " -D fxR=" << cameraMatrixRegistered.at<double>(0, 0) << "f";
|
||||
oss << " -D fyR=" << cameraMatrixRegistered.at<double>(1, 1) << "f";
|
||||
oss << " -D cxR=" << cameraMatrixRegistered.at<double>(0, 2) << "f";
|
||||
oss << " -D cyR=" << cameraMatrixRegistered.at<double>(1, 2) << "f";
|
||||
oss << " -D fxRInv=" << (1.0 / cameraMatrixRegistered.at<double>(0, 0)) << "f";
|
||||
oss << " -D fyRInv=" << (1.0 / cameraMatrixRegistered.at<double>(1, 1)) << "f";
|
||||
|
||||
// Clipping distances
|
||||
oss << " -D zNear=" << (uint16_t)(zNear * 1000);
|
||||
oss << " -D zFar=" << (uint16_t)(zFar * 1000);
|
||||
|
||||
// Size registered image
|
||||
oss << " -D heightR=" << sizeRegistered.height;
|
||||
oss << " -D widthR=" << sizeRegistered.width;
|
||||
|
||||
// Size depth image
|
||||
oss << " -D heightD=" << sizeDepth.height;
|
||||
oss << " -D widthD=" << sizeDepth.width;
|
||||
|
||||
options = oss.str();
|
||||
}
|
||||
|
||||
bool DepthRegistrationOpenCL::readProgram(std::string &source) const
|
||||
{
|
||||
std::ifstream file(REG_OPENCL_FILE);
|
||||
|
||||
if(!file.is_open())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
source = std::string((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||
file.close();
|
||||
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __DEPTH_REGISTRATION_OPENCL_H__
|
||||
#define __DEPTH_REGISTRATION_OPENCL_H__
|
||||
|
||||
#include <kinect2_registration/kinect2_registration.h>
|
||||
|
||||
class DepthRegistrationOpenCL : public DepthRegistration
|
||||
{
|
||||
private:
|
||||
struct OCLData;
|
||||
|
||||
OCLData *data;
|
||||
|
||||
public:
|
||||
DepthRegistrationOpenCL();
|
||||
|
||||
~DepthRegistrationOpenCL();
|
||||
|
||||
bool init(const int deviceId);
|
||||
|
||||
bool registerDepth(const cv::Mat &depth, cv::Mat ®istered);
|
||||
|
||||
private:
|
||||
void generateOptions(std::string &options) const;
|
||||
|
||||
bool readProgram(std::string &source) const;
|
||||
};
|
||||
|
||||
#endif //__DEPTH_REGISTRATION_OPENCL_H__
|
101
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/kinect2_registration.cpp
vendored
Normal file
101
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_registration/src/kinect2_registration.cpp
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <kinect2_registration/kinect2_registration.h>
|
||||
#include <kinect2_registration/kinect2_console.h>
|
||||
|
||||
#ifdef DEPTH_REG_CPU
|
||||
#include "depth_registration_cpu.h"
|
||||
#endif
|
||||
|
||||
#ifdef DEPTH_REG_OPENCL
|
||||
#include "depth_registration_opencl.h"
|
||||
#endif
|
||||
|
||||
DepthRegistration::DepthRegistration()
|
||||
{
|
||||
}
|
||||
|
||||
DepthRegistration::~DepthRegistration()
|
||||
{
|
||||
}
|
||||
|
||||
bool DepthRegistration::init(const cv::Mat &cameraMatrixRegistered, const cv::Size &sizeRegistered, const cv::Mat &cameraMatrixDepth, const cv::Size &sizeDepth,
|
||||
const cv::Mat &distortionDepth, const cv::Mat &rotation, const cv::Mat &translation,
|
||||
const float zNear, const float zFar, const int deviceId)
|
||||
{
|
||||
this->cameraMatrixRegistered = cameraMatrixRegistered;
|
||||
this->cameraMatrixDepth = cameraMatrixDepth;
|
||||
this->rotation = rotation;
|
||||
this->translation = translation;
|
||||
this->sizeRegistered = sizeRegistered;
|
||||
this->sizeDepth = sizeDepth;
|
||||
this->zNear = zNear;
|
||||
this->zFar = zFar;
|
||||
|
||||
cv::initUndistortRectifyMap(cameraMatrixDepth, distortionDepth, cv::Mat(), cameraMatrixRegistered, sizeRegistered, CV_32FC1, mapX, mapY);
|
||||
|
||||
return init(deviceId);
|
||||
}
|
||||
|
||||
DepthRegistration *DepthRegistration::New(Method method)
|
||||
{
|
||||
if(method == DEFAULT)
|
||||
{
|
||||
#ifdef DEPTH_REG_OPENCL
|
||||
method = OPENCL;
|
||||
#elif defined DEPTH_REG_CPU
|
||||
method = CPU;
|
||||
#endif
|
||||
}
|
||||
|
||||
switch(method)
|
||||
{
|
||||
case DEFAULT:
|
||||
OUT_ERROR("No default registration method available!");
|
||||
break;
|
||||
case CPU:
|
||||
#ifdef DEPTH_REG_CPU
|
||||
OUT_INFO("Using CPU registration method!");
|
||||
return new DepthRegistrationCPU();
|
||||
#else
|
||||
OUT_ERROR("CPU registration method not available!");
|
||||
break;
|
||||
#endif
|
||||
case OPENCL:
|
||||
#ifdef DEPTH_REG_OPENCL
|
||||
OUT_INFO("Using OpenCL registration method!");
|
||||
return new DepthRegistrationOpenCL();
|
||||
#else
|
||||
OUT_ERROR("OpenCL registration method not available!");
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
const std::string getFunctionName(const std::string &name)
|
||||
{
|
||||
size_t end = name.rfind('(');
|
||||
if(end == std::string::npos)
|
||||
{
|
||||
end = name.size();
|
||||
}
|
||||
size_t begin = 1 + name.rfind(' ', end);
|
||||
return name.substr(begin, end - begin);
|
||||
}
|
126
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_viewer/CMakeLists.txt
vendored
Normal file
126
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_viewer/CMakeLists.txt
vendored
Normal file
|
@ -0,0 +1,126 @@
|
|||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(kinect2_viewer CXX)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBT_USE_DOUBLE_PRECISION -Wall")
|
||||
# Unused warnings
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized -Winit-self -Wunused-function -Wunused-label -Wunused-variable -Wunused-but-set-variable -Wunused-but-set-parameter")
|
||||
# Additional warnings
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Warray-bounds -Wtype-limits -Wreturn-type -Wsequence-point -Wparentheses -Wmissing-braces -Wchar-subscripts -Wswitch -Wwrite-strings -Wenum-compare -Wempty-body -Wlogical-op")
|
||||
|
||||
# Check for c++11 support
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
IF(COMPILER_SUPPORTS_CXX11)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
ELSEIF(COMPILER_SUPPORTS_CXX0X)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
ELSE()
|
||||
MESSAGE(ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
ENDIF()
|
||||
|
||||
find_package(catkin REQUIRED COMPONENTS roscpp rostime std_msgs sensor_msgs message_filters cv_bridge image_transport compressed_image_transport compressed_depth_image_transport kinect2_bridge)
|
||||
|
||||
## System dependencies are found with CMake's conventions
|
||||
find_package(OpenCV REQUIRED)
|
||||
find_package(OpenMP)
|
||||
find_package(PCL REQUIRED)
|
||||
|
||||
if(OPENMP_FOUND)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
endif()
|
||||
|
||||
################################################
|
||||
## Declare ROS messages, services and actions ##
|
||||
################################################
|
||||
|
||||
###################################
|
||||
## catkin specific configuration ##
|
||||
###################################
|
||||
## The catkin_package macro generates cmake config files for your package
|
||||
## Declare things to be passed to dependent projects
|
||||
## INCLUDE_DIRS: uncomment this if you package contains header files
|
||||
## LIBRARIES: libraries you create in this project that dependent projects also need
|
||||
## CATKIN_DEPENDS: catkin_packages dependent projects also need
|
||||
## DEPENDS: system dependencies of this project that dependent projects also need
|
||||
catkin_package(
|
||||
# INCLUDE_DIRS include
|
||||
# LIBRARIES kinect2_viewer
|
||||
# CATKIN_DEPENDS other_catkin_pkg
|
||||
# DEPENDS system_lib
|
||||
)
|
||||
|
||||
###########
|
||||
## Build ##
|
||||
###########
|
||||
|
||||
# Display additional files in qtcreator
|
||||
execute_process(COMMAND find ${PROJECT_SOURCE_DIR} -type f OUTPUT_VARIABLE FILES_STRING)
|
||||
string(REPLACE "\n" ";" FILES_LIST ${FILES_STRING})
|
||||
add_custom_target(additional_files_${PROJECT_NAME}
|
||||
SOURCES
|
||||
${FILES_LIST}
|
||||
)
|
||||
|
||||
include_directories(include
|
||||
${catkin_INCLUDE_DIRS}
|
||||
${OpenCV_INCLUDE_DIRS}
|
||||
${PCL_INCLUDE_DIRS}
|
||||
${kinect2_bridge_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
add_executable(kinect2_viewer src/viewer.cpp)
|
||||
target_link_libraries(kinect2_viewer
|
||||
${catkin_LIBRARIES}
|
||||
${OpenCV_LIBRARIES}
|
||||
${PCL_LIBRARIES}
|
||||
${kinect2_bridge_LIBRARIES}
|
||||
)
|
||||
|
||||
#############
|
||||
## Install ##
|
||||
#############
|
||||
|
||||
# all install targets should use catkin DESTINATION variables
|
||||
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
|
||||
|
||||
## Mark executable scripts (Python etc.) for installation
|
||||
## in contrast to setup.py, you can choose the destination
|
||||
# install(PROGRAMS
|
||||
# scripts/my_python_script
|
||||
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
# )
|
||||
|
||||
## Mark executables and/or libraries for installation
|
||||
install(TARGETS kinect2_viewer
|
||||
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
|
||||
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||
)
|
||||
|
||||
## Mark cpp header files for installation
|
||||
# install(DIRECTORY include/${PROJECT_NAME}/
|
||||
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
# FILES_MATCHING PATTERN "*.h"
|
||||
# PATTERN ".svn" EXCLUDE
|
||||
# )
|
||||
|
||||
## Mark other files for installation (e.g. launch and bag files, etc.)
|
||||
# install(FILES
|
||||
# # myfile1
|
||||
# # myfile2
|
||||
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
# )
|
||||
|
||||
#############
|
||||
## Testing ##
|
||||
#############
|
||||
|
||||
## Add gtest based cpp test target and link libraries
|
||||
# catkin_add_gtest(${PROJECT_NAME}-test test/test_kinect2_bridge.cpp)
|
||||
# if(TARGET ${PROJECT_NAME}-test)
|
||||
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
|
||||
# endif()
|
||||
|
||||
## Add folders to be run by python nosetests
|
||||
# catkin_add_nosetests(test)
|
|
@ -0,0 +1,44 @@
|
|||
# Kinect2 Viewer
|
||||
|
||||
## Maintainer
|
||||
|
||||
- [Thiemo Wiedemeyer](https://ai.uni-bremen.de/team/thiemo_wiedemeyer) <<wiedemeyer@cs.uni-bremen.de>>, [Institute for Artificial Intelligence](http://ai.uni-bremen.de/), University of Bremen
|
||||
|
||||
*Note:* ***Please use the GitHub issues*** *for questions and problems regarding the iai_kinect2 package and its components.* ***Do not write emails.***
|
||||
|
||||
## Description
|
||||
|
||||
This is a simple viewer for the combined color an depth image provided by Kinect like depth sensors.
|
||||
|
||||
It just listens to two ROS topics and displays a the color with the overlayed colored depth image or a registered point cloud.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- ROS Hydro/Indigo
|
||||
- OpenCV
|
||||
- PCL
|
||||
|
||||
*for the ROS packages look at the package.xml*
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
kinect2_viewer [options]
|
||||
name: 'any string' equals to the kinect2_bridge topic base name
|
||||
mode: 'qhd', 'hd', 'sd' or 'ir'
|
||||
visualization: 'image', 'cloud' or 'both'
|
||||
options:
|
||||
'compressed' use compressed instead of raw topics
|
||||
'approx' use approximate time synchronization
|
||||
```
|
||||
|
||||
Example: `rosrun kinect2_viewer kinect2_viewer sd cloud`
|
||||
|
||||
## Key bindings
|
||||
|
||||
Windows:
|
||||
- `ESC`, `q`: Quit
|
||||
- `SPACE`, `s`: Save the current image, cloud in the current directory
|
||||
|
||||
Terminal:
|
||||
- `CRTL`+`c`: Quit
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0"?>
|
||||
<package>
|
||||
<name>kinect2_viewer</name>
|
||||
<version>0.0.1</version>
|
||||
<description>The kinect2_viewer package</description>
|
||||
|
||||
<maintainer email="wiedemeyer@informatik.uni-bremen.de">Thiemo Wiedemeyer</maintainer>
|
||||
|
||||
<license>Apache 2.0</license>
|
||||
|
||||
<buildtool_depend>catkin</buildtool_depend>
|
||||
|
||||
<build_depend>roscpp</build_depend>
|
||||
<build_depend>rostime</build_depend>
|
||||
<build_depend>std_msgs</build_depend>
|
||||
<build_depend>sensor_msgs</build_depend>
|
||||
<build_depend>message_filters</build_depend>
|
||||
<build_depend>image_transport</build_depend>
|
||||
<build_depend>compressed_image_transport</build_depend>
|
||||
<build_depend>compressed_depth_image_transport</build_depend>
|
||||
<build_depend>kinect2_bridge</build_depend>
|
||||
<build_depend>libpcl-all-dev</build_depend>
|
||||
<build_depend>cv_bridge</build_depend><!-- Depend on cv_bridge instead of libopencv-dev to support ROS Hydro.-->
|
||||
|
||||
<run_depend>message_runtime</run_depend>
|
||||
<run_depend>roscpp</run_depend>
|
||||
<run_depend>rostime</run_depend>
|
||||
<run_depend>std_msgs</run_depend>
|
||||
<run_depend>sensor_msgs</run_depend>
|
||||
<run_depend>message_filters</run_depend>
|
||||
<run_depend>image_transport</run_depend>
|
||||
<run_depend>compressed_image_transport</run_depend>
|
||||
<run_depend>compressed_depth_image_transport</run_depend>
|
||||
<run_depend>libpcl-all-dev</run_depend>
|
||||
<run_depend>libpcl-all</run_depend>
|
||||
<run_depend>cv_bridge</run_depend><!-- Depend on cv_bridge instead of libopencv-dev to support ROS Hydro.-->
|
||||
|
||||
<export>
|
||||
</export>
|
||||
</package>
|
619
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_viewer/src/viewer.cpp
vendored
Normal file
619
Code/RK3588/PIBot_ROS/third_party/iai_kinect2/kinect2_viewer/src/viewer.cpp
vendored
Normal file
|
@ -0,0 +1,619 @@
|
|||
/**
|
||||
* Copyright 2014 University of Bremen, Institute for Artificial Intelligence
|
||||
* Author: Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
#include <pcl/point_cloud.h>
|
||||
#include <pcl/point_types.h>
|
||||
#include <pcl/io/pcd_io.h>
|
||||
#include <pcl/visualization/cloud_viewer.h>
|
||||
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
#include <ros/ros.h>
|
||||
#include <ros/spinner.h>
|
||||
#include <sensor_msgs/CameraInfo.h>
|
||||
#include <sensor_msgs/Image.h>
|
||||
|
||||
#include <cv_bridge/cv_bridge.h>
|
||||
|
||||
#include <image_transport/image_transport.h>
|
||||
#include <image_transport/subscriber_filter.h>
|
||||
|
||||
#include <message_filters/subscriber.h>
|
||||
#include <message_filters/synchronizer.h>
|
||||
#include <message_filters/sync_policies/exact_time.h>
|
||||
#include <message_filters/sync_policies/approximate_time.h>
|
||||
|
||||
#include <kinect2_bridge/kinect2_definitions.h>
|
||||
|
||||
class Receiver
|
||||
{
|
||||
public:
|
||||
enum Mode
|
||||
{
|
||||
IMAGE = 0,
|
||||
CLOUD,
|
||||
BOTH
|
||||
};
|
||||
|
||||
private:
|
||||
std::mutex lock;
|
||||
|
||||
const std::string topicColor, topicDepth;
|
||||
const bool useExact, useCompressed;
|
||||
|
||||
bool updateImage, updateCloud;
|
||||
bool save;
|
||||
bool running;
|
||||
size_t frame;
|
||||
const size_t queueSize;
|
||||
|
||||
cv::Mat color, depth;
|
||||
cv::Mat cameraMatrixColor, cameraMatrixDepth;
|
||||
cv::Mat lookupX, lookupY;
|
||||
|
||||
typedef message_filters::sync_policies::ExactTime<sensor_msgs::Image, sensor_msgs::Image, sensor_msgs::CameraInfo, sensor_msgs::CameraInfo> ExactSyncPolicy;
|
||||
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::Image, sensor_msgs::CameraInfo, sensor_msgs::CameraInfo> ApproximateSyncPolicy;
|
||||
|
||||
ros::NodeHandle nh;
|
||||
ros::AsyncSpinner spinner;
|
||||
image_transport::ImageTransport it;
|
||||
image_transport::SubscriberFilter *subImageColor, *subImageDepth;
|
||||
message_filters::Subscriber<sensor_msgs::CameraInfo> *subCameraInfoColor, *subCameraInfoDepth;
|
||||
|
||||
message_filters::Synchronizer<ExactSyncPolicy> *syncExact;
|
||||
message_filters::Synchronizer<ApproximateSyncPolicy> *syncApproximate;
|
||||
|
||||
std::thread imageViewerThread;
|
||||
Mode mode;
|
||||
|
||||
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud;
|
||||
pcl::PCDWriter writer;
|
||||
std::ostringstream oss;
|
||||
std::vector<int> params;
|
||||
|
||||
public:
|
||||
Receiver(const std::string &topicColor, const std::string &topicDepth, const bool useExact, const bool useCompressed)
|
||||
: topicColor(topicColor), topicDepth(topicDepth), useExact(useExact), useCompressed(useCompressed),
|
||||
updateImage(false), updateCloud(false), save(false), running(false), frame(0), queueSize(5),
|
||||
nh("~"), spinner(0), it(nh), mode(CLOUD)
|
||||
{
|
||||
cameraMatrixColor = cv::Mat::zeros(3, 3, CV_64F);
|
||||
cameraMatrixDepth = cv::Mat::zeros(3, 3, CV_64F);
|
||||
params.push_back(cv::IMWRITE_JPEG_QUALITY);
|
||||
params.push_back(100);
|
||||
params.push_back(cv::IMWRITE_PNG_COMPRESSION);
|
||||
params.push_back(1);
|
||||
params.push_back(cv::IMWRITE_PNG_STRATEGY);
|
||||
params.push_back(cv::IMWRITE_PNG_STRATEGY_RLE);
|
||||
params.push_back(0);
|
||||
}
|
||||
|
||||
~Receiver()
|
||||
{
|
||||
}
|
||||
|
||||
void run(const Mode mode)
|
||||
{
|
||||
start(mode);
|
||||
stop();
|
||||
}
|
||||
|
||||
private:
|
||||
void start(const Mode mode)
|
||||
{
|
||||
this->mode = mode;
|
||||
running = true;
|
||||
|
||||
std::string topicCameraInfoColor = topicColor.substr(0, topicColor.rfind('/')) + "/camera_info";
|
||||
std::string topicCameraInfoDepth = topicDepth.substr(0, topicDepth.rfind('/')) + "/camera_info";
|
||||
|
||||
image_transport::TransportHints hints(useCompressed ? "compressed" : "raw");
|
||||
subImageColor = new image_transport::SubscriberFilter(it, topicColor, queueSize, hints);
|
||||
subImageDepth = new image_transport::SubscriberFilter(it, topicDepth, queueSize, hints);
|
||||
subCameraInfoColor = new message_filters::Subscriber<sensor_msgs::CameraInfo>(nh, topicCameraInfoColor, queueSize);
|
||||
subCameraInfoDepth = new message_filters::Subscriber<sensor_msgs::CameraInfo>(nh, topicCameraInfoDepth, queueSize);
|
||||
|
||||
if(useExact)
|
||||
{
|
||||
syncExact = new message_filters::Synchronizer<ExactSyncPolicy>(ExactSyncPolicy(queueSize), *subImageColor, *subImageDepth, *subCameraInfoColor, *subCameraInfoDepth);
|
||||
syncExact->registerCallback(boost::bind(&Receiver::callback, this, _1, _2, _3, _4));
|
||||
}
|
||||
else
|
||||
{
|
||||
syncApproximate = new message_filters::Synchronizer<ApproximateSyncPolicy>(ApproximateSyncPolicy(queueSize), *subImageColor, *subImageDepth, *subCameraInfoColor, *subCameraInfoDepth);
|
||||
syncApproximate->registerCallback(boost::bind(&Receiver::callback, this, _1, _2, _3, _4));
|
||||
}
|
||||
|
||||
spinner.start();
|
||||
|
||||
std::chrono::milliseconds duration(1);
|
||||
while(!updateImage || !updateCloud)
|
||||
{
|
||||
if(!ros::ok())
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::this_thread::sleep_for(duration);
|
||||
}
|
||||
cloud = pcl::PointCloud<pcl::PointXYZRGBA>::Ptr(new pcl::PointCloud<pcl::PointXYZRGBA>());
|
||||
cloud->height = color.rows;
|
||||
cloud->width = color.cols;
|
||||
cloud->is_dense = false;
|
||||
cloud->points.resize(cloud->height * cloud->width);
|
||||
createLookup(this->color.cols, this->color.rows);
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case CLOUD:
|
||||
cloudViewer();
|
||||
break;
|
||||
case IMAGE:
|
||||
imageViewer();
|
||||
break;
|
||||
case BOTH:
|
||||
imageViewerThread = std::thread(&Receiver::imageViewer, this);
|
||||
cloudViewer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
spinner.stop();
|
||||
|
||||
if(useExact)
|
||||
{
|
||||
delete syncExact;
|
||||
}
|
||||
else
|
||||
{
|
||||
delete syncApproximate;
|
||||
}
|
||||
|
||||
delete subImageColor;
|
||||
delete subImageDepth;
|
||||
delete subCameraInfoColor;
|
||||
delete subCameraInfoDepth;
|
||||
|
||||
running = false;
|
||||
if(mode == BOTH)
|
||||
{
|
||||
imageViewerThread.join();
|
||||
}
|
||||
}
|
||||
|
||||
void callback(const sensor_msgs::Image::ConstPtr imageColor, const sensor_msgs::Image::ConstPtr imageDepth,
|
||||
const sensor_msgs::CameraInfo::ConstPtr cameraInfoColor, const sensor_msgs::CameraInfo::ConstPtr cameraInfoDepth)
|
||||
{
|
||||
cv::Mat color, depth;
|
||||
|
||||
readCameraInfo(cameraInfoColor, cameraMatrixColor);
|
||||
readCameraInfo(cameraInfoDepth, cameraMatrixDepth);
|
||||
readImage(imageColor, color);
|
||||
readImage(imageDepth, depth);
|
||||
|
||||
// IR image input
|
||||
if(color.type() == CV_16U)
|
||||
{
|
||||
cv::Mat tmp;
|
||||
color.convertTo(tmp, CV_8U, 0.02);
|
||||
cv::cvtColor(tmp, color, CV_GRAY2BGR);
|
||||
}
|
||||
|
||||
lock.lock();
|
||||
this->color = color;
|
||||
this->depth = depth;
|
||||
updateImage = true;
|
||||
updateCloud = true;
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
void imageViewer()
|
||||
{
|
||||
cv::Mat color, depth, depthDisp, combined;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> start, now;
|
||||
double fps = 0;
|
||||
size_t frameCount = 0;
|
||||
std::ostringstream oss;
|
||||
const cv::Point pos(5, 15);
|
||||
const cv::Scalar colorText = CV_RGB(255, 255, 255);
|
||||
const double sizeText = 0.5;
|
||||
const int lineText = 1;
|
||||
const int font = cv::FONT_HERSHEY_SIMPLEX;
|
||||
|
||||
cv::namedWindow("Image Viewer");
|
||||
oss << "starting...";
|
||||
|
||||
start = std::chrono::high_resolution_clock::now();
|
||||
for(; running && ros::ok();)
|
||||
{
|
||||
if(updateImage)
|
||||
{
|
||||
lock.lock();
|
||||
color = this->color;
|
||||
depth = this->depth;
|
||||
updateImage = false;
|
||||
lock.unlock();
|
||||
|
||||
++frameCount;
|
||||
now = std::chrono::high_resolution_clock::now();
|
||||
double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(now - start).count() / 1000.0;
|
||||
if(elapsed >= 1.0)
|
||||
{
|
||||
fps = frameCount / elapsed;
|
||||
oss.str("");
|
||||
oss << "fps: " << fps << " ( " << elapsed / frameCount * 1000.0 << " ms)";
|
||||
start = now;
|
||||
frameCount = 0;
|
||||
}
|
||||
|
||||
dispDepth(depth, depthDisp, 12000.0f);
|
||||
combine(color, depthDisp, combined);
|
||||
//combined = color;
|
||||
|
||||
cv::putText(combined, oss.str(), pos, font, sizeText, colorText, lineText, CV_AA);
|
||||
cv::imshow("Image Viewer", combined);
|
||||
}
|
||||
|
||||
int key = cv::waitKey(1);
|
||||
switch(key & 0xFF)
|
||||
{
|
||||
case 27:
|
||||
case 'q':
|
||||
running = false;
|
||||
break;
|
||||
case ' ':
|
||||
case 's':
|
||||
if(mode == IMAGE)
|
||||
{
|
||||
createCloud(depth, color, cloud);
|
||||
saveCloudAndImages(cloud, color, depth, depthDisp);
|
||||
}
|
||||
else
|
||||
{
|
||||
save = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
cv::destroyAllWindows();
|
||||
cv::waitKey(100);
|
||||
}
|
||||
|
||||
void cloudViewer()
|
||||
{
|
||||
cv::Mat color, depth;
|
||||
pcl::visualization::PCLVisualizer::Ptr visualizer(new pcl::visualization::PCLVisualizer("Cloud Viewer"));
|
||||
const std::string cloudName = "rendered";
|
||||
|
||||
lock.lock();
|
||||
color = this->color;
|
||||
depth = this->depth;
|
||||
updateCloud = false;
|
||||
lock.unlock();
|
||||
|
||||
createCloud(depth, color, cloud);
|
||||
|
||||
visualizer->addPointCloud(cloud, cloudName);
|
||||
visualizer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, cloudName);
|
||||
visualizer->initCameraParameters();
|
||||
visualizer->setBackgroundColor(0, 0, 0);
|
||||
visualizer->setPosition(mode == BOTH ? color.cols : 0, 0);
|
||||
visualizer->setSize(color.cols, color.rows);
|
||||
visualizer->setShowFPS(true);
|
||||
visualizer->setCameraPosition(0, 0, 0, 0, -1, 0);
|
||||
visualizer->registerKeyboardCallback(&Receiver::keyboardEvent, *this);
|
||||
|
||||
for(; running && ros::ok();)
|
||||
{
|
||||
if(updateCloud)
|
||||
{
|
||||
lock.lock();
|
||||
color = this->color;
|
||||
depth = this->depth;
|
||||
updateCloud = false;
|
||||
lock.unlock();
|
||||
|
||||
createCloud(depth, color, cloud);
|
||||
|
||||
visualizer->updatePointCloud(cloud, cloudName);
|
||||
}
|
||||
if(save)
|
||||
{
|
||||
save = false;
|
||||
cv::Mat depthDisp;
|
||||
dispDepth(depth, depthDisp, 12000.0f);
|
||||
saveCloudAndImages(cloud, color, depth, depthDisp);
|
||||
}
|
||||
visualizer->spinOnce(10);
|
||||
}
|
||||
visualizer->close();
|
||||
}
|
||||
|
||||
void keyboardEvent(const pcl::visualization::KeyboardEvent &event, void *)
|
||||
{
|
||||
if(event.keyUp())
|
||||
{
|
||||
switch(event.getKeyCode())
|
||||
{
|
||||
case 27:
|
||||
case 'q':
|
||||
running = false;
|
||||
break;
|
||||
case ' ':
|
||||
case 's':
|
||||
save = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void readImage(const sensor_msgs::Image::ConstPtr msgImage, cv::Mat &image) const
|
||||
{
|
||||
cv_bridge::CvImageConstPtr pCvImage;
|
||||
pCvImage = cv_bridge::toCvShare(msgImage, msgImage->encoding);
|
||||
pCvImage->image.copyTo(image);
|
||||
}
|
||||
|
||||
void readCameraInfo(const sensor_msgs::CameraInfo::ConstPtr cameraInfo, cv::Mat &cameraMatrix) const
|
||||
{
|
||||
double *itC = cameraMatrix.ptr<double>(0, 0);
|
||||
for(size_t i = 0; i < 9; ++i, ++itC)
|
||||
{
|
||||
*itC = cameraInfo->K[i];
|
||||
}
|
||||
}
|
||||
|
||||
void dispDepth(const cv::Mat &in, cv::Mat &out, const float maxValue)
|
||||
{
|
||||
cv::Mat tmp = cv::Mat(in.rows, in.cols, CV_8U);
|
||||
const uint32_t maxInt = 255;
|
||||
|
||||
#pragma omp parallel for
|
||||
for(int r = 0; r < in.rows; ++r)
|
||||
{
|
||||
const uint16_t *itI = in.ptr<uint16_t>(r);
|
||||
uint8_t *itO = tmp.ptr<uint8_t>(r);
|
||||
|
||||
for(int c = 0; c < in.cols; ++c, ++itI, ++itO)
|
||||
{
|
||||
*itO = (uint8_t)std::min((*itI * maxInt / maxValue), 255.0f);
|
||||
}
|
||||
}
|
||||
|
||||
cv::applyColorMap(tmp, out, cv::COLORMAP_JET);
|
||||
}
|
||||
|
||||
void combine(const cv::Mat &inC, const cv::Mat &inD, cv::Mat &out)
|
||||
{
|
||||
out = cv::Mat(inC.rows, inC.cols, CV_8UC3);
|
||||
|
||||
#pragma omp parallel for
|
||||
for(int r = 0; r < inC.rows; ++r)
|
||||
{
|
||||
const cv::Vec3b
|
||||
*itC = inC.ptr<cv::Vec3b>(r),
|
||||
*itD = inD.ptr<cv::Vec3b>(r);
|
||||
cv::Vec3b *itO = out.ptr<cv::Vec3b>(r);
|
||||
|
||||
for(int c = 0; c < inC.cols; ++c, ++itC, ++itD, ++itO)
|
||||
{
|
||||
itO->val[0] = (itC->val[0] + itD->val[0]) >> 1;
|
||||
itO->val[1] = (itC->val[1] + itD->val[1]) >> 1;
|
||||
itO->val[2] = (itC->val[2] + itD->val[2]) >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void createCloud(const cv::Mat &depth, const cv::Mat &color, pcl::PointCloud<pcl::PointXYZRGBA>::Ptr &cloud) const
|
||||
{
|
||||
const float badPoint = std::numeric_limits<float>::quiet_NaN();
|
||||
|
||||
#pragma omp parallel for
|
||||
for(int r = 0; r < depth.rows; ++r)
|
||||
{
|
||||
pcl::PointXYZRGBA *itP = &cloud->points[r * depth.cols];
|
||||
const uint16_t *itD = depth.ptr<uint16_t>(r);
|
||||
const cv::Vec3b *itC = color.ptr<cv::Vec3b>(r);
|
||||
const float y = lookupY.at<float>(0, r);
|
||||
const float *itX = lookupX.ptr<float>();
|
||||
|
||||
for(size_t c = 0; c < (size_t)depth.cols; ++c, ++itP, ++itD, ++itC, ++itX)
|
||||
{
|
||||
register const float depthValue = *itD / 1000.0f;
|
||||
// Check for invalid measurements
|
||||
if(*itD == 0)
|
||||
{
|
||||
// not valid
|
||||
itP->x = itP->y = itP->z = badPoint;
|
||||
itP->rgba = 0;
|
||||
continue;
|
||||
}
|
||||
itP->z = depthValue;
|
||||
itP->x = *itX * depthValue;
|
||||
itP->y = y * depthValue;
|
||||
itP->b = itC->val[0];
|
||||
itP->g = itC->val[1];
|
||||
itP->r = itC->val[2];
|
||||
itP->a = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void saveCloudAndImages(const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr cloud, const cv::Mat &color, const cv::Mat &depth, const cv::Mat &depthColored)
|
||||
{
|
||||
oss.str("");
|
||||
oss << "./" << std::setfill('0') << std::setw(4) << frame;
|
||||
const std::string baseName = oss.str();
|
||||
const std::string cloudName = baseName + "_cloud.pcd";
|
||||
const std::string colorName = baseName + "_color.jpg";
|
||||
const std::string depthName = baseName + "_depth.png";
|
||||
const std::string depthColoredName = baseName + "_depth_colored.png";
|
||||
|
||||
OUT_INFO("saving cloud: " << cloudName);
|
||||
writer.writeBinary(cloudName, *cloud);
|
||||
OUT_INFO("saving color: " << colorName);
|
||||
cv::imwrite(colorName, color, params);
|
||||
OUT_INFO("saving depth: " << depthName);
|
||||
cv::imwrite(depthName, depth, params);
|
||||
OUT_INFO("saving depth: " << depthColoredName);
|
||||
cv::imwrite(depthColoredName, depthColored, params);
|
||||
OUT_INFO("saving complete!");
|
||||
++frame;
|
||||
}
|
||||
|
||||
void createLookup(size_t width, size_t height)
|
||||
{
|
||||
const float fx = 1.0f / cameraMatrixColor.at<double>(0, 0);
|
||||
const float fy = 1.0f / cameraMatrixColor.at<double>(1, 1);
|
||||
const float cx = cameraMatrixColor.at<double>(0, 2);
|
||||
const float cy = cameraMatrixColor.at<double>(1, 2);
|
||||
float *it;
|
||||
|
||||
lookupY = cv::Mat(1, height, CV_32F);
|
||||
it = lookupY.ptr<float>();
|
||||
for(size_t r = 0; r < height; ++r, ++it)
|
||||
{
|
||||
*it = (r - cy) * fy;
|
||||
}
|
||||
|
||||
lookupX = cv::Mat(1, width, CV_32F);
|
||||
it = lookupX.ptr<float>();
|
||||
for(size_t c = 0; c < width; ++c, ++it)
|
||||
{
|
||||
*it = (c - cx) * fx;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void help(const std::string &path)
|
||||
{
|
||||
std::cout << path << FG_BLUE " [options]" << std::endl
|
||||
<< FG_GREEN " name" NO_COLOR ": " FG_YELLOW "'any string'" NO_COLOR " equals to the kinect2_bridge topic base name" << std::endl
|
||||
<< FG_GREEN " mode" NO_COLOR ": " FG_YELLOW "'qhd'" NO_COLOR ", " FG_YELLOW "'hd'" NO_COLOR ", " FG_YELLOW "'sd'" NO_COLOR " or " FG_YELLOW "'ir'" << std::endl
|
||||
<< FG_GREEN " visualization" NO_COLOR ": " FG_YELLOW "'image'" NO_COLOR ", " FG_YELLOW "'cloud'" NO_COLOR " or " FG_YELLOW "'both'" << std::endl
|
||||
<< FG_GREEN " options" NO_COLOR ":" << std::endl
|
||||
<< FG_YELLOW " 'compressed'" NO_COLOR " use compressed instead of raw topics" << std::endl
|
||||
<< FG_YELLOW " 'approx'" NO_COLOR " use approximate time synchronization" << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if EXTENDED_OUTPUT
|
||||
ROSCONSOLE_AUTOINIT;
|
||||
if(!getenv("ROSCONSOLE_FORMAT"))
|
||||
{
|
||||
ros::console::g_formatter.tokens_.clear();
|
||||
ros::console::g_formatter.init("[${severity}] ${message}");
|
||||
}
|
||||
#endif
|
||||
|
||||
ros::init(argc, argv, "kinect2_viewer", ros::init_options::AnonymousName);
|
||||
|
||||
if(!ros::ok())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string ns = K2_DEFAULT_NS;
|
||||
std::string topicColor = K2_TOPIC_QHD K2_TOPIC_IMAGE_COLOR K2_TOPIC_IMAGE_RECT;
|
||||
std::string topicDepth = K2_TOPIC_QHD K2_TOPIC_IMAGE_DEPTH K2_TOPIC_IMAGE_RECT;
|
||||
bool useExact = true;
|
||||
bool useCompressed = false;
|
||||
Receiver::Mode mode = Receiver::CLOUD;
|
||||
|
||||
for(size_t i = 1; i < (size_t)argc; ++i)
|
||||
{
|
||||
std::string param(argv[i]);
|
||||
|
||||
if(param == "-h" || param == "--help" || param == "-?" || param == "--?")
|
||||
{
|
||||
help(argv[0]);
|
||||
ros::shutdown();
|
||||
return 0;
|
||||
}
|
||||
else if(param == "qhd")
|
||||
{
|
||||
topicColor = K2_TOPIC_QHD K2_TOPIC_IMAGE_COLOR K2_TOPIC_IMAGE_RECT;
|
||||
topicDepth = K2_TOPIC_QHD K2_TOPIC_IMAGE_DEPTH K2_TOPIC_IMAGE_RECT;
|
||||
}
|
||||
else if(param == "hd")
|
||||
{
|
||||
topicColor = K2_TOPIC_HD K2_TOPIC_IMAGE_COLOR K2_TOPIC_IMAGE_RECT;
|
||||
topicDepth = K2_TOPIC_HD K2_TOPIC_IMAGE_DEPTH K2_TOPIC_IMAGE_RECT;
|
||||
}
|
||||
else if(param == "ir")
|
||||
{
|
||||
topicColor = K2_TOPIC_SD K2_TOPIC_IMAGE_IR K2_TOPIC_IMAGE_RECT;
|
||||
topicDepth = K2_TOPIC_SD K2_TOPIC_IMAGE_DEPTH K2_TOPIC_IMAGE_RECT;
|
||||
}
|
||||
else if(param == "sd")
|
||||
{
|
||||
topicColor = K2_TOPIC_SD K2_TOPIC_IMAGE_COLOR K2_TOPIC_IMAGE_RECT;
|
||||
topicDepth = K2_TOPIC_SD K2_TOPIC_IMAGE_DEPTH K2_TOPIC_IMAGE_RECT;
|
||||
}
|
||||
else if(param == "approx")
|
||||
{
|
||||
useExact = false;
|
||||
}
|
||||
|
||||
else if(param == "compressed")
|
||||
{
|
||||
useCompressed = true;
|
||||
}
|
||||
else if(param == "image")
|
||||
{
|
||||
mode = Receiver::IMAGE;
|
||||
}
|
||||
else if(param == "cloud")
|
||||
{
|
||||
mode = Receiver::CLOUD;
|
||||
}
|
||||
else if(param == "both")
|
||||
{
|
||||
mode = Receiver::BOTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
ns = param;
|
||||
}
|
||||
}
|
||||
|
||||
topicColor = "/" + ns + topicColor;
|
||||
topicDepth = "/" + ns + topicDepth;
|
||||
OUT_INFO("topic color: " FG_CYAN << topicColor << NO_COLOR);
|
||||
OUT_INFO("topic depth: " FG_CYAN << topicDepth << NO_COLOR);
|
||||
|
||||
Receiver receiver(topicColor, topicDepth, useExact, useCompressed);
|
||||
|
||||
OUT_INFO("starting receiver...");
|
||||
receiver.run(mode);
|
||||
|
||||
ros::shutdown();
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
* text=auto
|
||||
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
|
@ -0,0 +1,24 @@
|
|||
Overview Description:
|
||||
|
||||
<!-- Check https://github.com/OpenKinect/libfreenect2/wiki/Troubleshooting if you haven't done so. -->
|
||||
|
||||
Version, Platform, and Hardware Bug Found:
|
||||
|
||||
1. `git log -1 --oneline`
|
||||
2. `uname -a`
|
||||
3. `lsusb -t`
|
||||
4. `lspci -nn`
|
||||
|
||||
Steps to Reproduce:
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
Actual Results:
|
||||
|
||||
Expected Results:
|
||||
|
||||
Reproducibility:
|
||||
|
||||
Additional Information:
|
|
@ -0,0 +1,161 @@
|
|||
build
|
||||
|
||||
# Dependency folders
|
||||
depends/*/
|
||||
depends/*.deb
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
|
||||
!packages/*/build/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
|
||||
#LightSwitch generated files
|
||||
GeneratedArtifacts/
|
||||
_Pvt_Extensions/
|
||||
ModelManifest.xml
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac desktop service store files
|
||||
.DS_Store
|
|
@ -0,0 +1,202 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
@ -0,0 +1,500 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12.1)
|
||||
|
||||
SET(PROJECT_VER_MAJOR 0)
|
||||
SET(PROJECT_VER_MINOR 2)
|
||||
SET(PROJECT_VER_PATCH 0)
|
||||
SET(PROJECT_VER "${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}")
|
||||
SET(PROJECT_APIVER "${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "-fPIC")
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF(WIN32)
|
||||
# no permission for the default install prefix %ProgramFiles%
|
||||
SET(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING "installation path")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
# No effect for multi-configuration generators (e.g. for Visual Studio)
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose: RelWithDebInfo Release Debug MinSizeRel None")
|
||||
ENDIF()
|
||||
|
||||
PROJECT(libfreenect2)
|
||||
|
||||
IF(POLICY CMP0042)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
ENDIF()
|
||||
|
||||
SET(MY_DIR ${libfreenect2_SOURCE_DIR})
|
||||
SET(DEPENDS_DIR "${MY_DIR}/depends" CACHE STRING "dependency directory must be set to 'false' if external deps are used")
|
||||
|
||||
OPTION(BUILD_SHARED_LIBS "Build shared (ON) or static (OFF) libraries" ON)
|
||||
OPTION(BUILD_EXAMPLES "Build examples" ON)
|
||||
OPTION(BUILD_OPENNI2_DRIVER "Build OpenNI2 driver" ON)
|
||||
OPTION(ENABLE_CXX11 "Enable C++11 support" OFF)
|
||||
OPTION(ENABLE_OPENCL "Enable OpenCL support" ON)
|
||||
OPTION(ENABLE_CUDA "Enable CUDA support" ON)
|
||||
OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
|
||||
OPTION(ENABLE_VAAPI "Enable VA-API support" ON)
|
||||
OPTION(ENABLE_TEGRAJPEG "Enable Tegra HW JPEG support" ON)
|
||||
OPTION(ENABLE_PROFILING "Collect profiling stats (memory consuming)" OFF)
|
||||
|
||||
IF(ENABLE_PROFILING)
|
||||
SET(LIBFREENECT2_WITH_PROFILING 1)
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC)
|
||||
# suppress several "possible loss of data" warnings, and
|
||||
# "zero-length array in struct" from libusb.h
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4244 /wd4200 /wd4305 /wd4146")
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) # no warning for getenv()
|
||||
ELSE()
|
||||
# Heed warnings from non-MSVC compilers
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
ENDIF()
|
||||
|
||||
SET(HAVE_CXX11 disabled)
|
||||
IF(ENABLE_CXX11)
|
||||
INCLUDE(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
|
||||
IF(COMPILER_SUPPORTS_CXX11)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
SET(LIBFREENECT2_WITH_CXX11_SUPPORT 1)
|
||||
SET(HAVE_CXX11 yes)
|
||||
ELSEIF(COMPILER_SUPPORTS_CXX0X)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
SET(HAVE_CXX11 c++0x)
|
||||
ELSE()
|
||||
SET(HAVE_CXX11 no)
|
||||
MESSAGE(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
|
||||
ENDIF()
|
||||
ENDIF(ENABLE_CXX11)
|
||||
|
||||
# additional cmake modules
|
||||
LIST(APPEND CMAKE_MODULE_PATH ${MY_DIR}/cmake_modules)
|
||||
|
||||
# setup threading
|
||||
INCLUDE(SetupLibfreenect2Threading)
|
||||
|
||||
INCLUDE(GenerateResources)
|
||||
|
||||
#set the default path for built executables to the "bin" directory
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
#set the default path for built libraries to the "lib" directory
|
||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
||||
|
||||
# dependencies
|
||||
FIND_PACKAGE(PkgConfig) # try find PKGConfig as it will be used if found
|
||||
FIND_PACKAGE(LibUSB REQUIRED)
|
||||
|
||||
# Add includes
|
||||
INCLUDE_DIRECTORIES(
|
||||
"${MY_DIR}/include"
|
||||
"${MY_DIR}/include/internal"
|
||||
${PROJECT_BINARY_DIR} # for generated headers
|
||||
${LIBFREENECT2_THREADING_INCLUDE_DIR}
|
||||
${LibUSB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
SET(RESOURCES_INC_FILE "${PROJECT_BINARY_DIR}/resources.inc.h")
|
||||
|
||||
SET(SOURCES
|
||||
include/internal/libfreenect2/protocol/command.h
|
||||
include/internal/libfreenect2/protocol/command_transaction.h
|
||||
include/internal/libfreenect2/protocol/response.h
|
||||
include/internal/libfreenect2/protocol/usb_control.h
|
||||
|
||||
include/internal/libfreenect2/usb/event_loop.h
|
||||
include/internal/libfreenect2/usb/transfer_pool.h
|
||||
|
||||
include/libfreenect2/logger.h
|
||||
include/internal/libfreenect2/logging.h
|
||||
|
||||
include/internal/libfreenect2/async_packet_processor.h
|
||||
include/internal/libfreenect2/depth_packet_processor.h
|
||||
include/internal/libfreenect2/depth_packet_stream_parser.h
|
||||
include/internal/libfreenect2/allocator.h
|
||||
include/libfreenect2/frame_listener.hpp
|
||||
include/libfreenect2/frame_listener_impl.h
|
||||
include/libfreenect2/libfreenect2.hpp
|
||||
include/libfreenect2/color_settings.h
|
||||
include/libfreenect2/led_settings.h
|
||||
include/libfreenect2/packet_pipeline.h
|
||||
include/internal/libfreenect2/packet_processor.h
|
||||
include/libfreenect2/registration.h
|
||||
include/internal/libfreenect2/resource.h
|
||||
include/internal/libfreenect2/rgb_packet_processor.h
|
||||
include/internal/libfreenect2/rgb_packet_stream_parser.h
|
||||
include/internal/libfreenect2/threading.h
|
||||
|
||||
src/transfer_pool.cpp
|
||||
src/event_loop.cpp
|
||||
src/usb_control.cpp
|
||||
src/allocator.cpp
|
||||
src/frame_listener_impl.cpp
|
||||
src/packet_pipeline.cpp
|
||||
src/rgb_packet_stream_parser.cpp
|
||||
src/rgb_packet_processor.cpp
|
||||
src/depth_packet_stream_parser.cpp
|
||||
src/depth_packet_processor.cpp
|
||||
src/cpu_depth_packet_processor.cpp
|
||||
src/resource.cpp
|
||||
src/command_transaction.cpp
|
||||
src/registration.cpp
|
||||
src/logging.cpp
|
||||
src/libfreenect2.cpp
|
||||
|
||||
${LIBFREENECT2_THREADING_SOURCE}
|
||||
${RESOURCES_INC_FILE}
|
||||
"${PROJECT_BINARY_DIR}/libfreenect2/config.h"
|
||||
"${PROJECT_BINARY_DIR}/libfreenect2/export.h"
|
||||
)
|
||||
|
||||
SET(LIBRARIES
|
||||
${LibUSB_LIBRARIES}
|
||||
${LIBFREENECT2_THREADING_LIBRARIES}
|
||||
)
|
||||
|
||||
SET(LIBFREENECT2_DLLS
|
||||
${LibUSB_DLL}
|
||||
)
|
||||
|
||||
SET(HAVE_VideoToolbox "no (Apple only)")
|
||||
IF(APPLE)
|
||||
FIND_LIBRARY(VIDEOTOOLBOX_LIBRARY VideoToolbox)
|
||||
|
||||
SET(HAVE_VideoToolbox no)
|
||||
IF(VIDEOTOOLBOX_LIBRARY)
|
||||
SET(LIBFREENECT2_WITH_VT_SUPPORT 1)
|
||||
SET(HAVE_VideoToolbox yes)
|
||||
|
||||
FIND_LIBRARY(COREFOUNDATION_LIBRARY CoreFoundation REQUIRED)
|
||||
FIND_LIBRARY(COREMEDIA_LIBRARY CoreMedia REQUIRED)
|
||||
FIND_LIBRARY(COREVIDEO_LIBRARY CoreVideo REQUIRED)
|
||||
|
||||
LIST(APPEND SOURCES
|
||||
src/vt_rgb_packet_processor.cpp
|
||||
)
|
||||
|
||||
LIST(APPEND LIBRARIES
|
||||
${VIDEOTOOLBOX_LIBRARY}
|
||||
${COREFOUNDATION_LIBRARY}
|
||||
${COREMEDIA_LIBRARY}
|
||||
${COREVIDEO_LIBRARY}
|
||||
)
|
||||
ENDIF(VIDEOTOOLBOX_LIBRARY)
|
||||
ENDIF(APPLE)
|
||||
|
||||
SET(HAVE_VAAPI disabled)
|
||||
IF(ENABLE_VAAPI)
|
||||
IF(PKG_CONFIG_FOUND)
|
||||
PKG_CHECK_MODULES(VAAPI libva libva-drm)
|
||||
ENDIF()
|
||||
FIND_PACKAGE(JPEG)
|
||||
|
||||
SET(HAVE_VAAPI no)
|
||||
IF(VAAPI_FOUND AND JPEG_FOUND)
|
||||
SET(LIBFREENECT2_WITH_VAAPI_SUPPORT 1)
|
||||
SET(HAVE_VAAPI yes)
|
||||
|
||||
INCLUDE_DIRECTORIES(${VAAPI_INCLUDE_DIRS})
|
||||
|
||||
LIST(APPEND SOURCES
|
||||
src/vaapi_rgb_packet_processor.cpp
|
||||
)
|
||||
LIST(APPEND LIBRARIES
|
||||
${VAAPI_LIBRARIES}
|
||||
${JPEG_LIBRARY}
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF(ENABLE_VAAPI)
|
||||
|
||||
SET(HAVE_TegraJPEG disabled)
|
||||
IF(ENABLE_TEGRAJPEG)
|
||||
FIND_PACKAGE(TegraJPEG)
|
||||
|
||||
SET(HAVE_TegraJPEG no)
|
||||
IF(TegraJPEG_FOUND)
|
||||
SET(LIBFREENECT2_WITH_TEGRAJPEG_SUPPORT 1)
|
||||
SET(HAVE_TegraJPEG yes)
|
||||
|
||||
INCLUDE_DIRECTORIES(${TegraJPEG_INCLUDE_DIRS})
|
||||
|
||||
LIST(APPEND SOURCES
|
||||
src/tegra_jpeg_rgb_packet_processor.cpp
|
||||
)
|
||||
|
||||
LIST(APPEND LIBRARIES
|
||||
${CMAKE_DL_LIBS}
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(LIBFREENECT2_WITH_VT_SUPPORT)
|
||||
FIND_PACKAGE(TurboJPEG)
|
||||
ELSE()
|
||||
# VAAPI can fail to start at runtime. It must have a fallback.
|
||||
FIND_PACKAGE(TurboJPEG REQUIRED)
|
||||
ENDIF()
|
||||
|
||||
SET(HAVE_TurboJPEG no)
|
||||
IF(TurboJPEG_FOUND)
|
||||
SET(LIBFREENECT2_WITH_TURBOJPEG_SUPPORT 1)
|
||||
SET(HAVE_TurboJPEG yes)
|
||||
|
||||
INCLUDE_DIRECTORIES(${TurboJPEG_INCLUDE_DIRS})
|
||||
|
||||
LIST(APPEND SOURCES
|
||||
src/turbo_jpeg_rgb_packet_processor.cpp
|
||||
)
|
||||
|
||||
LIST(APPEND LIBRARIES
|
||||
${TurboJPEG_LIBRARIES}
|
||||
)
|
||||
|
||||
LIST(APPEND LIBFREENECT2_DLLS
|
||||
${TurboJPEG_DLL}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
SET(HAVE_OpenGL disabled)
|
||||
IF(ENABLE_OPENGL)
|
||||
FIND_PACKAGE(GLFW3)
|
||||
FIND_PACKAGE(OpenGL)
|
||||
SET(HAVE_OpenGL no)
|
||||
IF(GLFW3_FOUND AND OPENGL_FOUND)
|
||||
SET(LIBFREENECT2_WITH_OPENGL_SUPPORT 1)
|
||||
SET(HAVE_OpenGL yes)
|
||||
|
||||
INCLUDE_DIRECTORIES(${GLFW3_INCLUDE_DIRS})
|
||||
|
||||
LIST(APPEND LIBFREENECT2_DLLS ${GLFW3_DLL})
|
||||
LIST(APPEND LIBRARIES
|
||||
${GLFW3_LIBRARIES}
|
||||
${OPENGL_gl_LIBRARY}
|
||||
)
|
||||
LIST(APPEND SOURCES
|
||||
src/flextGL.cpp
|
||||
src/opengl_depth_packet_processor.cpp
|
||||
)
|
||||
|
||||
LIST(APPEND RESOURCES
|
||||
src/shader/debug.fs
|
||||
src/shader/default.vs
|
||||
src/shader/filter1.fs
|
||||
src/shader/filter2.fs
|
||||
src/shader/stage1.fs
|
||||
src/shader/stage2.fs
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF(ENABLE_OPENGL)
|
||||
|
||||
SET(HAVE_OpenCL disabled)
|
||||
IF(ENABLE_OPENCL)
|
||||
FIND_PACKAGE(OpenCL)
|
||||
|
||||
SET(HAVE_OpenCL no)
|
||||
IF(OpenCL_FOUND)
|
||||
SET(LIBFREENECT2_WITH_OPENCL_SUPPORT 1)
|
||||
SET(HAVE_OpenCL yes)
|
||||
|
||||
IF(UNIX AND NOT APPLE)
|
||||
INCLUDE(CheckOpenCLICDLoader)
|
||||
IF(OpenCL_C_WORKS AND NOT OpenCL_CXX_WORKS)
|
||||
SET(LIBFREENECT2_OPENCL_ICD_LOADER_IS_OLD 1)
|
||||
SET(HAVE_OpenCL "yes but buggy")
|
||||
MESSAGE(WARNING "Your libOpenCL.so is incompatible with CL/cl.h. Install ocl-icd-opencl-dev to update libOpenCL.so?")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
INCLUDE_DIRECTORIES(${OpenCL_INCLUDE_DIRS})
|
||||
|
||||
LIST(APPEND SOURCES
|
||||
src/opencl_depth_packet_processor.cpp
|
||||
src/opencl_kde_depth_packet_processor.cpp
|
||||
)
|
||||
|
||||
LIST(APPEND LIBRARIES
|
||||
${OpenCL_LIBRARIES}
|
||||
)
|
||||
|
||||
LIST(APPEND RESOURCES
|
||||
src/opencl_depth_packet_processor.cl
|
||||
src/opencl_kde_depth_packet_processor.cl
|
||||
)
|
||||
|
||||
# Major Linux distro stable releases have buggy OpenCL ICD loader.
|
||||
# The workaround of disabling exceptions can only be set up during compile time.
|
||||
# Diabling it for all should be harmless. The flag is the same for GCC/Clang/ICC.
|
||||
IF(UNIX AND NOT APPLE)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
||||
ENDIF()
|
||||
ENDIF(OpenCL_FOUND)
|
||||
ENDIF(ENABLE_OPENCL)
|
||||
|
||||
SET(HAVE_CUDA disabled)
|
||||
IF(ENABLE_CUDA)
|
||||
FIND_PACKAGE(CUDA)
|
||||
SET(HAVE_CUDA no)
|
||||
IF(CUDA_FOUND AND MSVC14 AND CUDA_VERSION VERSION_LESS 8.0)
|
||||
SET(HAVE_CUDA "no (VS2015 not supported)")
|
||||
ELSEIF(CUDA_FOUND)
|
||||
SET(LIBFREENECT2_WITH_CUDA_SUPPORT 1)
|
||||
SET(HAVE_CUDA yes)
|
||||
|
||||
STRING(REPLACE "\\" "/" NVCUDASAMPLES_ROOT "$ENV{NVCUDASAMPLES_ROOT}")
|
||||
STRING(REPLACE "\\" "/" NVCUDASAMPLES8_0_ROOT "$ENV{NVCUDASAMPLES8_0_ROOT}")
|
||||
CUDA_INCLUDE_DIRECTORIES(
|
||||
"${MY_DIR}/include/"
|
||||
"${CUDA_TOOLKIT_ROOT_DIR}/samples/common/inc"
|
||||
"${NVCUDASAMPLES_ROOT}/common/inc"
|
||||
"${NVCUDASAMPLES8_0_ROOT}/common/inc"
|
||||
)
|
||||
SET(CUDA_FLAGS -use_fast_math)
|
||||
IF(NOT MSVC)
|
||||
SET(CUDA_FLAGS "${CUDA_FLAGS} -Xcompiler -fPIC")
|
||||
ENDIF()
|
||||
IF(HAVE_CXX11 STREQUAL yes AND CUDA_VERSION VERSION_GREATER 7.0)
|
||||
SET(CUDA_FLAGS "${CUDA_FLAGS} -std=c++11")
|
||||
ENDIF()
|
||||
|
||||
SET(OLD_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
STRING(REGEX REPLACE "-std=c\\+\\+.." "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
CUDA_COMPILE(CUDA_OBJECTS
|
||||
src/cuda_depth_packet_processor.cu
|
||||
src/cuda_kde_depth_packet_processor.cu
|
||||
OPTIONS ${CUDA_FLAGS}
|
||||
)
|
||||
SET(CMAKE_CXX_FLAGS "${OLD_CMAKE_CXX_FLAGS}")
|
||||
|
||||
INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS})
|
||||
|
||||
LIST(APPEND SOURCES
|
||||
${CUDA_OBJECTS}
|
||||
)
|
||||
|
||||
LIST(APPEND LIBRARIES
|
||||
${CUDA_LIBRARIES}
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF(ENABLE_CUDA)
|
||||
|
||||
# RPATH handling for CUDA 8.0 libOpenCL.so conflict. See #804.
|
||||
IF(HAVE_OpenCL STREQUAL yes AND UNIX AND NOT APPLE)
|
||||
FILE(GLOB CUDA_ld_so_conf /etc/ld.so.conf.d/cuda*.conf)
|
||||
IF(CUDA_ld_so_conf)
|
||||
MESSAGE(WARNING "Your CUDA installation overrides OpenCL system library path.")
|
||||
GET_FILENAME_COMPONENT(OpenCL_LIB_PATH ${OpenCL_LIBRARY} DIRECTORY)
|
||||
SET(CMAKE_INSTALL_RPATH ${OpenCL_LIB_PATH} CACHE STRING "Set RPATH for system OpenCL")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# RPATH handling for private libusb copies
|
||||
# Users have two options:
|
||||
# 1. Build libusb in depends/ and leave it there:
|
||||
# Do NOT set CMAKE_INSTALL_RPATH. It works by default.
|
||||
# 2. Build libusb and install it somewhere:
|
||||
# Set CMAKE_INSTALL_RPATH to the libusb.so installation directory before compiling.
|
||||
# Both command line -DCMAKE_INSTALL_RPATH=... and CMake GUI settings are accepted.
|
||||
#
|
||||
# Anyway if wrong versions of libusb is used, errors will be reported explicitly.
|
||||
IF(NOT DEFINED CMAKE_INSTALL_RPATH AND NOT ${LibUSB_LIBDIR} MATCHES "^/usr/lib")
|
||||
SET(CMAKE_INSTALL_RPATH ${LibUSB_LIBDIR} CACHE STRING "Set RPATH for a private libusb")
|
||||
ELSEIF(DEFINED CMAKE_INSTALL_RPATH)
|
||||
SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} CACHE STRING "Set RPATH for a private libusb")
|
||||
ENDIF()
|
||||
IF(DEFINED CMAKE_INSTALL_RPATH)
|
||||
MESSAGE(STATUS "RPATH set to ${CMAKE_INSTALL_RPATH}")
|
||||
ENDIF()
|
||||
|
||||
CONFIGURE_FILE("${MY_DIR}/include/libfreenect2/config.h.in" "${PROJECT_BINARY_DIR}/libfreenect2/config.h" @ONLY)
|
||||
GENERATE_RESOURCES(${RESOURCES_INC_FILE} ${MY_DIR} ${RESOURCES})
|
||||
|
||||
ADD_DEFINITIONS(-DRESOURCES_INC)
|
||||
ADD_LIBRARY(freenect2 ${SOURCES})
|
||||
SET_TARGET_PROPERTIES(freenect2 PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
VISIBILITY_INLINES_HIDDEN 1
|
||||
VERSION ${PROJECT_VER}
|
||||
SOVERSION ${PROJECT_APIVER}
|
||||
)
|
||||
INCLUDE(GenerateExportHeader)
|
||||
GENERATE_EXPORT_HEADER(freenect2
|
||||
BASE_NAME libfreenect2
|
||||
EXPORT_FILE_NAME libfreenect2/export.h
|
||||
)
|
||||
|
||||
IF(MSVC AND NOT BUILD_SHARED_LIBS)
|
||||
# MSVC creates freenect2.lib for both dynamic and static by default
|
||||
set_target_properties(freenect2 PROPERTIES SUFFIX "static.lib")
|
||||
ENDIF()
|
||||
STRING(REPLACE ";" "\n " LIBRARIES_STRING "${LIBRARIES}")
|
||||
MESSAGE(STATUS "Linking with these libraries: \n ${LIBRARIES_STRING}")
|
||||
TARGET_LINK_LIBRARIES(freenect2 ${LIBRARIES})
|
||||
|
||||
CONFIGURE_FILE(freenect2.cmake.in "${PROJECT_BINARY_DIR}/freenect2Config.cmake" @ONLY)
|
||||
CONFIGURE_FILE(freenect2Version.cmake.in "${PROJECT_BINARY_DIR}/freenect2ConfigVersion.cmake" @ONLY)
|
||||
CONFIGURE_FILE(freenect2.pc.in "${PROJECT_BINARY_DIR}/freenect2.pc" @ONLY)
|
||||
|
||||
INSTALL(TARGETS freenect2 DESTINATION lib RUNTIME DESTINATION bin)
|
||||
INSTALL(DIRECTORY "${MY_DIR}/include/${PROJECT_NAME}" DESTINATION include PATTERN "*.in" EXCLUDE)
|
||||
INSTALL(DIRECTORY "${PROJECT_BINARY_DIR}/${PROJECT_NAME}" DESTINATION include)
|
||||
INSTALL(FILES "${PROJECT_BINARY_DIR}/freenect2Config.cmake" DESTINATION lib/cmake/freenect2/)
|
||||
INSTALL(FILES "${PROJECT_BINARY_DIR}/freenect2ConfigVersion.cmake" DESTINATION lib/cmake/freenect2/)
|
||||
INSTALL(FILES "${PROJECT_BINARY_DIR}/freenect2.pc" DESTINATION lib/pkgconfig/)
|
||||
|
||||
ADD_SUBDIRECTORY(${MY_DIR}/doc)
|
||||
|
||||
SET(HAVE_Examples disabled)
|
||||
IF(BUILD_EXAMPLES)
|
||||
SET(HAVE_Examples yes)
|
||||
MESSAGE(STATUS "Configurating examples")
|
||||
ADD_SUBDIRECTORY(${MY_DIR}/examples)
|
||||
ENDIF()
|
||||
|
||||
SET(HAVE_OpenNI2 disabled)
|
||||
IF(BUILD_OPENNI2_DRIVER)
|
||||
FIND_PACKAGE(OpenNI2)
|
||||
SET(HAVE_OpenNI2 no)
|
||||
IF(OpenNI2_FOUND)
|
||||
SET(HAVE_OpenNI2 yes)
|
||||
FILE(GLOB OPENNI2_DRIVER_SOURCES src/openni2/*.cpp)
|
||||
ADD_LIBRARY(freenect2-openni2 ${OPENNI2_DRIVER_SOURCES} ${LIBFREENECT2_THREADING_SOURCE})
|
||||
TARGET_INCLUDE_DIRECTORIES(freenect2-openni2 PRIVATE ${OpenNI2_INCLUDE_DIRS})
|
||||
TARGET_LINK_LIBRARIES(freenect2-openni2 freenect2 ${LIBFREENECT2_THREADING_LIBRARIES})
|
||||
SET_TARGET_PROPERTIES(freenect2-openni2 PROPERTIES SOVERSION 0)
|
||||
IF(NOT ${CMAKE_INSTALL_PREFIX} MATCHES "^/usr")
|
||||
SET_TARGET_PROPERTIES(freenect2-openni2 PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
ENDIF()
|
||||
INSTALL(TARGETS freenect2-openni2 DESTINATION lib/OpenNI2/Drivers RUNTIME DESTINATION bin)
|
||||
ADD_CUSTOM_TARGET(install-openni2
|
||||
DEPENDS freenect2-openni2
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_INSTALL_PREFIX}/lib/OpenNI2/Drivers/" "${OpenNI2_LIBRARY_DIR}/OpenNI2/Drivers/"
|
||||
VERBATIM
|
||||
)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
OPTION(BUILD_STREAMER_RECORDER "Build streamer_recorder" OFF)
|
||||
SET(HAVE_streamer_recorder disabled)
|
||||
IF(BUILD_STREAMER_RECORDER)
|
||||
SET(HAVE_streamer_recorder yes)
|
||||
MESSAGE(STATUS "Configurating streamer_recorder")
|
||||
ADD_SUBDIRECTORY(${MY_DIR}/tools/streamer_recorder)
|
||||
ENDIF()
|
||||
|
||||
GET_CMAKE_PROPERTY(vars VARIABLES)
|
||||
MESSAGE(STATUS "Feature list:")
|
||||
FOREACH(var ${vars})
|
||||
IF(var MATCHES ^HAVE_)
|
||||
STRING(REPLACE HAVE_ "" feature ${var})
|
||||
MESSAGE(STATUS " ${feature} ${${var}}")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
|
@ -0,0 +1,34 @@
|
|||
Albert Hofkamp <a.t.hofkamp@tue.nl>
|
||||
Alistair <alistair.wk@gmail.com>
|
||||
augmenta <augmenta@augmenta.home>
|
||||
Brendan Burns <bburns@google.com>
|
||||
Christian Kerl <christian.kerl@in.tum.de>
|
||||
Dave Coleman <davetcoleman@gmail.com>
|
||||
Dorian Galvez-Lopez <dorian@email.gwu.edu>
|
||||
Federico Spinelli <fspinelli@gmail.com>
|
||||
Florian Echtler <floe@butterbrot.org>
|
||||
Francisco Facioni <fran6co@gmail.com>
|
||||
Gabor Papp <gabor.papp@gmail.com>
|
||||
Giacomo Dabisias <g.dabisias@sssup.it>
|
||||
Henning Jungkurth <henning.jungkurth@gmail.com>
|
||||
James Billingham <james@jamesbillingham.com>
|
||||
Joshua Blake <joshblake@gmail.com>
|
||||
Lars Glud <larshg@gmail.com>
|
||||
Lingzhu Xiang <lingzhu@lingzhuxiang.com>
|
||||
Ludique <contacto@ludique.cl>
|
||||
Mario Wündsch <dev@wuendsch.net>
|
||||
Matthias Goldhoorn <matthias.goldhoorn@dfki.de>
|
||||
Matthieu FT <matthieu.ft@gmx.fr>
|
||||
MrTatsch <tatsch@gmail.com>
|
||||
Paul Reynolds <paul@blastoffgames.net>
|
||||
P.E. Viau <viau.pe@gmail.com>
|
||||
rahulraw <rahulrawat.can@gmail.com>
|
||||
Rich Wareham <rjw57@cam.ac.uk>
|
||||
Ryan Gordon <ryan@quizlet.com>
|
||||
Sergey Gusarov <laborer2008@gmail.com>
|
||||
Serguei Mokhov <mokhov@cse.concordia.ca>
|
||||
Steffen Fuchs <st.fuchs.tr@gmail.com>
|
||||
Thiemo Wiedemeyer <wiedemeyer@cs.uni-bremen.de>
|
||||
vinouz <vinouz@yahoo.fr>
|
||||
yuanmingze <3054502461@sina.com>
|
||||
Zou Hanya <hanyazou@gmail.com>
|
|
@ -0,0 +1,341 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
|
|
@ -0,0 +1,249 @@
|
|||
# libfreenect2
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Description](README.md#description)
|
||||
* [Requirements](README.md#requirements)
|
||||
* [Troubleshooting](README.md#troubleshooting-and-reporting-bugs)
|
||||
* [Maintainers](README.md#maintainers)
|
||||
* [Installation](README.md#installation)
|
||||
* [Windows / Visual Studio](README.md#windows--visual-studio)
|
||||
* [MacOS](README.md#macos)
|
||||
* [Linux](README.md#linux)
|
||||
* [API Documentation (external)](https://openkinect.github.io/libfreenect2/)
|
||||
|
||||
## Description
|
||||
|
||||
Driver for Kinect for Windows v2 (K4W2) devices (release and developer preview).
|
||||
|
||||
Note: libfreenect2 does not do anything for either Kinect for Windows v1 or Kinect for Xbox 360 sensors. Use libfreenect1 for those sensors.
|
||||
|
||||
If you are using libfreenect2 in an academic context, please cite our work using the following DOI: [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.50641.svg)](https://doi.org/10.5281/zenodo.50641)
|
||||
|
||||
|
||||
|
||||
If you use the KDE depth unwrapping algorithm implemented in the library, please also cite this ECCV 2016 [paper](http://users.isy.liu.se/cvl/perfo/abstracts/jaremo16.html).
|
||||
|
||||
This driver supports:
|
||||
* RGB image transfer
|
||||
* IR and depth image transfer
|
||||
* registration of RGB and depth images
|
||||
|
||||
Missing features:
|
||||
* firmware updates (see [issue #460](https://github.com/OpenKinect/libfreenect2/issues/460) for WiP)
|
||||
|
||||
Watch the OpenKinect wiki at www.openkinect.org and the mailing list at https://groups.google.com/forum/#!forum/openkinect for the latest developments and more information about the K4W2 USB protocol.
|
||||
|
||||
The API reference documentation is provided here https://openkinect.github.io/libfreenect2/.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Hardware requirements
|
||||
|
||||
* USB 3.0 controller. USB 2 is not supported.
|
||||
|
||||
Intel and NEC USB 3.0 host controllers are known to work. ASMedia controllers are known to not work.
|
||||
|
||||
Virtual machines likely do not work, because USB 3.0 isochronous transfer is quite delicate.
|
||||
|
||||
##### Requirements for multiple Kinects
|
||||
|
||||
It has been reported to work for up to 5 devices on a high-end PC using multiple separate PCI Express USB3 expansion cards (with NEC controller chip). If you're using Linux, you may have to [increase USBFS memory buffers](https://github.com/OpenKinect/libfreenect2/wiki/Troubleshooting#multiple-kinects-try-increasing-usbfs-buffer-size). Depending on the number of Kinects, you may need to use an even larger buffer size. If you're using an expansion card, make sure it's not plugged into an PCI-E x1 slot. A single lane doesn't have enough bandwidth. x8 or x16 slots usually work.
|
||||
|
||||
### Operating system requirements
|
||||
|
||||
* Windows 7 (buggy), Windows 8, Windows 8.1, and probably Windows 10
|
||||
* Debian, Ubuntu 14.04 or newer, probably other Linux distros. Recommend kernel 3.16+ or as new as possible.
|
||||
* Mac OS X
|
||||
|
||||
### Requirements for optional features
|
||||
|
||||
* OpenGL depth processing: OpenGL 3.1 (Windows, Linux, Mac OS X). OpenGL ES is not supported at the moment.
|
||||
* OpenCL depth processing: OpenCL 1.1
|
||||
* CUDA depth processing: CUDA (6.5 and 7.5 are tested; The minimum version is not clear.)
|
||||
* VAAPI JPEG decoding: Intel (minimum Ivy Bridge or newer) and Linux only
|
||||
* VideoToolbox JPEG decoding: Mac OS X only
|
||||
* OpenNI2 integration: OpenNI2 2.2.0.33
|
||||
* Jetson TK1: Linux4Tegra 21.3 or later. Check [Jetson TK1 issues](https://github.com/OpenKinect/libfreenect2/wiki/Troubleshooting#jetson-tk1-issues) before installation. Jetson TX1 is not yet supported as the developers don't have one, but it may be easy to add the support.
|
||||
|
||||
## Troubleshooting and reporting bugs
|
||||
|
||||
First, check https://github.com/OpenKinect/libfreenect2/wiki/Troubleshooting for known issues.
|
||||
|
||||
When you report USB issues, please attach relevant debug log from running the program with environment variable `LIBUSB_DEBUG=3`, and relevant log from `dmesg`. Also include relevant hardware information `lspci` and `lsusb -t`.
|
||||
|
||||
## Maintainers
|
||||
|
||||
* Joshua Blake <joshblake@gmail.com>
|
||||
* Florian Echtler
|
||||
* Christian Kerl
|
||||
* Lingzhu Xiang (development/master branch)
|
||||
|
||||
## Installation
|
||||
|
||||
### Windows / Visual Studio
|
||||
|
||||
* Install UsbDk driver
|
||||
|
||||
1. (Windows 7) You must first install Microsoft Security Advisory 3033929 otherwise your USB keyboards and mice will stop working!
|
||||
2. Download the latest x64 installer from https://github.com/daynix/UsbDk/releases, install it.
|
||||
3. If UsbDk somehow does not work, uninstall UsbDk and follow the libusbK instructions.
|
||||
|
||||
This doesn't interfere with the Microsoft SDK. Do not install both UsbDK and libusbK drivers
|
||||
* (Alternatively) Install libusbK driver
|
||||
|
||||
You don't need the Kinect for Windows v2 SDK to build and install libfreenect2, though it doesn't hurt to have it too. You don't need to uninstall the SDK or the driver before doing this procedure.
|
||||
|
||||
Install the libusbK backend driver for libusb. Please follow the steps exactly:
|
||||
|
||||
1. Download Zadig from http://zadig.akeo.ie/.
|
||||
2. Run Zadig and in options, check "List All Devices" and uncheck "Ignore Hubs or Composite Parents"
|
||||
3. Select the "Xbox NUI Sensor (composite parent)" from the drop-down box. (Important: Ignore the "NuiSensor Adaptor" varieties, which are the adapter, NOT the Kinect) The current driver will list usbccgp. USB ID is VID 045E, PID 02C4 or 02D8.
|
||||
4. Select libusbK (v3.0.7.0 or newer) from the replacement driver list.
|
||||
5. Click the "Replace Driver" button. Click yes on the warning about replacing a system driver. (This is because it is a composite parent.)
|
||||
|
||||
To uninstall the libusbK driver (and get back the official SDK driver, if installed):
|
||||
|
||||
1. Open "Device Manager"
|
||||
2. Under "libusbK USB Devices" tree, right click the "Xbox NUI Sensor (Composite Parent)" device and select uninstall.
|
||||
3. Important: Check the "Delete the driver software for this device." checkbox, then click OK.
|
||||
|
||||
If you already had the official SDK driver installed and you want to use it:
|
||||
|
||||
4. In Device Manager, in the Action menu, click "Scan for hardware changes."
|
||||
|
||||
This will enumerate the Kinect sensor again and it will pick up the K4W2 SDK driver, and you should be ready to run KinectService.exe again immediately.
|
||||
|
||||
You can go back and forth between the SDK driver and the libusbK driver very quickly and easily with these steps.
|
||||
|
||||
* Build libusb
|
||||
|
||||
Open a Git shell (GitHub for Windows), or any shell that has access to git.exe and msbuild.exe
|
||||
```
|
||||
cd depends/
|
||||
.\install_libusb_vs2013.cmd
|
||||
```
|
||||
Or `install_libusb_vs2015.cmd`. If you see some errors, you can always open the cmd files and follow the git commands, and maybe build `libusb_201x.sln` with Visual Studio by hand. Building with "Win32" is not recommended as it results in lower performance.
|
||||
* Install TurboJPEG
|
||||
|
||||
Download from http://sourceforge.net/projects/libjpeg-turbo/files, extract it to `c:\libjpeg-turbo64` or `depends/libjpeg-turbo64`, or anywhere as specified by the environment variable `TurboJPEG_ROOT`.
|
||||
* Install GLFW
|
||||
|
||||
Download from http://www.glfw.org/download.html (64-bit), extract as `depends/glfw` (rename `glfw-3.x.x.bin.WIN64` to `glfw`), or anywhere as specified by the environment variable `GLFW_ROOT`.
|
||||
* Install OpenCL (optional)
|
||||
1. Intel GPU: Download "Intel® SDK for OpenCL™ Applications 2016" from https://software.intel.com/en-us/intel-opencl (requires free registration) and install it.
|
||||
* Install CUDA (optional, Nvidia only)
|
||||
1. Download CUDA Toolkit and install it. You MUST install the samples too.
|
||||
* Install OpenNI2 (optional)
|
||||
|
||||
Download OpenNI 2.2.0.33 (x64) from http://structure.io/openni, install it to default locations (`C:\Program Files...`).
|
||||
* Build
|
||||
|
||||
The default installation path is `install`, you may change it by editing `CMAKE_INSTALL_PREFIX`.
|
||||
```
|
||||
mkdir build && cd build
|
||||
cmake .. -G "Visual Studio 12 2013 Win64"
|
||||
cmake --build . --config RelWithDebInfo --target install
|
||||
```
|
||||
Or `-G "Visual Studio 14 2015 Win64"`.
|
||||
* Run the test program: `.\install\bin\Protonect.exe`, or start debugging in Visual Studio.
|
||||
* Test OpenNI2 (optional)
|
||||
|
||||
Copy freenect2-openni2.dll, and other dll files (libusb-1.0.dll, glfw.dll, etc.) in `install\bin` to `C:\Program Files\OpenNI2\Tools\OpenNI2\Drivers`. Then run `C:\Program Files\OpenNI\Tools\NiViewer.exe`. Environment variable `LIBFREENECT2_PIPELINE` can be set to `cl`, `cuda`, etc to specify the pipeline.
|
||||
|
||||
### MacOS
|
||||
|
||||
Use your favorite package managers (brew, ports, etc.) to install most if not all dependencies:
|
||||
|
||||
* Make sure these build tools are available: wget, git, cmake, pkg-config. Xcode may provide some of them. Install the rest via package managers.
|
||||
* Download libfreenect2 source
|
||||
```
|
||||
git clone https://github.com/OpenKinect/libfreenect2.git
|
||||
cd libfreenect2
|
||||
```
|
||||
* Install dependencies: libusb, GLFW
|
||||
```
|
||||
brew update
|
||||
brew install libusb
|
||||
brew install glfw3
|
||||
```
|
||||
* Install TurboJPEG (optional)
|
||||
```
|
||||
brew install jpeg-turbo
|
||||
```
|
||||
* Install CUDA (optional): TODO
|
||||
* Install OpenNI2 (optional)
|
||||
```
|
||||
brew tap brewsci/science
|
||||
brew install openni2
|
||||
export OPENNI2_REDIST=/usr/local/lib/ni2
|
||||
export OPENNI2_INCLUDE=/usr/local/include/ni2
|
||||
```
|
||||
* Build
|
||||
```
|
||||
mkdir build && cd build
|
||||
cmake ..
|
||||
make
|
||||
make install
|
||||
```
|
||||
* Run the test program: `./bin/Protonect`
|
||||
* Test OpenNI2. `make install-openni2` (may need sudo), then run `NiViewer`. Environment variable `LIBFREENECT2_PIPELINE` can be set to `cl`, `cuda`, etc to specify the pipeline.
|
||||
|
||||
### Linux
|
||||
|
||||
Note: Ubuntu 12.04 is too old to support. Debian jessie may also be too old, and Debian stretch is implied in the following.
|
||||
|
||||
* Download libfreenect2 source
|
||||
```
|
||||
git clone https://github.com/OpenKinect/libfreenect2.git
|
||||
cd libfreenect2
|
||||
```
|
||||
* (Ubuntu 14.04 only) Download upgrade deb files
|
||||
```
|
||||
cd depends; ./download_debs_trusty.sh
|
||||
```
|
||||
* Install build tools
|
||||
```
|
||||
sudo apt-get install build-essential cmake pkg-config
|
||||
```
|
||||
* Install libusb. The version must be >= 1.0.20.
|
||||
1. (Ubuntu 14.04 only) `sudo dpkg -i debs/libusb*deb`
|
||||
2. (Other) `sudo apt-get install libusb-1.0-0-dev`
|
||||
* Install TurboJPEG
|
||||
1. (Ubuntu 14.04 to 16.04) `sudo apt-get install libturbojpeg libjpeg-turbo8-dev`
|
||||
2. (Debian/Ubuntu 17.10 and newer) `sudo apt-get install libturbojpeg0-dev`
|
||||
* Install OpenGL
|
||||
1. (Ubuntu 14.04 only) `sudo dpkg -i debs/libglfw3*deb; sudo apt-get install -f`
|
||||
2. (Odroid XU4) OpenGL 3.1 is not supported on this platform. Use `cmake -DENABLE_OPENGL=OFF` later.
|
||||
3. (Other) `sudo apt-get install libglfw3-dev`
|
||||
* Install OpenCL (optional)
|
||||
- Intel GPU
|
||||
1. (Ubuntu 14.04 only) `sudo apt-add-repository ppa:floe/beignet; sudo apt-get update; sudo apt-get install beignet-dev; sudo dpkg -i debs/ocl-icd*deb`
|
||||
2. (Other) `sudo apt-get install beignet-dev`
|
||||
3. For older kernels, `# echo 0 >/sys/module/i915/parameters/enable_cmd_parser` is needed. See more known issues at https://www.freedesktop.org/wiki/Software/Beignet/.
|
||||
- AMD GPU: Install the latest version of the AMD Catalyst drivers from https://support.amd.com and `apt-get install opencl-headers`.
|
||||
- Mali GPU (e.g. Odroid XU4): (with root) `mkdir -p /etc/OpenCL/vendors; echo /usr/lib/arm-linux-gnueabihf/mali-egl/libmali.so >/etc/OpenCL/vendors/mali.icd; apt-get install opencl-headers`.
|
||||
- Verify: You can install `clinfo` to verify if you have correctly set up the OpenCL stack.
|
||||
* Install CUDA (optional, Nvidia only):
|
||||
- (Ubuntu 14.04 only) Download `cuda-repo-ubuntu1404...*.deb` ("deb (network)") from Nvidia website, follow their installation instructions, including `apt-get install cuda` which installs Nvidia graphics driver.
|
||||
- (Jetson TK1) It is preloaded.
|
||||
- (Nvidia/Intel dual GPUs) After `apt-get install cuda`, use `sudo prime-select intel` to use Intel GPU for desktop.
|
||||
- (Other) Follow Nvidia website's instructions. You must install the samples package.
|
||||
* Install VAAPI (optional, Intel only)
|
||||
1. (Ubuntu 14.04 only) `sudo dpkg -i debs/{libva,i965}*deb; sudo apt-get install -f`
|
||||
2. (Other) `sudo apt-get install libva-dev libjpeg-dev`
|
||||
3. Linux kernels 4.1 to 4.3 have performance regression. Use 4.0 and earlier or 4.4 and later (Though Ubuntu kernel 4.2.0-28.33~14.04.1 has backported the fix).
|
||||
* Install OpenNI2 (optional)
|
||||
1. (Ubuntu 14.04 only) `sudo apt-add-repository ppa:deb-rob/ros-trusty && sudo apt-get update` (You don't need this if you have ROS repos), then `sudo apt-get install libopenni2-dev`
|
||||
2. (Other) `sudo apt-get install libopenni2-dev`
|
||||
* Build (if you have run `cd depends` previously, `cd ..` back to the libfreenect2 root directory first.)
|
||||
```
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/freenect2
|
||||
make
|
||||
make install
|
||||
```
|
||||
You need to specify `cmake -Dfreenect2_DIR=$HOME/freenect2/lib/cmake/freenect2` for CMake based third-party application to find libfreenect2.
|
||||
* Set up udev rules for device access: `sudo cp ../platform/linux/udev/90-kinect2.rules /etc/udev/rules.d/`, then replug the Kinect.
|
||||
* Run the test program: `./bin/Protonect`
|
||||
* Run OpenNI2 test (optional): `sudo apt-get install openni2-utils && sudo make install-openni2 && NiViewer2`. Environment variable `LIBFREENECT2_PIPELINE` can be set to `cl`, `cuda`, etc to specify the pipeline.
|
21
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/CheckOpenCLICDLoader.cmake
vendored
Normal file
21
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/CheckOpenCLICDLoader.cmake
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
INCLUDE(CheckCXXSourceCompiles)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
|
||||
SET(CMAKE_REQUIRED_INCLUDES "${MY_DIR}/include/internal" ${OpenCL_INCLUDE_DIRS})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${OpenCL_LIBRARIES})
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <CL/cl.h>
|
||||
int main() {
|
||||
clGetPlatformIDs(0, 0, 0);
|
||||
return 0;
|
||||
}" OpenCL_C_WORKS)
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <CL/cl.hpp>
|
||||
int main() {
|
||||
cl::Context context;
|
||||
cl::Platform platform;
|
||||
cl::Device device;
|
||||
return 0;
|
||||
}" OpenCL_CXX_WORKS)
|
||||
SET(CMAKE_REQUIRED_INCLUDES)
|
||||
SET(CMAKE_REQUIRED_LIBRARIES)
|
75
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindGLFW3.cmake
vendored
Normal file
75
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindGLFW3.cmake
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
# - Try to find GLFW3
|
||||
#
|
||||
# If no pkgconfig, define GLFW_ROOT to installation tree
|
||||
# Will define the following:
|
||||
# GLFW3_FOUND
|
||||
# GLFW3_INCLUDE_DIRS
|
||||
# GLFW3_LIBRARIES
|
||||
|
||||
IF(PKG_CONFIG_FOUND)
|
||||
IF(APPLE)
|
||||
# homebrew or macports pkgconfig locations
|
||||
SET(ENV{PKG_CONFIG_PATH} "/usr/local/opt/glfw3/lib/pkgconfig:/opt/local/lib/pkgconfig")
|
||||
ENDIF()
|
||||
SET(ENV{PKG_CONFIG_PATH} "${DEPENDS_DIR}/glfw/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
|
||||
PKG_CHECK_MODULES(GLFW3 glfw3)
|
||||
|
||||
FIND_LIBRARY(GLFW3_LIBRARY
|
||||
NAMES ${GLFW3_LIBRARIES}
|
||||
HINTS ${GLFW3_LIBRARY_DIRS}
|
||||
)
|
||||
SET(GLFW3_LIBRARIES ${GLFW3_LIBRARY})
|
||||
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(GLFW3_INCLUDE_DIRS
|
||||
GLFW/glfw3.h
|
||||
DOC "GLFW include directory "
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/glfw"
|
||||
"$ENV{ProgramW6432}/glfw"
|
||||
ENV GLFW_ROOT
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
# directories in the official binary package
|
||||
IF(MINGW)
|
||||
SET(_SUFFIX lib-mingw)
|
||||
ELSEIF(MSVC11)
|
||||
SET(_SUFFIX lib-vc2012)
|
||||
ELSEIF(MSVC12)
|
||||
SET(_SUFFIX lib-vc2013)
|
||||
ELSEIF(MSVC14)
|
||||
SET(_SUFFIX lib-vc2015)
|
||||
ELSEIF(MSVC)
|
||||
SET(_SUFFIX lib-vc2012)
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(GLFW3_LIBRARIES
|
||||
NAMES glfw3dll glfw3
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/glfw"
|
||||
"$ENV{ProgramW6432}/glfw"
|
||||
ENV GLFW_ROOT
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
${_SUFFIX}
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_FILE(GLFW3_DLL
|
||||
glfw3.dll
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/glfw"
|
||||
"$ENV{ProgramW6432}/glfw"
|
||||
ENV GLFW_ROOT
|
||||
PATH_SUFFIXES
|
||||
${_SUFFIX}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLFW3 FOUND_VAR GLFW3_FOUND
|
||||
REQUIRED_VARS GLFW3_LIBRARIES GLFW3_INCLUDE_DIRS)
|
80
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindLibUSB.cmake
vendored
Normal file
80
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindLibUSB.cmake
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
# - Find libusb for portable USB support
|
||||
#
|
||||
# If the LibUSB_ROOT environment variable
|
||||
# is defined, it will be used as base path.
|
||||
# The following standard variables get defined:
|
||||
# LibUSB_FOUND: true if LibUSB was found
|
||||
# LibUSB_INCLUDE_DIR: the directory that contains the include file
|
||||
# LibUSB_LIBRARIES: the libraries
|
||||
|
||||
IF(PKG_CONFIG_FOUND)
|
||||
IF(DEPENDS_DIR) #Otherwise use System pkg-config path
|
||||
SET(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPENDS_DIR}/libusb/lib/pkgconfig")
|
||||
ENDIF()
|
||||
SET(MODULE "libusb-1.0")
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
SET(MODULE "libusb-1.0>=1.0.20")
|
||||
ENDIF()
|
||||
IF(LibUSB_FIND_REQUIRED)
|
||||
SET(LibUSB_REQUIRED "REQUIRED")
|
||||
ENDIF()
|
||||
PKG_CHECK_MODULES(LibUSB ${LibUSB_REQUIRED} ${MODULE})
|
||||
|
||||
FIND_LIBRARY(LibUSB_LIBRARY
|
||||
NAMES ${LibUSB_LIBRARIES}
|
||||
HINTS ${LibUSB_LIBRARY_DIRS}
|
||||
)
|
||||
SET(LibUSB_LIBRARIES ${LibUSB_LIBRARY})
|
||||
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(LibUSB_INCLUDE_DIRS
|
||||
NAMES libusb.h
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/libusb"
|
||||
"${DEPENDS_DIR}/libusbx"
|
||||
ENV LibUSB_ROOT
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
libusb
|
||||
include/libusb-1.0
|
||||
)
|
||||
|
||||
SET(LIBUSB_NAME libusb)
|
||||
|
||||
FIND_LIBRARY(LibUSB_LIBRARIES
|
||||
NAMES ${LIBUSB_NAME}-1.0
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/libusb"
|
||||
"${DEPENDS_DIR}/libusbx"
|
||||
ENV LibUSB_ROOT
|
||||
PATH_SUFFIXES
|
||||
x64/Release/dll
|
||||
x64/Debug/dll
|
||||
Win32/Release/dll
|
||||
Win32/Debug/dll
|
||||
MS64
|
||||
MS64/dll
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_FILE(LibUSB_DLL
|
||||
${LIBUSB_NAME}-1.0.dll
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/libusb"
|
||||
"${DEPENDS_DIR}/libusbx"
|
||||
ENV LibUSB_ROOT
|
||||
PATH_SUFFIXES
|
||||
x64/Release/dll
|
||||
x64/Debug/dll
|
||||
Win32/Release/dll
|
||||
Win32/Debug/dll
|
||||
MS64
|
||||
MS64/dll
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUSB FOUND_VAR LibUSB_FOUND
|
||||
REQUIRED_VARS LibUSB_LIBRARIES LibUSB_INCLUDE_DIRS)
|
155
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindOpenCL.cmake
vendored
Normal file
155
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindOpenCL.cmake
vendored
Normal file
|
@ -0,0 +1,155 @@
|
|||
#.rst:
|
||||
# FindOpenCL
|
||||
# ----------
|
||||
#
|
||||
# Try to find OpenCL
|
||||
#
|
||||
# Once done this will define::
|
||||
#
|
||||
# OpenCL_FOUND - True if OpenCL was found
|
||||
# OpenCL_INCLUDE_DIRS - include directories for OpenCL
|
||||
# OpenCL_LIBRARIES - link against this library to use OpenCL
|
||||
# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
|
||||
# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
|
||||
# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation
|
||||
#
|
||||
# The module will also define two cache variables::
|
||||
#
|
||||
# OpenCL_INCLUDE_DIR - the OpenCL include directory
|
||||
# OpenCL_LIBRARY - the path to the OpenCL library
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
# Copyright 2014 Matthaeus G. Chajdas
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
|
||||
# nor the names of their contributors may be used to endorse or promote
|
||||
# products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
|
||||
function(_FIND_OPENCL_VERSION)
|
||||
include(CheckSymbolExists)
|
||||
include(CMakePushCheckState)
|
||||
set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
|
||||
|
||||
CMAKE_PUSH_CHECK_STATE()
|
||||
foreach(VERSION "2_0" "1_2" "1_1" "1_0")
|
||||
set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
|
||||
|
||||
if(APPLE)
|
||||
CHECK_SYMBOL_EXISTS(
|
||||
CL_VERSION_${VERSION}
|
||||
"${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
|
||||
OPENCL_VERSION_${VERSION})
|
||||
else()
|
||||
CHECK_SYMBOL_EXISTS(
|
||||
CL_VERSION_${VERSION}
|
||||
"${OpenCL_INCLUDE_DIR}/CL/cl.h"
|
||||
OPENCL_VERSION_${VERSION})
|
||||
endif()
|
||||
|
||||
if(OPENCL_VERSION_${VERSION})
|
||||
string(REPLACE "_" "." VERSION "${VERSION}")
|
||||
set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
|
||||
string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
|
||||
list(GET version_components 0 major_version)
|
||||
list(GET version_components 1 minor_version)
|
||||
set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
|
||||
set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
CMAKE_POP_CHECK_STATE()
|
||||
endfunction()
|
||||
|
||||
find_path(OpenCL_INCLUDE_DIR
|
||||
NAMES
|
||||
CL/cl.h OpenCL/cl.h
|
||||
PATHS
|
||||
ENV "PROGRAMFILES(X86)"
|
||||
ENV AMDAPPSDKROOT
|
||||
ENV INTELOCLSDKROOT
|
||||
ENV NVSDKCOMPUTE_ROOT
|
||||
ENV CUDA_PATH
|
||||
ENV ATISTREAMSDKROOT
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
OpenCL/common/inc
|
||||
"AMD APP/include")
|
||||
|
||||
_FIND_OPENCL_VERSION()
|
||||
|
||||
if(WIN32)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
find_library(OpenCL_LIBRARY
|
||||
NAMES OpenCL
|
||||
PATHS
|
||||
ENV "PROGRAMFILES(X86)"
|
||||
ENV AMDAPPSDKROOT
|
||||
ENV INTELOCLSDKROOT
|
||||
ENV CUDA_PATH
|
||||
ENV NVSDKCOMPUTE_ROOT
|
||||
ENV ATISTREAMSDKROOT
|
||||
PATH_SUFFIXES
|
||||
"AMD APP/lib/x86"
|
||||
lib/x86
|
||||
lib/Win32
|
||||
OpenCL/common/lib/Win32)
|
||||
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
find_library(OpenCL_LIBRARY
|
||||
NAMES OpenCL
|
||||
PATHS
|
||||
ENV "PROGRAMFILES(X86)"
|
||||
ENV AMDAPPSDKROOT
|
||||
ENV INTELOCLSDKROOT
|
||||
ENV CUDA_PATH
|
||||
ENV NVSDKCOMPUTE_ROOT
|
||||
ENV ATISTREAMSDKROOT
|
||||
PATH_SUFFIXES
|
||||
"AMD APP/lib/x86_64"
|
||||
lib/x86_64
|
||||
lib/x64
|
||||
OpenCL/common/lib/x64)
|
||||
endif()
|
||||
else()
|
||||
find_library(OpenCL_LIBRARY
|
||||
NAMES OpenCL)
|
||||
endif()
|
||||
|
||||
set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
|
||||
set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
OpenCL
|
||||
FOUND_VAR OpenCL_FOUND
|
||||
REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
|
||||
VERSION_VAR OpenCL_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(
|
||||
OpenCL_INCLUDE_DIR
|
||||
OpenCL_LIBRARY)
|
53
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindOpenNI2.cmake
vendored
Normal file
53
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindOpenNI2.cmake
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
# - Find OpenNI2
|
||||
#
|
||||
# If the OPENNI2_INCLUDE and OPENNI2_REDIST environment variables
|
||||
# are defined, they will be used as search path.
|
||||
# The following standard variables get defined:
|
||||
# OpenNI2_FOUND: true if found
|
||||
# OpenNI2_INCLUDE_DIRS: the directory that contains the include file
|
||||
# OpenNI2_LIBRARY_DIR: the directory that contains the library
|
||||
|
||||
IF(PKG_CONFIG_FOUND)
|
||||
PKG_CHECK_MODULES(OpenNI2 libopenni2)
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(OpenNI2_INCLUDE_DIRS
|
||||
NAMES Driver/OniDriverAPI.h
|
||||
PATHS
|
||||
"/opt/include"
|
||||
"/opt/local/include"
|
||||
"/usr/include"
|
||||
"/usr/local/include"
|
||||
ENV OPENNI2_INCLUDE
|
||||
ENV PROGRAMFILES
|
||||
ENV ProgramW6432
|
||||
HINTS ${OpenNI2_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES
|
||||
ni2
|
||||
openni2
|
||||
OpenNI2/Include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(OpenNI2_LIBRARY
|
||||
NAMES OpenNI2 ${OpenNI2_LIBRARIES}
|
||||
PATHS
|
||||
"/opt/lib"
|
||||
"/opt/local/lib"
|
||||
"/usr/lib"
|
||||
"/usr/local/lib"
|
||||
"/usr/local/lib/ni2"
|
||||
ENV OPENNI2_REDIST
|
||||
ENV PROGRAMFILES
|
||||
ENV ProgramW6432
|
||||
HINTS ${OpenNI2_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES
|
||||
ni2/OpenNI2/Drivers
|
||||
OpenNI2/Drivers/lib
|
||||
OpenNI2/Lib
|
||||
)
|
||||
|
||||
GET_FILENAME_COMPONENT(OpenNI2_LIBRARY_DIR ${OpenNI2_LIBRARY} DIRECTORY)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenNI2 FOUND_VAR OpenNI2_FOUND
|
||||
REQUIRED_VARS OpenNI2_LIBRARY_DIR OpenNI2_INCLUDE_DIRS)
|
133
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindTegraJPEG.cmake
vendored
Normal file
133
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindTegraJPEG.cmake
vendored
Normal file
|
@ -0,0 +1,133 @@
|
|||
# FindTegraJPEG.cmake
|
||||
# - TegraJPEG_FOUND
|
||||
# - TegraJPEG_INCLUDE_DIRS
|
||||
# - TegraJPEG_LIBRARIES
|
||||
|
||||
# Detect Linux4Tegra distribution
|
||||
SET(L4T_RELEASE_FILE /etc/nv_tegra_release)
|
||||
IF(EXISTS ${L4T_RELEASE_FILE})
|
||||
SET(TegraJPEG_IS_L4T TRUE)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND sha1sum --quiet -c /etc/nv_tegra_release
|
||||
RESULT_VARIABLE TegraJPEG_DRIVER_ERROR
|
||||
OUTPUT_VARIABLE TegraJPEG_DRIVER_OUTPUT
|
||||
ERROR_QUIET
|
||||
)
|
||||
IF(TegraJPEG_DRIVER_ERROR)
|
||||
MESSAGE(WARNING "Tegra drivers have wrong checksum:\n${TegraJPEG_DRIVER_OUTPUT}")
|
||||
ELSE()
|
||||
SET(TegraJPEG_DRIVER_OK TRUE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Detect L4T version
|
||||
IF(TegraJPEG_IS_L4T)
|
||||
FILE(READ ${L4T_RELEASE_FILE} L4T_RELEASE_CONTENT LIMIT 64 OFFSET 2)
|
||||
STRING(REGEX REPLACE "^R([0-9]*)[^,]*, REVISION: ([0-9.]*).*" "\\1" L4T_VER_MAJOR "${L4T_RELEASE_CONTENT}")
|
||||
STRING(REGEX REPLACE "^R([0-9]*)[^,]*, REVISION: ([0-9.]*).*" "\\2" L4T_VER_MINOR "${L4T_RELEASE_CONTENT}")
|
||||
SET(L4T_VER "${L4T_VER_MAJOR}.${L4T_VER_MINOR}")
|
||||
MESSAGE(STATUS "Found Linux4Tegra ${L4T_VER}")
|
||||
IF(L4T_VER VERSION_LESS 21.3.0)
|
||||
MESSAGE(WARNING "Linux4Tegra version (${L4T_VER}) less than minimum requirement (21.3)")
|
||||
ELSE()
|
||||
SET(TegraJPEG_L4T_OK TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF(L4T_VER MATCHES ^21.3)
|
||||
SET(L4T_SRC_PART r21_Release_v3.0/sources/gstjpeg_src.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^21.4)
|
||||
SET(L4T_SRC_PART r21_Release_v4.0/source/gstjpeg_src.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^21.5)
|
||||
SET(L4T_SRC_PART r21_Release_v5.0/source/gstjpeg_src.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^23.1)
|
||||
SET(L4T_SRC_PART r23_Release_v1.0/source/gstjpeg_src.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^23.2)
|
||||
SET(L4T_SRC_PART r23_Release_v2.0/source/gstjpeg_src.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^24.1)
|
||||
SET(L4T_SRC_PART r24_Release_v1.0/24.1_64bit/source/gstjpeg_src.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^24.2)
|
||||
SET(L4T_SRC_PART r24_Release_v2.0/BSP/sources.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^27.1)
|
||||
SET(L4T_SRC_PART r27_Release_v1.0/BSP/r27.1.0_sources.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^28.1)
|
||||
SET(L4T_SRC_PART r28_Release_v1.0/BSP/source_release.tbz2)
|
||||
ELSEIF(L4T_VER MATCHES ^28.2)
|
||||
SET(L4T_SRC_PART r28_Release_v2.0/BSP/source_release.tbz2)
|
||||
ELSE()
|
||||
MESSAGE(WARNING "Linux4Tegra version (${L4T_VER}) is not recognized. Add the new source URL part to FindTegraJPEG.cmake.")
|
||||
SET(TegraJPEG_L4T_OK FALSE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Download gstjpeg source
|
||||
IF(TegraJPEG_L4T_OK)
|
||||
SET(L4T_SRC_PATH ${DEPENDS_DIR}/source/${L4T_SRC_PART})
|
||||
GET_FILENAME_COMPONENT(L4T_SRC_DIR ${L4T_SRC_PATH} DIRECTORY)
|
||||
IF(NOT EXISTS ${L4T_SRC_PATH})
|
||||
MESSAGE(STATUS "Downloading ${L4T_SRC_PART}...")
|
||||
SET(L4T_SRC_URL "http://developer.download.nvidia.com/embedded/L4T/${L4T_SRC_PART}")
|
||||
# Do we want checksum for the download?
|
||||
FILE(DOWNLOAD ${L4T_SRC_URL} ${L4T_SRC_PATH} STATUS L4T_SRC_STATUS)
|
||||
LIST(GET L4T_SRC_STATUS 0 L4T_SRC_ERROR)
|
||||
LIST(GET L4T_SRC_STATUS 1 L4T_SRC_MSG)
|
||||
IF(L4T_SRC_ERROR)
|
||||
MESSAGE(WARNING "Failed to download ${L4T_SRC_PART}: ${L4T_SRC_MSG}")
|
||||
FILE(REMOVE ${L4T_SRC_PATH})
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
FILE(GLOB_RECURSE L4T_GSTJPEG_PATH ${L4T_SRC_DIR}/gstjpeg_src.tbz2)
|
||||
IF(NOT L4T_GSTJPEG_PATH)
|
||||
MESSAGE(STATUS "Extracting ${L4T_SRC_PART}...")
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xjf ${L4T_SRC_PATH}
|
||||
WORKING_DIRECTORY ${L4T_SRC_DIR}
|
||||
)
|
||||
FILE(GLOB_RECURSE L4T_GSTJPEG_PATH ${L4T_SRC_DIR}/gstjpeg_src.tbz2)
|
||||
ENDIF()
|
||||
|
||||
IF(L4T_GSTJPEG_PATH)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xjf ${L4T_GSTJPEG_PATH}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
RESULT_VARIABLE L4T_HEADERS_ERROR
|
||||
ERROR_VARIABLE L4T_HEADERS_MSG
|
||||
)
|
||||
IF(L4T_HEADERS_ERROR)
|
||||
MESSAGE(WARNING "Failed to unpack ${L4T_GSTJPEG_PATH}: ${L4T_HEADERS_MSG}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
FIND_PATH(TegraJPEG_INCLUDE_DIRS
|
||||
nv_headers/jpeglib.h
|
||||
DOC "Found TegraJPEG include directory"
|
||||
PATHS ${CMAKE_BINARY_DIR}/gstjpeg_src
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(TegraJPEG_LIBRARIES
|
||||
NAMES nvjpeg
|
||||
DOC "Found TegraJPEG library (libnvjpeg.so)"
|
||||
PATH_SUFFIXES tegra
|
||||
)
|
||||
|
||||
FIND_LIBRARY(TegraJPEG_LIBRARIES
|
||||
NAMES jpeg
|
||||
DOC "Found TegraJPEG library (libjpeg.so)"
|
||||
PATHS /usr/lib/arm-linux-gnueabihf/tegra
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
IF(TegraJPEG_INCLUDE_DIRS AND TegraJPEG_LIBRARIES)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${TegraJPEG_INCLUDE_DIRS})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${TegraJPEG_LIBRARIES})
|
||||
check_c_source_compiles("#include <stdio.h>\n#include <nv_headers/jpeglib.h>\nint main() { struct jpeg_decompress_struct d; jpeg_create_decompress(&d); d.jpegTegraMgr = 0; d.input_frame_buf = 0; return 0; }" TegraJPEG_WORKS)
|
||||
set(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TegraJPEG FOUND_VAR TegraJPEG_FOUND
|
||||
REQUIRED_VARS TegraJPEG_LIBRARIES TegraJPEG_INCLUDE_DIRS TegraJPEG_L4T_OK TegraJPEG_DRIVER_OK TegraJPEG_WORKS)
|
67
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindTurboJPEG.cmake
vendored
Normal file
67
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/FindTurboJPEG.cmake
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
# FindTurboJPEG.cmake
|
||||
# Uses environment variable TurboJPEG_ROOT as backup
|
||||
# - TurboJPEG_FOUND
|
||||
# - TurboJPEG_INCLUDE_DIRS
|
||||
# - TurboJPEG_LIBRARIES
|
||||
|
||||
FIND_PATH(TurboJPEG_INCLUDE_DIRS
|
||||
turbojpeg.h
|
||||
DOC "Found TurboJPEG include directory"
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/libjpeg_turbo"
|
||||
"${DEPENDS_DIR}/libjpeg-turbo64"
|
||||
"/usr/local/opt/jpeg-turbo" # homebrew
|
||||
"/opt/local" # macports
|
||||
"C:/libjpeg-turbo64"
|
||||
"/opt/libjpeg-turbo"
|
||||
ENV TurboJPEG_ROOT
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
)
|
||||
|
||||
#Library names:
|
||||
# debian sid,strech: libturbojpeg0
|
||||
# debian/ubuntu else: libturbojpeg1-dev #provided by libjpeg-turbo8-dev (ubuntu)
|
||||
FIND_LIBRARY(TurboJPEG_LIBRARIES
|
||||
NAMES libturbojpeg.so.1 libturbojpeg.so.0 turbojpeg
|
||||
DOC "Found TurboJPEG library path"
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/libjpeg_turbo"
|
||||
"${DEPENDS_DIR}/libjpeg-turbo64"
|
||||
"/usr/local/opt/jpeg-turbo" # homebrew
|
||||
"/opt/local" # macports
|
||||
"C:/libjpeg-turbo64"
|
||||
"/opt/libjpeg-turbo"
|
||||
ENV TurboJPEG_ROOT
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
lib64
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
FIND_FILE(TurboJPEG_DLL
|
||||
turbojpeg.dll
|
||||
DOC "Found TurboJPEG DLL path"
|
||||
PATHS
|
||||
"${DEPENDS_DIR}/libjpeg_turbo"
|
||||
"${DEPENDS_DIR}/libjpeg-turbo64"
|
||||
"C:/libjpeg-turbo64"
|
||||
ENV TurboJPEG_ROOT
|
||||
PATH_SUFFIXES
|
||||
bin
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
IF(TurboJPEG_INCLUDE_DIRS AND TurboJPEG_LIBRARIES)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
set(CMAKE_REQUIRED_INCLUDES ${TurboJPEG_INCLUDE_DIRS})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${TurboJPEG_LIBRARIES})
|
||||
check_c_source_compiles("#include <turbojpeg.h>\nint main(void) { tjhandle h=tjInitCompress(); return 0; }" TURBOJPEG_WORKS)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS)
|
||||
set(CMAKE_REQUIRED_INCLUDES)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(TurboJPEG FOUND_VAR TurboJPEG_FOUND
|
||||
REQUIRED_VARS TurboJPEG_LIBRARIES TurboJPEG_INCLUDE_DIRS TURBOJPEG_WORKS)
|
14
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/GenerateResources.cmake
vendored
Normal file
14
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/GenerateResources.cmake
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
FUNCTION(GENERATE_RESOURCES OUTPUT BASE_FOLDER)
|
||||
|
||||
ADD_EXECUTABLE(generate_resources_tool
|
||||
tools/generate_resources.cpp
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${OUTPUT}
|
||||
COMMAND generate_resources_tool ${BASE_FOLDER} ${ARGN} > ${OUTPUT}
|
||||
WORKING_DIRECTORY ${BASE_FOLDER}
|
||||
DEPENDS generate_resources_tool ${ARGN}
|
||||
)
|
||||
|
||||
ENDFUNCTION(GENERATE_RESOURCES)
|
44
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/SetupLibfreenect2Threading.cmake
vendored
Normal file
44
Code/RK3588/PIBot_ROS/third_party/libfreenect2/cmake_modules/SetupLibfreenect2Threading.cmake
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
INCLUDE(CheckCXXSourceCompiles)
|
||||
|
||||
IF(COMPILER_SUPPORTS_CXX0X OR COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_SOURCE_COMPILES("
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <chrono>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
std::thread thread;
|
||||
std::mutex mutex;
|
||||
std::lock_guard<std::mutex> lock_guard(mutex);
|
||||
std::unique_lock<std::mutex> unique_lock(mutex);
|
||||
std::condition_variable condition_variable;
|
||||
//thread_local int i; // libfreenect is not using this feature, Mac OSX doesn't support it
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
" LIBFREENECT2_THREADING_STDLIB)
|
||||
ENDIF()
|
||||
|
||||
IF(LIBFREENECT2_THREADING_STDLIB)
|
||||
SET(LIBFREENECT2_THREADING "stdlib")
|
||||
SET(LIBFREENECT2_THREADING_INCLUDE_DIR "")
|
||||
SET(LIBFREENECT2_THREADING_SOURCE "")
|
||||
SET(LIBFREENECT2_THREADING_LIBRARIES "")
|
||||
SET(LIBFREENECT2_THREADING_STDLIB 1)
|
||||
SET(HAVE_Threading std::thread)
|
||||
ELSE(LIBFREENECT2_THREADING_STDLIB)
|
||||
SET(LIBFREENECT2_THREADING "tinythread")
|
||||
SET(LIBFREENECT2_THREADING_INCLUDE_DIR "src/tinythread/")
|
||||
SET(LIBFREENECT2_THREADING_SOURCE "src/tinythread/tinythread.cpp")
|
||||
IF(NOT WIN32)
|
||||
SET(LIBFREENECT2_THREADING_LIBRARIES "pthread")
|
||||
ELSE(NOT WIN32)
|
||||
SET(LIBFREENECT2_THREADING_LIBRARIES "")
|
||||
ENDIF(NOT WIN32)
|
||||
SET(LIBFREENECT2_THREADING_TINYTHREAD 1)
|
||||
SET(HAVE_Threading tinythread)
|
||||
ENDIF(LIBFREENECT2_THREADING_STDLIB)
|
||||
|
||||
MESSAGE(STATUS "using ${LIBFREENECT2_THREADING} as threading library")
|
|
@ -0,0 +1,49 @@
|
|||
Source code: https://github.com/OpenKinect/libfreenect2
|
||||
API reference: http://openkinect.github.io/libfreenect2
|
||||
|
||||
This release is x64 only with basic features enabled. If you want better performance or extra features, you will have to build it from source.
|
||||
|
||||
glfw3.dll, turbojpeg.dll, and libusb-1.0.dll are provided for convenience. You can download and upgrade them yourself.
|
||||
|
||||
"lib" and "include" directories contains libraries and headers. Configure your IDE respectively.
|
||||
|
||||
You must have or install respective version of VC++ runtime, if you are using a -vs201x release variant.
|
||||
|
||||
To try out the OpenNI2 example, copy bin\*.dll to C:\Program Files\OpenNI2\Tools\OpenNI2\Drivers, then run C:\Program Files\OpenNI\Tools\NiViewer.exe.
|
||||
|
||||
You must choose one USB driver backend and follow respective instructions:
|
||||
|
||||
a. UsbDk backend:
|
||||
|
||||
1. (Windows 7) You must first install Microsoft Security Advisory 3033929 otherwise your USB keyboards and mice will stop working!
|
||||
2. Download the latest x64 installer from https://github.com/daynix/UsbDk/releases, install it.
|
||||
3. If UsbDk somehow does not work, uninstall UsbDk and follow the libusbK instructions.
|
||||
|
||||
UsbDk overrides libusbK and Microsoft SDK. If you want to use the latter two, just uninstall UsbDk.
|
||||
|
||||
b. libusbK backend:
|
||||
|
||||
You don't need the Kinect for Windows v2 SDK to build and install libfreenect2, though it doesn't hurt to have it too. You don't need to uninstall the SDK or the driver before doing this procedure.
|
||||
|
||||
Install the libusbK backend driver for libusb. Please follow the steps exactly:
|
||||
|
||||
1. Download Zadig from http://zadig.akeo.ie/
|
||||
2. Run Zadig and in options, check "List All Devices" and uncheck "Ignore Hubs or Composite Parents"
|
||||
3. Select the "Xbox NUI Sensor (composite parent)" from the drop-down box. (Important: Ignore the "NuiSensor Adaptor" varieties, which are the adapter, NOT the Kinect) The current driver will list usbccgp. USB ID is VID 045E, PID 02C4 or 02D8.
|
||||
4. Select libusbK (v3.0.7.0 or newer) from the replacement driver list.
|
||||
5. Click the "Replace Driver" button. Click yes on the warning about replacing a system driver. (This is because it is a composite parent.)
|
||||
6. Done.
|
||||
|
||||
To uninstall the libusbK driver (and get back the official SDK driver, if installed):
|
||||
|
||||
1. Open Device Manager
|
||||
2. Under "libusbK USB Devices" tree, right click the "Xbox NUI Sensor (Composite Parent)" device and select uninstall.
|
||||
3. Important: Check the "Delete the driver software for this device." checkbox, then click OK.
|
||||
|
||||
If you already had the official SDK driver installed and you want to use it:
|
||||
|
||||
1.In Device Manager, in the Action menu, click "Scan for hardware changes."
|
||||
|
||||
This will enumerate the Kinect sensor again and it will pick up the K4W2 SDK driver, and you should be ready to run KinectService.exe again immediately.
|
||||
|
||||
You can go back and forth between the SDK driver and the libusbK driver very quickly and easily with these steps.
|
|
@ -0,0 +1,287 @@
|
|||
freenect2.dll, Protonect.exe, include/*, lib/*
|
||||
----------------------------------------------
|
||||
|
||||
The source code and build system can be found at
|
||||
https://github.com/OpenKinect/libfreenect2
|
||||
|
||||
Copyright (c) 2014-2015 individual OpenKinect contributors.
|
||||
|
||||
This code is licensed to you under the terms of the Apache License, version
|
||||
2.0, or, at your option, the terms of the GNU General Public License,
|
||||
version 2.0. See the APACHE20 and GPL2 files for the text of the licenses,
|
||||
or the following URLs:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
|
||||
If you redistribute this file in source form, modified or unmodified, you
|
||||
may:
|
||||
1) Leave this header intact and distribute it under the same terms,
|
||||
accompanying it with the APACHE20 and GPL20 files, or
|
||||
2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
|
||||
3) Delete the GPL v2 clause and accompany it with the APACHE20 file
|
||||
In all cases you must keep the copyright notice intact and include a copy
|
||||
of the CONTRIB file.
|
||||
|
||||
Binary distributions must follow the binary distribution requirements of
|
||||
either License.
|
||||
|
||||
This project incorporates the following code under respective licenses:
|
||||
|
||||
* cl.hpp
|
||||
|
||||
Source: https://www.khronos.org/registry/cl/api/2.1/cl.hpp
|
||||
|
||||
Copyright (c) 2008-2015 The Khronos Group Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and/or associated documentation files (the
|
||||
"Materials"), to deal in the Materials without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
permit persons to whom the Materials are furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Materials.
|
||||
|
||||
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
|
||||
* tinythread.cpp, tinythread.h
|
||||
|
||||
Copyright (c) 2010-2012 Marcus Geelnard
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
* flextGL.cpp, flextGL.h
|
||||
|
||||
Generated from flextGL https://github.com/ginkgo/flextGL
|
||||
|
||||
Copyright (C) 2011 by Thomas Weber
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
* openni2/*, freenect2-openni2.dll
|
||||
|
||||
Modified from: https://github.com/OpenKinect/libfreenect/tree/master/OpenNI2-FreenectDriver
|
||||
|
||||
Original copyright & licenses granted https://github.com/openkinect/libfreenect2/pull/302#issuecomment-118514016
|
||||
|
||||
Copyright (c) 2014 Benn Snyder
|
||||
|
||||
This code is licensed to you under the terms of the Apache License, version
|
||||
2.0, or, at your option, the terms of the GNU General Public License,
|
||||
version 2.0. See the APACHE20 and GPL2 files for the text of the licenses,
|
||||
or the following URLs:
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
|
||||
If you redistribute this file in source form, modified or unmodified, you
|
||||
may:
|
||||
1) Leave this header intact and distribute it under the same terms,
|
||||
accompanying it with the APACHE20 and GPL20 files, or
|
||||
2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
|
||||
3) Delete the GPL v2 clause and accompany it with the APACHE20 file
|
||||
In all cases you must keep the copyright notice intact and include a copy
|
||||
of the CONTRIB file.
|
||||
|
||||
Binary distributions must follow the binary distribution requirements of
|
||||
either License.
|
||||
|
||||
turbojpeg.dll
|
||||
-------------
|
||||
|
||||
Copyright (C) 1991-2010 Thomas G. Lane
|
||||
Copyright (C) 1991-2011 Guido Vollbeding
|
||||
Copyright (C) 1999-2006 MIYASAKA Masaru
|
||||
Copyright (C) 2009-2011 D. R. Commander
|
||||
Copyright (C) 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)
|
||||
|
||||
This software is based in part on the work of the Independent JPEG Group.
|
||||
|
||||
In plain English:
|
||||
|
||||
1. We don't promise that this software works. (But if you find any bugs,
|
||||
please let us know!)
|
||||
2. You can use this software for whatever you want. You don't have to pay us.
|
||||
3. You may not pretend that you wrote this software. If you use it in a
|
||||
program, you must acknowledge somewhere in your documentation that
|
||||
you've used the IJG code.
|
||||
|
||||
In legalese:
|
||||
|
||||
The authors make NO WARRANTY or representation, either express or implied,
|
||||
with respect to this software, its quality, accuracy, merchantability, or
|
||||
fitness for a particular purpose. This software is provided "AS IS", and you,
|
||||
its user, assume the entire risk as to its quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
software (or portions thereof) for any purpose, without fee, subject to these
|
||||
conditions:
|
||||
(1) If any part of the source code for this software is distributed, then this
|
||||
README file must be included, with this copyright and no-warranty notice
|
||||
unaltered; and any additions, deletions, or changes to the original files
|
||||
must be clearly indicated in accompanying documentation.
|
||||
(2) If only executable code is distributed, then the accompanying
|
||||
documentation must state that "this software is based in part on the work of
|
||||
the Independent JPEG Group".
|
||||
(3) Permission for use of this software is granted only if the user accepts
|
||||
full responsibility for any undesirable consequences; the authors accept
|
||||
NO LIABILITY for damages of any kind.
|
||||
|
||||
These conditions apply to any software derived from or based on the IJG code,
|
||||
not just to the unmodified library. If you use our work, you ought to
|
||||
acknowledge us.
|
||||
|
||||
Permission is NOT granted for the use of any IJG author's name or company name
|
||||
in advertising or publicity relating to this software or products derived from
|
||||
it. This software may be referred to only as "the Independent JPEG Group's
|
||||
software".
|
||||
|
||||
We specifically permit and encourage the use of this software as the basis of
|
||||
commercial products, provided that all warranty or liability claims are
|
||||
assumed by the product vendor.
|
||||
|
||||
The Unix configuration script "configure" was produced with GNU Autoconf.
|
||||
It is copyright by the Free Software Foundation but is freely distributable.
|
||||
The same holds for its supporting scripts (config.guess, config.sub,
|
||||
ltmain.sh). Another support script, install-sh, is copyright by X Consortium
|
||||
but is also freely distributable.
|
||||
|
||||
The IJG distribution formerly included code to read and write GIF files.
|
||||
To avoid entanglement with the Unisys LZW patent, GIF reading support has
|
||||
been removed altogether, and the GIF writer has been simplified to produce
|
||||
"uncompressed GIFs". This technique does not use the LZW algorithm; the
|
||||
resulting GIF files are larger than usual, but are readable by all standard
|
||||
GIF decoders.
|
||||
|
||||
We are required to state that
|
||||
"The Graphics Interchange Format(c) is the Copyright property of
|
||||
CompuServe Incorporated. GIF(sm) is a Service Mark property of
|
||||
CompuServe Incorporated."
|
||||
|
||||
TurboJPEG API library:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
- Neither the name of the libjpeg-turbo Project nor the names of its
|
||||
contributors may be used to endorse or promote products derived from this
|
||||
software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
glfw3.dll
|
||||
---------
|
||||
|
||||
Redistributed from http://www.glfw.org/ .
|
||||
|
||||
Copyright (C) 2006-2013 Camilla Berglund <elmindreda@elmindreda.org>
|
||||
Copyright (C) 2002-2006 Marcus Geelnard
|
||||
|
||||
License: zlib/libpng
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would
|
||||
be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
libusb-1.0.dll
|
||||
--------------
|
||||
|
||||
Built from source code obtained https://github.com/libusb/libusb
|
||||
and patched with the "winiso" branch from
|
||||
https://github.com/JoshBlake/libusbx.git
|
||||
|
||||
The binary can be rebuilt using install_libusb_vs2015.cmd
|
||||
from https://github.com/OpenKinect/libfreenect2
|
||||
|
||||
Copyright (C) 2001-2015 libusb authors
|
||||
|
||||
License: LGPL 2.1
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
||||
MA 02110-1301 USA.
|
31
Code/RK3588/PIBot_ROS/third_party/libfreenect2/depends/download_debs_trusty.sh
vendored
Normal file
31
Code/RK3588/PIBot_ROS/third_party/libfreenect2/depends/download_debs_trusty.sh
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cd `dirname $0`
|
||||
ARCH=`/usr/bin/dpkg --print-architecture`
|
||||
|
||||
# download standalone packages for 14.04 LTS
|
||||
if [ "$ARCH" = amd64 -o "$ARCH" = i386 ]; then
|
||||
REPO=http://archive.ubuntu.com/ubuntu
|
||||
else
|
||||
REPO=http://ports.ubuntu.com/ubuntu-ports
|
||||
fi
|
||||
|
||||
download() {
|
||||
path=$1
|
||||
ver=$2
|
||||
mkdir -p debs
|
||||
shift 2
|
||||
for pkg in "$@"; do
|
||||
wget -nv -N -P debs -nv $REPO/pool/$path/${pkg}_${ver}_${ARCH}.deb
|
||||
done
|
||||
}
|
||||
|
||||
download main/libu/libusb-1.0 1.0.20-1 libusb-1.0-0-dev libusb-1.0-0
|
||||
download universe/g/glfw3 3.1.2-3 libglfw3-dev libglfw3
|
||||
download main/o/ocl-icd 2.2.8-1 ocl-icd-libopencl1 ocl-icd-opencl-dev
|
||||
if [ "$ARCH" = amd64 -o "$ARCH" = i386 ]; then
|
||||
download universe/libv/libva 1.7.0-1 libva-dev libva-drm1 libva-egl1 libva-glx1 libva-tpi1 libva-wayland1 libva-x11-1 libva1 vainfo
|
||||
download main/i/intel-vaapi-driver 1.7.0-1 i965-va-driver
|
||||
fi
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd `dirname $0`
|
||||
DEPENDS_DIR=`pwd`
|
||||
|
||||
# glfw
|
||||
GLFW_SOURCE_DIR=$DEPENDS_DIR/glfw_src
|
||||
GLFW_INSTALL_DIR=$DEPENDS_DIR/glfw
|
||||
|
||||
rm -rf $GLFW_SOURCE_DIR $GLFW_INSTALL_DIR
|
||||
|
||||
git clone https://github.com/glfw/glfw.git $GLFW_SOURCE_DIR
|
||||
cd $GLFW_SOURCE_DIR
|
||||
git checkout 3.0.4
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$GLFW_INSTALL_DIR -DBUILD_SHARED_LIBS=TRUE ..
|
||||
make && make install
|
||||
|
||||
cd $DEPENDS_DIR
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
cd `dirname $0`
|
||||
DEPENDS_DIR=`pwd`
|
||||
|
||||
# libusbx with superspeed patch
|
||||
LIBUSB_SOURCE_DIR=$DEPENDS_DIR/libusb_src
|
||||
LIBUSB_INSTALL_DIR=$DEPENDS_DIR/libusb
|
||||
|
||||
rm -rf $LIBUSB_SOURCE_DIR $LIBUSB_INSTALL_DIR
|
||||
|
||||
git clone https://github.com/libusb/libusb.git $LIBUSB_SOURCE_DIR
|
||||
|
||||
cd $LIBUSB_SOURCE_DIR
|
||||
git checkout v1.0.20
|
||||
./bootstrap.sh
|
||||
./configure --prefix=$LIBUSB_INSTALL_DIR
|
||||
make && make install
|
||||
|
||||
cd $DEPENDS_DIR
|
||||
|
20
Code/RK3588/PIBot_ROS/third_party/libfreenect2/depends/install_libusb_vs2013.cmd
vendored
Normal file
20
Code/RK3588/PIBot_ROS/third_party/libfreenect2/depends/install_libusb_vs2013.cmd
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
rem This can only be run in a Git Shell or similar environments
|
||||
rem with access to git.exe and msbuild.exe.
|
||||
|
||||
rmdir /s /q libusb_src libusb
|
||||
|
||||
git clone https://github.com/libusb/libusb.git libusb_src || exit /b
|
||||
cd libusb_src
|
||||
|
||||
set CONFIG=Release
|
||||
set YEAR=2013
|
||||
set MSBUILD="C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"
|
||||
|
||||
%MSBUILD% msvc\libusb_dll_%YEAR%.vcxproj /p:Platform=x64 /p:Configuration=%CONFIG% /target:Rebuild || exit /b
|
||||
|
||||
mkdir ..\libusb\include\libusb-1.0
|
||||
copy libusb\libusb.h ..\libusb\include\libusb-1.0
|
||||
mkdir ..\libusb\MS64\dll
|
||||
copy x64\%CONFIG%\dll\*.lib ..\libusb\MS64\dll
|
||||
copy x64\%CONFIG%\dll\*.dll ..\libusb\MS64\dll
|
||||
copy x64\%CONFIG%\dll\*.pdb ..\libusb\MS64\dll
|
20
Code/RK3588/PIBot_ROS/third_party/libfreenect2/depends/install_libusb_vs2015.cmd
vendored
Normal file
20
Code/RK3588/PIBot_ROS/third_party/libfreenect2/depends/install_libusb_vs2015.cmd
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
rem This can only be run in a Git Shell or similar environments
|
||||
rem with access to git.exe and msbuild.exe.
|
||||
|
||||
rmdir /s /q libusb_src libusb
|
||||
|
||||
git clone https://github.com/libusb/libusb.git libusb_src || exit /b
|
||||
cd libusb_src
|
||||
|
||||
set CONFIG=Release
|
||||
set YEAR=2015
|
||||
set MSBUILD="C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
|
||||
|
||||
%MSBUILD% msvc\libusb_dll_%YEAR%.vcxproj /p:Platform=x64 /p:Configuration=%CONFIG% /target:Rebuild || exit /b
|
||||
|
||||
mkdir ..\libusb\include\libusb-1.0
|
||||
copy libusb\libusb.h ..\libusb\include\libusb-1.0
|
||||
mkdir ..\libusb\MS64\dll
|
||||
copy x64\%CONFIG%\dll\*.lib ..\libusb\MS64\dll
|
||||
copy x64\%CONFIG%\dll\*.dll ..\libusb\MS64\dll
|
||||
copy x64\%CONFIG%\dll\*.pdb ..\libusb\MS64\dll
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd `dirname $0`
|
||||
ARCH=`/usr/bin/dpkg --print-architecture`
|
||||
|
||||
# download standalone packages for 14.04 LTS
|
||||
if [ "$ARCH" = amd64 -o "$ARCH" = i386 ]; then
|
||||
REPO=http://archive.ubuntu.com/ubuntu
|
||||
else
|
||||
REPO=http://ports.ubuntu.com/ubuntu-ports
|
||||
fi
|
||||
wget -N $REPO/pool/universe/g/glfw3/libglfw3_3.0.4-1_${ARCH}.deb
|
||||
wget -N $REPO/pool/universe/g/glfw3/libglfw3-dev_3.0.4-1_${ARCH}.deb
|
||||
|
||||
cat <<-EOT
|
||||
|
||||
Execute the following commands to install the remaining dependencies (if you have not already done so):
|
||||
|
||||
sudo dpkg -i libglfw3*_3.0.4-1_*.deb
|
||||
sudo apt-get install build-essential cmake pkg-config libturbojpeg libjpeg-turbo8-dev mesa-common-dev freeglut3-dev libxrandr-dev libxi-dev
|
||||
sudo apt-get install libturbojpeg0-dev # (Debian)
|
||||
|
||||
EOT
|
||||
|
34
Code/RK3588/PIBot_ROS/third_party/libfreenect2/depends/make_release_msvc.cmd
vendored
Normal file
34
Code/RK3588/PIBot_ROS/third_party/libfreenect2/depends/make_release_msvc.cmd
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
@echo off
|
||||
set ver=%1
|
||||
set vs_year=%2
|
||||
if "%vs_year%"=="2015" (
|
||||
set vs_ver=14
|
||||
) else (
|
||||
if "%vs_year%"=="2013" (
|
||||
set vs_ver=12
|
||||
) else (
|
||||
echo Unsupported MSVC version. Usage: %~nx0 version vs_year >&2
|
||||
exit /b
|
||||
)
|
||||
)
|
||||
@echo on
|
||||
|
||||
pushd .
|
||||
call install_libusb_vs%vs_year%.cmd
|
||||
popd
|
||||
|
||||
rmdir /s /q build
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..\.. -G "Visual Studio %vs_ver% %vs_year% Win64" -DENABLE_OPENCL=OFF -DENABLE_CUDA=OFF
|
||||
cmake --build . --config Release --target install
|
||||
|
||||
rmdir /s /q install\lib\cmake
|
||||
rmdir /s /q install\lib\pkgconfig
|
||||
copy ..\LICENSES.txt install
|
||||
copy ..\INSTALL-windows.txt install
|
||||
copy ..\..\CONTRIB install
|
||||
cd ..
|
||||
rmdir /s /q libfreenect2-%ver%-vs%vs_year%-x64
|
||||
move build\install libfreenect2-%ver%-vs%vs_year%-x64
|
||||
rmdir /s /q build
|
|
@ -0,0 +1,8 @@
|
|||
find_package(Doxygen)
|
||||
IF(DOXYGEN_FOUND)
|
||||
CONFIGURE_FILE(Doxyfile.in "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" @ONLY)
|
||||
add_custom_target(
|
||||
doc
|
||||
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
|
||||
)
|
||||
ENDIF()
|
|
@ -0,0 +1,36 @@
|
|||
@import url(https://fonts.googleapis.com/css?family=Lato:400,700|Roboto+Mono:400);
|
||||
|
||||
body, table, div, p, dl, table.directory, div.toc li, div.toc h3, div.summary, div.ingroups, .tabsearch, .directory .levels, span.mlabel {
|
||||
font: 400 18px/24px Lato,sans-serif;
|
||||
}
|
||||
.title, .icon, .navpath li.navelem a, #projectname, #projectbrief, #projectnumber, #powerTip div, .tabs, .tabs2, .tabs3 {
|
||||
font-family: Lato,sans-serif;
|
||||
}
|
||||
|
||||
#projectname {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.icon {
|
||||
height: 100%;
|
||||
}
|
||||
.title {
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
code {
|
||||
font: 400 16px/20px Roboto Mono,monospace;
|
||||
}
|
||||
pre.fragment, div.line, .params .paramdir {
|
||||
font-family: Roboto Mono,monospace;
|
||||
}
|
||||
|
||||
p, li {
|
||||
max-width: 50em;
|
||||
}
|
||||
|
||||
div.contents, #titlearea, div.header, div.navpath ul, .tabs, .tabs2, .tabs3 {
|
||||
padding-left: 5em;
|
||||
padding-right: 5em;
|
||||
}
|
||||
|
|
@ -0,0 +1,174 @@
|
|||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = @PROJECT_NAME@
|
||||
PROJECT_NUMBER = @PROJECT_APIVER@
|
||||
PROJECT_BRIEF =
|
||||
PROJECT_LOGO =
|
||||
OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF =
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
|
||||
STRIP_FROM_INC_PATH = @CMAKE_SOURCE_DIR@/include
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 4
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
OPTIMIZE_FOR_FORTRAN = NO
|
||||
OPTIMIZE_OUTPUT_VHDL = NO
|
||||
EXTENSION_MAPPING =
|
||||
MARKDOWN_SUPPORT = YES
|
||||
AUTOLINK_SUPPORT = YES
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
IDL_PROPERTY_SUPPORT = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
INLINE_GROUPED_CLASSES = NO
|
||||
INLINE_SIMPLE_STRUCTS = NO
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
LOOKUP_CACHE_SIZE = 0
|
||||
|
||||
EXTRACT_ALL = YES
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_PACKAGE = NO
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = YES
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
SHOW_GROUPED_MEMB_INC = NO
|
||||
FORCE_LOCAL_INCLUDES = NO
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = NO
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_MEMBERS_CTORS_1ST = YES
|
||||
SORT_GROUP_NAMES = YES
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
STRICT_PROTO_MATCHING = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = NO
|
||||
SHOW_FILES = YES
|
||||
SHOW_NAMESPACES = NO
|
||||
FILE_VERSION_FILTER =
|
||||
LAYOUT_FILE =
|
||||
CITE_BIB_FILES =
|
||||
|
||||
QUIET = YES
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = NO
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = YES
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
|
||||
INPUT = @CMAKE_SOURCE_DIR@/include @CMAKE_CURRENT_SOURCE_DIR@/mainpage.dox
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS =
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS = */include/internal/*
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH = @CMAKE_SOURCE_DIR@/examples
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
FILTER_SOURCE_PATTERNS =
|
||||
USE_MDFILE_AS_MAINPAGE =
|
||||
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
SOURCE_TOOLTIPS = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = NO
|
||||
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_EXTRA_STYLESHEET = @CMAKE_CURRENT_SOURCE_DIR@/Doxyextra.css
|
||||
HTML_EXTRA_FILES =
|
||||
HTML_COLORSTYLE_HUE = 220
|
||||
HTML_COLORSTYLE_SAT = 100
|
||||
HTML_COLORSTYLE_GAMMA = 80
|
||||
HTML_TIMESTAMP = YES
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
HTML_INDEX_NUM_ENTRIES = 100
|
||||
GENERATE_DOCSET = NO
|
||||
GENERATE_HTMLHELP = NO
|
||||
GENERATE_QHP = NO
|
||||
GENERATE_ECLIPSEHELP = NO
|
||||
DISABLE_INDEX = NO
|
||||
GENERATE_TREEVIEW = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
EXT_LINKS_IN_WINDOW = NO
|
||||
FORMULA_FONTSIZE = 10
|
||||
FORMULA_TRANSPARENT = YES
|
||||
USE_MATHJAX = NO
|
||||
SEARCHENGINE = NO
|
||||
|
||||
GENERATE_LATEX = NO
|
||||
GENERATE_RTF = NO
|
||||
GENERATE_MAN = NO
|
||||
GENERATE_XML = NO
|
||||
GENERATE_DOCBOOK = NO
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
GENERATE_PERLMOD = NO
|
||||
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = @PROJECT_BINARY_DIR@
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = LIBFREENECT2_API
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
EXTERNAL_PAGES = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = NO
|
||||
HAVE_DOT = NO
|
|
@ -0,0 +1,221 @@
|
|||
/** @mainpage API Reference
|
||||
|
||||
Older versions: [0.1](0.1).
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
%libfreenect2 is an open source cross-platform driver for Kinect for Windows v2
|
||||
devices. For information on installation and troubleshooting, see the
|
||||
[GitHub repository](https://github.com/OpenKinect/libfreenect2).
|
||||
|
||||
This documentation is designed for application developers who want to extract
|
||||
and use depth and color images from Kinect v2 for further processing.
|
||||
Additional questions and comments not covered by this documentation can be
|
||||
posted to [GitHub issues](https://github.com/OpenKinect/libfreenect2/issues).
|
||||
|
||||
This documentation may require some understanding on camera calibration and 3-D
|
||||
geometry.
|
||||
|
||||
Features
|
||||
========
|
||||
|
||||
- Color image processing
|
||||
- IR and depth image processing
|
||||
- Registration of color and depth images
|
||||
- Multiple GPU and hardware acceleration implementations for image processing
|
||||
|
||||
### Issues and Future Work
|
||||
|
||||
- Audio. Raw audio is accessible via Linux USB audio. There is no support for
|
||||
the calibrated directional audio.
|
||||
- Unstable USB and crashes. Due to differences in driver support, USB problems
|
||||
can happen a lot. Error handling in %libfreenect2 is not fully verified for
|
||||
production use.
|
||||
- Firmware upload. The protocol has been reverse engineered, but use Windows
|
||||
for this right now.
|
||||
- Example of multiple Kinects.
|
||||
- Example utility of dumping image frames.
|
||||
- API for on-demand processing.
|
||||
- Verification of systematic errors through accurate calibration.
|
||||
- Bindings for C, Python, Java, etc.
|
||||
|
||||
Getting Started
|
||||
===============
|
||||
|
||||
To read the API documentation, start with the [Modules](modules.html) page
|
||||
which nicely organizes classes according to their functionalities.
|
||||
|
||||
Example programs can be found in the source distribution under the `examples`
|
||||
directory. There also includes an example CMake build system for a standalone
|
||||
application that uses %libfreenect2 binary installation.
|
||||
|
||||
Many internal details are hidden from this public API. For details on Kinect
|
||||
v2's USB protocols, depth decoding algorithms, calibration algorithms, and how
|
||||
to implement performance optimizers, you are encouraged to read the source
|
||||
code. The source code is the updated and authoritative reference for any
|
||||
functionalities.
|
||||
|
||||
Environment Variables
|
||||
=====================
|
||||
|
||||
There are a few environment variables providing controls for both end-users and
|
||||
programmers:
|
||||
|
||||
* `LIBFREENECT2_LOGGER_LEVEL`: The default logging level if not explicitly set
|
||||
by the code.
|
||||
* `LIBFREENECT2_PIPELINE`: The default pipeline if not explicitly set by the
|
||||
code.
|
||||
* `LIBFREENECT2_RGB_TRANSFER_SIZE`, `LIBFREENECT2_RGB_TRANSFERS`,
|
||||
`LIBFREENECT2_IR_PACKETS`, `LIBFREENECT2_IR_TRANSFERS`: Tuning the USB buffer
|
||||
sizes. Use only if you know what you are doing.
|
||||
|
||||
You can also see the following walkthrough for the most basic usage.
|
||||
|
||||
Walkthrough
|
||||
===========
|
||||
|
||||
Here is an example to walk you through the API. See `examples/Protonect.cpp`
|
||||
for the full source.
|
||||
|
||||
Headers
|
||||
-------
|
||||
|
||||
First, include necessary headers. `registration.h` and `logger.h` are optional
|
||||
if you don't use them.
|
||||
|
||||
@snippet Protonect.cpp headers
|
||||
|
||||
Logging
|
||||
-------
|
||||
|
||||
This shows how to set up the logger and logging level.
|
||||
|
||||
@snippet Protonect.cpp logging
|
||||
|
||||
Though @copydetails libfreenect2::createConsoleLoggerWithDefaultLevel
|
||||
|
||||
You can implement a custom [Logger](@ref libfreenect2::Logger) and redirect
|
||||
%libfreenect2's log messages to desired places.
|
||||
|
||||
Here is an example to save log messages to a file.
|
||||
|
||||
@snippet Protonect.cpp logger
|
||||
|
||||
And use it
|
||||
|
||||
@snippet Protonect.cpp file logging
|
||||
|
||||
%libfreenect2 uses a single global logger regardless of number of contexts and
|
||||
devices. You may have to implement thread safety measure in
|
||||
[log()](@ref libfreenect2::Logger::log), which is called from multiple threads.
|
||||
Console loggers are thread safe because `std::cout` and `std::cerr` are thread
|
||||
safe.
|
||||
|
||||
Initialize and Discover Devices
|
||||
-------------------------------
|
||||
|
||||
You need these structures for all operations. Here it uses only one device.
|
||||
|
||||
@snippet Protonect.cpp context
|
||||
|
||||
You must enumerate all Kinect v2 devices before doing anything else related to
|
||||
devices.
|
||||
|
||||
@snippet Protonect.cpp discovery
|
||||
|
||||
Also, you can create a specific [PacketPipeline](@ref libfreenect2::PacketPipeline)
|
||||
instead using the default one for opening the device. Alternatives include
|
||||
[OpenGLPacketPipeline](@ref libfreenect2::OpenGLPacketPipeline),
|
||||
[OpenCLPacketPipeline](@ref libfreenect2::OpenCLPacketPipeline), etc.
|
||||
|
||||
@snippet Protonect.cpp pipeline
|
||||
|
||||
Open and Configure the Device
|
||||
-----------------------------
|
||||
|
||||
Now you can open the device by its serial number, and using the specific
|
||||
pipeline.
|
||||
|
||||
@snippet Protonect.cpp open
|
||||
|
||||
You can also open the device without providing a pipeline, then a default is
|
||||
used. There are a few alternative ways to [openDevice()](@ref libfreenect2::Freenect2::openDevice).
|
||||
|
||||
After opening, you need to attach [Framelisteners](@ref libfreenect2::FrameListener)
|
||||
to the device to receive images frames.
|
||||
|
||||
This [SyncMultiFrameListener](@ref libfreenect2::SyncMultiFrameListener) will
|
||||
wait until all specified types of frames are received once. Like loggers, you
|
||||
may also implement your own frame listeners using the same interface.
|
||||
|
||||
@snippet Protonect.cpp listeners
|
||||
|
||||
You cannot configure the device after starting it.
|
||||
|
||||
Start the Device
|
||||
----------------
|
||||
|
||||
After finishing configuring the device, you can start the device. You must
|
||||
start the device before querying any information of the device.
|
||||
|
||||
@snippet Protonect.cpp start
|
||||
|
||||
You can [setIrCameraParams()](@ref libfreenect2::Freenect2Device::setIrCameraParams)
|
||||
after start if you have your own depth calibration parameters.
|
||||
|
||||
Otherwise you can also use the factory preset parameters for
|
||||
[Registration](@ref libfreenect2::Registration). You can also provide your own
|
||||
depth calibration parameterss (though not color camera calibration parameters
|
||||
right now). Registration is optional.
|
||||
|
||||
@snippet Protonect.cpp registration setup
|
||||
|
||||
At this time, the processing has begun, and the data flows through the pipeline
|
||||
towards your frame listeners.
|
||||
|
||||
Receive Image Frames
|
||||
--------------------
|
||||
|
||||
This example uses a loop to receive image frames.
|
||||
|
||||
@snippet Protonect.cpp loop start
|
||||
|
||||
[waitForNewFrame()](@ref libfreenect2::SyncMultiFrameListener::waitForNewFrame)
|
||||
here will block until required frames are all received, and then you can
|
||||
extract `Frame` according to the type.
|
||||
|
||||
See libfreenect2::Frame for details about pixel format, dimensions, and
|
||||
metadata.
|
||||
|
||||
You can do your own things using the frame data. You can feed it to OpenCV,
|
||||
PCL, etc. Here, you can perform registration:
|
||||
|
||||
@snippet Protonect.cpp registration
|
||||
|
||||
After you are done with this frame, you must release it.
|
||||
|
||||
@snippet Protonect.cpp loop end
|
||||
|
||||
Stop the Device
|
||||
---------------
|
||||
|
||||
If you are finished and no longer need to receive more frames, you can stop
|
||||
the device and exit.
|
||||
|
||||
@snippet Protonect.cpp stop
|
||||
|
||||
Pause the Device
|
||||
----------------
|
||||
|
||||
You can also temporarily pause the device with
|
||||
[stop()](@ref libfreenect2::Freenect2Device::stop) and
|
||||
[start()](@ref libfreenect2::Freenect2Device::start).
|
||||
|
||||
@snippet Protonect.cpp pause
|
||||
|
||||
Doing this during `waitForNewFrame()` should be thread safe, and tests also
|
||||
show well. But a guarantee of thread safety has not been checked yet.
|
||||
|
||||
THE END.
|
||||
*/
|
|
@ -0,0 +1,93 @@
|
|||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12.1)
|
||||
|
||||
if(WIN32 AND NOT MINGW)
|
||||
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
# No effect for multi-configuration generators (e.g. for Visual Studio)
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose: RelWithDebInfo Release Debug MinSizeRel None")
|
||||
ENDIF()
|
||||
|
||||
PROJECT(libfreenect2_examples)
|
||||
|
||||
SET(MY_DIR ${libfreenect2_examples_SOURCE_DIR})
|
||||
SET(DEPENDS_DIR "${MY_DIR}/../depends" CACHE STRING "Dependency directory")
|
||||
|
||||
OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
|
||||
|
||||
# The example build system is standalone and will work out-of-tree with these files copied
|
||||
SET(freenect2_ROOT_DIR ${MY_DIR}/..)
|
||||
SET(flextGL_SOURCES ${freenect2_ROOT_DIR}/src/flextGL.cpp)
|
||||
SET(flextGL_INCLUDE_DIRS ${freenect2_ROOT_DIR}/src) # for flextGL.h
|
||||
|
||||
FIND_PACKAGE(PkgConfig) # try find PKGConfig as it will be used if found
|
||||
LIST(APPEND CMAKE_MODULE_PATH ${freenect2_ROOT_DIR}/cmake_modules) # FindGLFW3.cmake
|
||||
|
||||
IF(TARGET freenect2)
|
||||
MESSAGE(STATUS "Using in-tree freenect2 target")
|
||||
SET(freenect2_LIBRARIES freenect2)
|
||||
SET(freenect2_DLLS ${LIBFREENECT2_DLLS})
|
||||
ELSE()
|
||||
FIND_PACKAGE(freenect2 REQUIRED)
|
||||
# Out-of-tree build will have to have DLLs manually copied.
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${freenect2_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
SET(Protonect_src
|
||||
Protonect.cpp
|
||||
)
|
||||
|
||||
SET(Protonect_LIBRARIES
|
||||
${freenect2_LIBRARIES}
|
||||
)
|
||||
|
||||
SET(Protonect_DLLS
|
||||
${freenect2_DLLS}
|
||||
)
|
||||
|
||||
IF(ENABLE_OPENGL)
|
||||
FIND_PACKAGE(GLFW3)
|
||||
FIND_PACKAGE(OpenGL)
|
||||
IF(GLFW3_FOUND AND OPENGL_FOUND)
|
||||
INCLUDE_DIRECTORIES(
|
||||
${GLFW3_INCLUDE_DIRS}
|
||||
${flextGL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
LIST(APPEND Protonect_DLLS ${GLFW3_DLL})
|
||||
LIST(APPEND Protonect_src
|
||||
viewer.cpp
|
||||
${flextGL_SOURCES}
|
||||
)
|
||||
LIST(APPEND Protonect_LIBRARIES
|
||||
${GLFW3_LIBRARIES}
|
||||
${OPENGL_gl_LIBRARY}
|
||||
)
|
||||
ADD_DEFINITIONS(-DEXAMPLES_WITH_OPENGL_SUPPORT=1)
|
||||
ENDIF()
|
||||
ENDIF(ENABLE_OPENGL)
|
||||
|
||||
ADD_EXECUTABLE(Protonect
|
||||
${Protonect_src}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(Protonect
|
||||
${Protonect_LIBRARIES}
|
||||
)
|
||||
|
||||
IF(WIN32)
|
||||
INSTALL(TARGETS Protonect DESTINATION bin)
|
||||
LIST(REMOVE_DUPLICATES Protonect_DLLS)
|
||||
FOREACH(FILEI ${Protonect_DLLS})
|
||||
ADD_CUSTOM_COMMAND(TARGET Protonect POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FILEI} $<TARGET_FILE_DIR:Protonect>
|
||||
)
|
||||
ENDFOREACH(FILEI)
|
||||
INSTALL(FILES ${Protonect_DLLS} DESTINATION bin)
|
||||
ENDIF()
|
|
@ -0,0 +1,411 @@
|
|||
/*
|
||||
* This file is part of the OpenKinect Project. http://www.openkinect.org
|
||||
*
|
||||
* Copyright (c) 2011 individual OpenKinect contributors. See the CONTRIB file
|
||||
* for details.
|
||||
*
|
||||
* This code is licensed to you under the terms of the Apache License, version
|
||||
* 2.0, or, at your option, the terms of the GNU General Public License,
|
||||
* version 2.0. See the APACHE20 and GPL2 files for the text of the licenses,
|
||||
* or the following URLs:
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
*
|
||||
* If you redistribute this file in source form, modified or unmodified, you
|
||||
* may:
|
||||
* 1) Leave this header intact and distribute it under the same terms,
|
||||
* accompanying it with the APACHE20 and GPL20 files, or
|
||||
* 2) Delete the Apache 2.0 clause and accompany it with the GPL2 file, or
|
||||
* 3) Delete the GPL v2 clause and accompany it with the APACHE20 file
|
||||
* In all cases you must keep the copyright notice intact and include a copy
|
||||
* of the CONTRIB file.
|
||||
*
|
||||
* Binary distributions must follow the binary distribution requirements of
|
||||
* either License.
|
||||
*/
|
||||
|
||||
/** @file Protonect.cpp Main application file. */
|
||||
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <signal.h>
|
||||
|
||||
/// [headers]
|
||||
#include <libfreenect2/libfreenect2.hpp>
|
||||
#include <libfreenect2/frame_listener_impl.h>
|
||||
#include <libfreenect2/registration.h>
|
||||
#include <libfreenect2/packet_pipeline.h>
|
||||
#include <libfreenect2/logger.h>
|
||||
/// [headers]
|
||||
#ifdef EXAMPLES_WITH_OPENGL_SUPPORT
|
||||
#include "viewer.h"
|
||||
#endif
|
||||
|
||||
|
||||
bool protonect_shutdown = false; ///< Whether the running application should shut down.
|
||||
|
||||
void sigint_handler(int s)
|
||||
{
|
||||
protonect_shutdown = true;
|
||||
}
|
||||
|
||||
bool protonect_paused = false;
|
||||
libfreenect2::Freenect2Device *devtopause;
|
||||
|
||||
//Doing non-trivial things in signal handler is bad. If you want to pause,
|
||||
//do it in another thread.
|
||||
//Though libusb operations are generally thread safe, I cannot guarantee
|
||||
//everything above is thread safe when calling start()/stop() while
|
||||
//waitForNewFrame().
|
||||
void sigusr1_handler(int s)
|
||||
{
|
||||
if (devtopause == 0)
|
||||
return;
|
||||
/// [pause]
|
||||
if (protonect_paused)
|
||||
devtopause->start();
|
||||
else
|
||||
devtopause->stop();
|
||||
protonect_paused = !protonect_paused;
|
||||
/// [pause]
|
||||
}
|
||||
|
||||
//The following demostrates how to create a custom logger
|
||||
/// [logger]
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
class MyFileLogger: public libfreenect2::Logger
|
||||
{
|
||||
private:
|
||||
std::ofstream logfile_;
|
||||
public:
|
||||
MyFileLogger(const char *filename)
|
||||
{
|
||||
if (filename)
|
||||
logfile_.open(filename);
|
||||
level_ = Debug;
|
||||
}
|
||||
bool good()
|
||||
{
|
||||
return logfile_.is_open() && logfile_.good();
|
||||
}
|
||||
virtual void log(Level level, const std::string &message)
|
||||
{
|
||||
logfile_ << "[" << libfreenect2::Logger::level2str(level) << "] " << message << std::endl;
|
||||
}
|
||||
};
|
||||
/// [logger]
|
||||
|
||||
/// [main]
|
||||
/**
|
||||
* Main application entry point.
|
||||
*
|
||||
* Accepted argumemnts:
|
||||
* - cpu Perform depth processing with the CPU.
|
||||
* - gl Perform depth processing with OpenGL.
|
||||
* - cl Perform depth processing with OpenCL.
|
||||
* - <number> Serial number of the device to open.
|
||||
* - -noviewer Disable viewer window.
|
||||
*/
|
||||
int main(int argc, char *argv[])
|
||||
/// [main]
|
||||
{
|
||||
std::string program_path(argv[0]);
|
||||
std::cerr << "Version: " << LIBFREENECT2_VERSION << std::endl;
|
||||
std::cerr << "Environment variables: LOGFILE=<protonect.log>" << std::endl;
|
||||
std::cerr << "Usage: " << program_path << " [-gpu=<id>] [gl | cl | clkde | cuda | cudakde | cpu] [<device serial>]" << std::endl;
|
||||
std::cerr << " [-noviewer] [-norgb | -nodepth] [-help] [-version]" << std::endl;
|
||||
std::cerr << " [-frames <number of frames to process>]" << std::endl;
|
||||
std::cerr << "To pause and unpause: pkill -USR1 Protonect" << std::endl;
|
||||
size_t executable_name_idx = program_path.rfind("Protonect");
|
||||
|
||||
std::string binpath = "/";
|
||||
|
||||
if(executable_name_idx != std::string::npos)
|
||||
{
|
||||
binpath = program_path.substr(0, executable_name_idx);
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
// avoid flooing the very slow Windows console with debug messages
|
||||
libfreenect2::setGlobalLogger(libfreenect2::createConsoleLogger(libfreenect2::Logger::Info));
|
||||
#else
|
||||
// create a console logger with debug level (default is console logger with info level)
|
||||
/// [logging]
|
||||
libfreenect2::setGlobalLogger(libfreenect2::createConsoleLogger(libfreenect2::Logger::Debug));
|
||||
/// [logging]
|
||||
#endif
|
||||
/// [file logging]
|
||||
MyFileLogger *filelogger = new MyFileLogger(getenv("LOGFILE"));
|
||||
if (filelogger->good())
|
||||
libfreenect2::setGlobalLogger(filelogger);
|
||||
else
|
||||
delete filelogger;
|
||||
/// [file logging]
|
||||
|
||||
/// [context]
|
||||
libfreenect2::Freenect2 freenect2;
|
||||
libfreenect2::Freenect2Device *dev = 0;
|
||||
libfreenect2::PacketPipeline *pipeline = 0;
|
||||
/// [context]
|
||||
|
||||
std::string serial = "";
|
||||
|
||||
bool viewer_enabled = true;
|
||||
bool enable_rgb = true;
|
||||
bool enable_depth = true;
|
||||
int deviceId = -1;
|
||||
size_t framemax = -1;
|
||||
|
||||
for(int argI = 1; argI < argc; ++argI)
|
||||
{
|
||||
const std::string arg(argv[argI]);
|
||||
|
||||
if(arg == "-help" || arg == "--help" || arg == "-h" || arg == "-v" || arg == "--version" || arg == "-version")
|
||||
{
|
||||
// Just let the initial lines display at the beginning of main
|
||||
return 0;
|
||||
}
|
||||
else if(arg.find("-gpu=") == 0)
|
||||
{
|
||||
if (pipeline)
|
||||
{
|
||||
std::cerr << "-gpu must be specified before pipeline argument" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
deviceId = atoi(argv[argI] + 5);
|
||||
}
|
||||
else if(arg == "cpu")
|
||||
{
|
||||
if(!pipeline)
|
||||
/// [pipeline]
|
||||
pipeline = new libfreenect2::CpuPacketPipeline();
|
||||
/// [pipeline]
|
||||
}
|
||||
else if(arg == "gl")
|
||||
{
|
||||
#ifdef LIBFREENECT2_WITH_OPENGL_SUPPORT
|
||||
if(!pipeline)
|
||||
pipeline = new libfreenect2::OpenGLPacketPipeline();
|
||||
#else
|
||||
std::cout << "OpenGL pipeline is not supported!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
else if(arg == "cl")
|
||||
{
|
||||
#ifdef LIBFREENECT2_WITH_OPENCL_SUPPORT
|
||||
if(!pipeline)
|
||||
pipeline = new libfreenect2::OpenCLPacketPipeline(deviceId);
|
||||
#else
|
||||
std::cout << "OpenCL pipeline is not supported!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
else if(arg == "clkde")
|
||||
{
|
||||
#ifdef LIBFREENECT2_WITH_OPENCL_SUPPORT
|
||||
if(!pipeline)
|
||||
pipeline = new libfreenect2::OpenCLKdePacketPipeline(deviceId);
|
||||
#else
|
||||
std::cout << "OpenCL pipeline is not supported!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
else if(arg == "cuda")
|
||||
{
|
||||
#ifdef LIBFREENECT2_WITH_CUDA_SUPPORT
|
||||
if(!pipeline)
|
||||
pipeline = new libfreenect2::CudaPacketPipeline(deviceId);
|
||||
#else
|
||||
std::cout << "CUDA pipeline is not supported!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
else if(arg == "cudakde")
|
||||
{
|
||||
#ifdef LIBFREENECT2_WITH_CUDA_SUPPORT
|
||||
if(!pipeline)
|
||||
pipeline = new libfreenect2::CudaKdePacketPipeline(deviceId);
|
||||
#else
|
||||
std::cout << "CUDA pipeline is not supported!" << std::endl;
|
||||
#endif
|
||||
}
|
||||
else if(arg.find_first_not_of("0123456789") == std::string::npos) //check if parameter could be a serial number
|
||||
{
|
||||
serial = arg;
|
||||
}
|
||||
else if(arg == "-noviewer" || arg == "--noviewer")
|
||||
{
|
||||
viewer_enabled = false;
|
||||
}
|
||||
else if(arg == "-norgb" || arg == "--norgb")
|
||||
{
|
||||
enable_rgb = false;
|
||||
}
|
||||
else if(arg == "-nodepth" || arg == "--nodepth")
|
||||
{
|
||||
enable_depth = false;
|
||||
}
|
||||
else if(arg == "-frames")
|
||||
{
|
||||
++argI;
|
||||
framemax = strtol(argv[argI], NULL, 0);
|
||||
if (framemax == 0) {
|
||||
std::cerr << "invalid frame count '" << argv[argI] << "'" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "Unknown argument: " << arg << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (!enable_rgb && !enable_depth)
|
||||
{
|
||||
std::cerr << "Disabling both streams is not allowed!" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// [discovery]
|
||||
if(freenect2.enumerateDevices() == 0)
|
||||
{
|
||||
std::cout << "no device connected!" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (serial == "")
|
||||
{
|
||||
serial = freenect2.getDefaultDeviceSerialNumber();
|
||||
}
|
||||
/// [discovery]
|
||||
|
||||
if(pipeline)
|
||||
{
|
||||
/// [open]
|
||||
dev = freenect2.openDevice(serial, pipeline);
|
||||
/// [open]
|
||||
}
|
||||
else
|
||||
{
|
||||
dev = freenect2.openDevice(serial);
|
||||
}
|
||||
|
||||
if(dev == 0)
|
||||
{
|
||||
std::cout << "failure opening device!" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
devtopause = dev;
|
||||
|
||||
signal(SIGINT,sigint_handler);
|
||||
#ifdef SIGUSR1
|
||||
signal(SIGUSR1, sigusr1_handler);
|
||||
#endif
|
||||
protonect_shutdown = false;
|
||||
|
||||
/// [listeners]
|
||||
int types = 0;
|
||||
if (enable_rgb)
|
||||
types |= libfreenect2::Frame::Color;
|
||||
if (enable_depth)
|
||||
types |= libfreenect2::Frame::Ir | libfreenect2::Frame::Depth;
|
||||
libfreenect2::SyncMultiFrameListener listener(types);
|
||||
libfreenect2::FrameMap frames;
|
||||
|
||||
dev->setColorFrameListener(&listener);
|
||||
dev->setIrAndDepthFrameListener(&listener);
|
||||
/// [listeners]
|
||||
|
||||
/// [start]
|
||||
if (enable_rgb && enable_depth)
|
||||
{
|
||||
if (!dev->start())
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!dev->startStreams(enable_rgb, enable_depth))
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::cout << "device serial: " << dev->getSerialNumber() << std::endl;
|
||||
std::cout << "device firmware: " << dev->getFirmwareVersion() << std::endl;
|
||||
/// [start]
|
||||
|
||||
/// [registration setup]
|
||||
libfreenect2::Registration* registration = new libfreenect2::Registration(dev->getIrCameraParams(), dev->getColorCameraParams());
|
||||
libfreenect2::Frame undistorted(512, 424, 4), registered(512, 424, 4);
|
||||
/// [registration setup]
|
||||
|
||||
size_t framecount = 0;
|
||||
#ifdef EXAMPLES_WITH_OPENGL_SUPPORT
|
||||
Viewer viewer;
|
||||
if (viewer_enabled)
|
||||
viewer.initialize();
|
||||
#else
|
||||
viewer_enabled = false;
|
||||
#endif
|
||||
|
||||
/// [loop start]
|
||||
while(!protonect_shutdown && (framemax == (size_t)-1 || framecount < framemax))
|
||||
{
|
||||
if (!listener.waitForNewFrame(frames, 10*1000)) // 10 sconds
|
||||
{
|
||||
std::cout << "timeout!" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
libfreenect2::Frame *rgb = frames[libfreenect2::Frame::Color];
|
||||
libfreenect2::Frame *ir = frames[libfreenect2::Frame::Ir];
|
||||
libfreenect2::Frame *depth = frames[libfreenect2::Frame::Depth];
|
||||
/// [loop start]
|
||||
|
||||
if (enable_rgb && enable_depth)
|
||||
{
|
||||
/// [registration]
|
||||
registration->apply(rgb, depth, &undistorted, ®istered);
|
||||
/// [registration]
|
||||
}
|
||||
|
||||
framecount++;
|
||||
if (!viewer_enabled)
|
||||
{
|
||||
if (framecount % 100 == 0)
|
||||
std::cout << "The viewer is turned off. Received " << framecount << " frames. Ctrl-C to stop." << std::endl;
|
||||
listener.release(frames);
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef EXAMPLES_WITH_OPENGL_SUPPORT
|
||||
if (enable_rgb)
|
||||
{
|
||||
viewer.addFrame("RGB", rgb);
|
||||
}
|
||||
if (enable_depth)
|
||||
{
|
||||
viewer.addFrame("ir", ir);
|
||||
viewer.addFrame("depth", depth);
|
||||
}
|
||||
if (enable_rgb && enable_depth)
|
||||
{
|
||||
viewer.addFrame("registered", ®istered);
|
||||
}
|
||||
|
||||
protonect_shutdown = protonect_shutdown || viewer.render();
|
||||
#endif
|
||||
|
||||
/// [loop end]
|
||||
listener.release(frames);
|
||||
/** libfreenect2::this_thread::sleep_for(libfreenect2::chrono::milliseconds(100)); */
|
||||
}
|
||||
/// [loop end]
|
||||
|
||||
// TODO: restarting ir stream doesn't work!
|
||||
// TODO: bad things will happen, if frame listeners are freed before dev->stop() :(
|
||||
/// [stop]
|
||||
dev->stop();
|
||||
dev->close();
|
||||
/// [stop]
|
||||
|
||||
delete registration;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,244 @@
|
|||
#include "viewer.h"
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
Viewer::Viewer() : shader_folder("src/shader/"),
|
||||
win_width(600),
|
||||
win_height(400)
|
||||
{
|
||||
}
|
||||
|
||||
static void glfwErrorCallback(int error, const char* description)
|
||||
{
|
||||
std::cerr << "GLFW error " << error << " " << description << std::endl;
|
||||
}
|
||||
|
||||
void Viewer::initialize()
|
||||
{
|
||||
// init glfw - if already initialized nothing happens
|
||||
glfwInit();
|
||||
|
||||
GLFWerrorfun prev_func = glfwSetErrorCallback(glfwErrorCallback);
|
||||
if (prev_func)
|
||||
glfwSetErrorCallback(prev_func);
|
||||
|
||||
// setup context
|
||||
glfwDefaultWindowHints();
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||
#ifdef __APPLE__
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
|
||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||
#else
|
||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
|
||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_ANY_PROFILE);
|
||||
#endif
|
||||
//glfwWindowHint(GLFW_VISIBLE, debug ? GL_TRUE : GL_FALSE);
|
||||
|
||||
window = glfwCreateWindow(win_width*2, win_height*2, "Viewer (press ESC to exit)", 0, NULL);
|
||||
if (window == NULL)
|
||||
{
|
||||
std::cerr << "Failed to create opengl window." << std::endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
OpenGLBindings *b = new OpenGLBindings();
|
||||
flextInit(b);
|
||||
gl(b);
|
||||
|
||||
std::string vertexshadersrc = ""
|
||||
"#version 330\n"
|
||||
|
||||
"in vec2 Position;"
|
||||
"in vec2 TexCoord;"
|
||||
|
||||
"out VertexData{"
|
||||
"vec2 TexCoord;"
|
||||
"} VertexOut;"
|
||||
|
||||
"void main(void)"
|
||||
"{"
|
||||
" gl_Position = vec4(Position, 0.0, 1.0);"
|
||||
" VertexOut.TexCoord = TexCoord;"
|
||||
"}";
|
||||
std::string grayfragmentshader = ""
|
||||
"#version 330\n"
|
||||
|
||||
"uniform sampler2DRect Data;"
|
||||
|
||||
"vec4 tempColor;"
|
||||
"in VertexData{"
|
||||
" vec2 TexCoord;"
|
||||
"} FragmentIn;"
|
||||
|
||||
"layout(location = 0) out vec4 Color;"
|
||||
|
||||
"void main(void)"
|
||||
"{"
|
||||
"ivec2 uv = ivec2(FragmentIn.TexCoord.x, FragmentIn.TexCoord.y);"
|
||||
"tempColor = texelFetch(Data, uv);"
|
||||
"Color = vec4(tempColor.x/4500, tempColor.x/4500, tempColor.x/4500, 1);"
|
||||
"}";
|
||||
std::string fragmentshader = ""
|
||||
"#version 330\n"
|
||||
|
||||
"uniform sampler2DRect Data;"
|
||||
|
||||
"in VertexData{"
|
||||
" vec2 TexCoord;"
|
||||
"} FragmentIn;"
|
||||
|
||||
"layout(location = 0) out vec4 Color;"
|
||||
|
||||
"void main(void)"
|
||||
"{"
|
||||
" ivec2 uv = ivec2(FragmentIn.TexCoord.x, FragmentIn.TexCoord.y);"
|
||||
|
||||
" Color = texelFetch(Data, uv);"
|
||||
"}";
|
||||
|
||||
renderShader.setVertexShader(vertexshadersrc);
|
||||
renderShader.setFragmentShader(fragmentshader);
|
||||
renderShader.build();
|
||||
|
||||
renderGrayShader.setVertexShader(vertexshadersrc);
|
||||
renderGrayShader.setFragmentShader(grayfragmentshader);
|
||||
renderGrayShader.build();
|
||||
|
||||
|
||||
glfwSetWindowUserPointer(window, this);
|
||||
glfwSetKeyCallback(window, Viewer::key_callbackstatic);
|
||||
glfwSetWindowSizeCallback(window, Viewer::winsize_callbackstatic);
|
||||
|
||||
shouldStop = false;
|
||||
}
|
||||
|
||||
void Viewer::winsize_callbackstatic(GLFWwindow* window, int w, int h)
|
||||
{
|
||||
Viewer* viewer = reinterpret_cast<Viewer*>(glfwGetWindowUserPointer(window));
|
||||
viewer->winsize_callback(window, w, h);
|
||||
}
|
||||
|
||||
void Viewer::winsize_callback(GLFWwindow* window, int w, int h)
|
||||
{
|
||||
win_width = w/2;
|
||||
win_height = h/2;
|
||||
}
|
||||
|
||||
void Viewer::key_callbackstatic(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
Viewer* viewer = reinterpret_cast<Viewer*>(glfwGetWindowUserPointer(window));
|
||||
viewer->key_callback(window, key, scancode, action, mods);
|
||||
}
|
||||
|
||||
void Viewer::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||
shouldStop = true;
|
||||
}
|
||||
|
||||
void Viewer::onOpenGLBindingsChanged(OpenGLBindings *b)
|
||||
{
|
||||
renderShader.gl(b);
|
||||
renderGrayShader.gl(b);
|
||||
rgb.gl(b);
|
||||
ir.gl(b);
|
||||
}
|
||||
|
||||
bool Viewer::render()
|
||||
{
|
||||
// wipe the drawing surface clear
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
GLint x = 0, y = 0;
|
||||
int fb_width, fb_width_half, fb_height, fb_height_half;
|
||||
|
||||
std::map<std::string, libfreenect2::Frame*>::iterator iter;
|
||||
|
||||
for (iter = frames.begin(); iter != frames.end(); ++iter)
|
||||
{
|
||||
libfreenect2::Frame* frame = iter->second;
|
||||
|
||||
// Using the frame buffer size to account for screens where window.size != framebuffer.size, e.g. retina displays
|
||||
glfwGetFramebufferSize(window, &fb_width, &fb_height);
|
||||
fb_width_half = (fb_width + 1) / 2;
|
||||
fb_height_half = (fb_height + 1) / 2;
|
||||
|
||||
glViewport(x, y, fb_width_half, fb_height_half);
|
||||
x += fb_width_half;
|
||||
if (x >= (fb_width - 1))
|
||||
{
|
||||
x = 0;
|
||||
y += fb_height_half;
|
||||
}
|
||||
|
||||
float w = static_cast<float>(frame->width);
|
||||
float h = static_cast<float>(frame->height);
|
||||
|
||||
Vertex bl = { -1.0f, -1.0f, 0.0f, 0.0f };
|
||||
Vertex br = { 1.0f, -1.0f, w, 0.0f };
|
||||
Vertex tl = { -1.0f, 1.0f, 0.0f, h };
|
||||
Vertex tr = { 1.0f, 1.0f, w, h };
|
||||
Vertex vertices[] = {
|
||||
bl, tl, tr,
|
||||
tr, br, bl
|
||||
};
|
||||
|
||||
gl()->glGenBuffers(1, &triangle_vbo);
|
||||
gl()->glGenVertexArrays(1, &triangle_vao);
|
||||
|
||||
gl()->glBindVertexArray(triangle_vao);
|
||||
gl()->glBindBuffer(GL_ARRAY_BUFFER, triangle_vbo);
|
||||
gl()->glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
|
||||
|
||||
GLint position_attr = renderShader.getAttributeLocation("Position");
|
||||
gl()->glVertexAttribPointer(position_attr, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)0);
|
||||
gl()->glEnableVertexAttribArray(position_attr);
|
||||
|
||||
GLint texcoord_attr = renderShader.getAttributeLocation("TexCoord");
|
||||
gl()->glVertexAttribPointer(texcoord_attr, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)(2 * sizeof(float)));
|
||||
gl()->glEnableVertexAttribArray(texcoord_attr);
|
||||
|
||||
|
||||
if (iter->first == "RGB" || iter->first == "registered")
|
||||
{
|
||||
renderShader.use();
|
||||
|
||||
rgb.allocate(frame->width, frame->height);
|
||||
std::copy(frame->data, frame->data + frame->width * frame->height * frame->bytes_per_pixel, rgb.data);
|
||||
rgb.flipY();
|
||||
rgb.upload();
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
rgb.deallocate();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
renderGrayShader.use();
|
||||
|
||||
ir.allocate(frame->width, frame->height);
|
||||
std::copy(frame->data, frame->data + frame->width * frame->height * frame->bytes_per_pixel, ir.data);
|
||||
ir.flipY();
|
||||
ir.upload();
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
ir.deallocate();
|
||||
}
|
||||
|
||||
gl()->glDeleteBuffers(1, &triangle_vbo);
|
||||
gl()->glDeleteVertexArrays(1, &triangle_vao);
|
||||
}
|
||||
|
||||
// put the stuff we've been drawing onto the display
|
||||
glfwSwapBuffers(window);
|
||||
// update other events like input handling
|
||||
glfwPollEvents();
|
||||
|
||||
return shouldStop || glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
void Viewer::addFrame(std::string id, libfreenect2::Frame* frame)
|
||||
{
|
||||
frames[id] = frame;
|
||||
}
|
|
@ -0,0 +1,288 @@
|
|||
#ifndef VIEWER_H
|
||||
#define VIEWER_H
|
||||
|
||||
#include <libfreenect2/config.h>
|
||||
#include <libfreenect2/frame_listener.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "flextGL.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
float x, y;
|
||||
float u, v;
|
||||
};
|
||||
|
||||
class WithOpenGLBindings
|
||||
{
|
||||
private:
|
||||
OpenGLBindings *bindings;
|
||||
protected:
|
||||
WithOpenGLBindings() : bindings(0) {}
|
||||
virtual ~WithOpenGLBindings() {}
|
||||
|
||||
virtual void onOpenGLBindingsChanged(OpenGLBindings *b) { }
|
||||
public:
|
||||
void gl(OpenGLBindings *bindings)
|
||||
{
|
||||
this->bindings = bindings;
|
||||
onOpenGLBindingsChanged(this->bindings);
|
||||
}
|
||||
|
||||
OpenGLBindings *gl()
|
||||
{
|
||||
return bindings;
|
||||
}
|
||||
};
|
||||
|
||||
template<size_t TBytesPerPixel, GLenum TInternalFormat, GLenum TFormat, GLenum TType>
|
||||
struct ImageFormat
|
||||
{
|
||||
static const size_t BytesPerPixel = TBytesPerPixel;
|
||||
static const GLenum InternalFormat = TInternalFormat;
|
||||
static const GLenum Format = TFormat;
|
||||
static const GLenum Type = TType;
|
||||
};
|
||||
|
||||
typedef ImageFormat<1, GL_R8UI, GL_RED_INTEGER, GL_UNSIGNED_BYTE> U8C1;
|
||||
typedef ImageFormat<2, GL_R16I, GL_RED_INTEGER, GL_SHORT> S16C1;
|
||||
typedef ImageFormat<2, GL_R16UI, GL_RED_INTEGER, GL_UNSIGNED_SHORT> U16C1;
|
||||
typedef ImageFormat<4, GL_R32F, GL_RED, GL_FLOAT> F32C1;
|
||||
typedef ImageFormat<8, GL_RG32F, GL_RG, GL_FLOAT> F32C2;
|
||||
typedef ImageFormat<12, GL_RGB32F, GL_RGB, GL_FLOAT> F32C3;
|
||||
typedef ImageFormat<4, GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE> F8C4;
|
||||
typedef ImageFormat<16, GL_RGBA32F, GL_RGBA, GL_FLOAT> F32C4;
|
||||
|
||||
template<typename FormatT>
|
||||
struct Texture : public WithOpenGLBindings
|
||||
{
|
||||
protected:
|
||||
size_t bytes_per_pixel, height, width;
|
||||
|
||||
public:
|
||||
GLuint texture;
|
||||
unsigned char *data;
|
||||
size_t size;
|
||||
|
||||
Texture() : bytes_per_pixel(FormatT::BytesPerPixel), height(0), width(0), texture(0), data(0), size(0)
|
||||
{
|
||||
}
|
||||
|
||||
void bindToUnit(GLenum unit)
|
||||
{
|
||||
gl()->glActiveTexture(unit);
|
||||
glBindTexture(GL_TEXTURE_RECTANGLE, texture);
|
||||
}
|
||||
|
||||
void allocate(size_t new_width, size_t new_height)
|
||||
{
|
||||
width = new_width;
|
||||
height = new_height;
|
||||
size = height * width * bytes_per_pixel;
|
||||
data = new unsigned char[size];
|
||||
|
||||
glGenTextures(1, &texture);
|
||||
bindToUnit(GL_TEXTURE0);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexImage2D(GL_TEXTURE_RECTANGLE, 0, FormatT::InternalFormat, width, height, 0, FormatT::Format, FormatT::Type, 0);
|
||||
}
|
||||
|
||||
void deallocate()
|
||||
{
|
||||
glDeleteTextures(1, &texture);
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
void upload()
|
||||
{
|
||||
bindToUnit(GL_TEXTURE0);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glTexSubImage2D(GL_TEXTURE_RECTANGLE, /*level*/0, /*xoffset*/0, /*yoffset*/0, width, height, FormatT::Format, FormatT::Type, data);
|
||||
}
|
||||
|
||||
void download()
|
||||
{
|
||||
downloadToBuffer(data);
|
||||
}
|
||||
|
||||
void downloadToBuffer(unsigned char *data)
|
||||
{
|
||||
glReadPixels(0, 0, width, height, FormatT::Format, FormatT::Type, data);
|
||||
}
|
||||
|
||||
void flipY()
|
||||
{
|
||||
flipYBuffer(data);
|
||||
}
|
||||
|
||||
void flipYBuffer(unsigned char *data)
|
||||
{
|
||||
typedef unsigned char type;
|
||||
|
||||
size_t linestep = width * bytes_per_pixel / sizeof(type);
|
||||
|
||||
type *first_line = reinterpret_cast<type *>(data), *last_line = reinterpret_cast<type *>(data) + (height - 1) * linestep;
|
||||
|
||||
for (size_t y = 0; y < height / 2; ++y)
|
||||
{
|
||||
for (size_t x = 0; x < linestep; ++x, ++first_line, ++last_line)
|
||||
{
|
||||
std::swap(*first_line, *last_line);
|
||||
}
|
||||
last_line -= 2 * linestep;
|
||||
}
|
||||
}
|
||||
|
||||
libfreenect2::Frame *downloadToNewFrame()
|
||||
{
|
||||
libfreenect2::Frame *f = new libfreenect2::Frame(width, height, bytes_per_pixel);
|
||||
downloadToBuffer(f->data);
|
||||
flipYBuffer(f->data);
|
||||
|
||||
return f;
|
||||
}
|
||||
};
|
||||
|
||||
struct ShaderProgram : public WithOpenGLBindings
|
||||
{
|
||||
GLuint program, vertex_shader, fragment_shader;
|
||||
|
||||
char error_buffer[2048];
|
||||
|
||||
ShaderProgram() :
|
||||
program(0),
|
||||
vertex_shader(0),
|
||||
fragment_shader(0)
|
||||
{
|
||||
}
|
||||
|
||||
void setVertexShader(const std::string& src)
|
||||
{
|
||||
const char* src_ = src.c_str();
|
||||
int length_ = src.length();
|
||||
vertex_shader = gl()->glCreateShader(GL_VERTEX_SHADER);
|
||||
gl()->glShaderSource(vertex_shader, 1, &src_, &length_);
|
||||
}
|
||||
|
||||
void setFragmentShader(const std::string& src)
|
||||
{
|
||||
const char* src_ = src.c_str();
|
||||
int length_ = src.length();
|
||||
fragment_shader = gl()->glCreateShader(GL_FRAGMENT_SHADER);
|
||||
gl()->glShaderSource(fragment_shader, 1, &src_, &length_);
|
||||
}
|
||||
|
||||
void build()
|
||||
{
|
||||
GLint status;
|
||||
|
||||
gl()->glCompileShader(vertex_shader);
|
||||
gl()->glGetShaderiv(vertex_shader, GL_COMPILE_STATUS, &status);
|
||||
|
||||
if (status != GL_TRUE)
|
||||
{
|
||||
gl()->glGetShaderInfoLog(vertex_shader, sizeof(error_buffer), NULL, error_buffer);
|
||||
|
||||
std::cerr << "failed to compile vertex shader!" << std::endl << error_buffer << std::endl;
|
||||
}
|
||||
|
||||
gl()->glCompileShader(fragment_shader);
|
||||
|
||||
gl()->glGetShaderiv(fragment_shader, GL_COMPILE_STATUS, &status);
|
||||
if (status != GL_TRUE)
|
||||
{
|
||||
gl()->glGetShaderInfoLog(fragment_shader, sizeof(error_buffer), NULL, error_buffer);
|
||||
|
||||
std::cerr << "failed to compile fragment shader!" << std::endl << error_buffer << std::endl;
|
||||
}
|
||||
|
||||
program = gl()->glCreateProgram();
|
||||
gl()->glAttachShader(program, vertex_shader);
|
||||
gl()->glAttachShader(program, fragment_shader);
|
||||
|
||||
gl()->glLinkProgram(program);
|
||||
|
||||
gl()->glGetProgramiv(program, GL_LINK_STATUS, &status);
|
||||
|
||||
if (status != GL_TRUE)
|
||||
{
|
||||
gl()->glGetProgramInfoLog(program, sizeof(error_buffer), NULL, error_buffer);
|
||||
std::cerr << "failed to link shader program!" << std::endl << error_buffer << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
GLint getAttributeLocation(const std::string& name)
|
||||
{
|
||||
return gl()->glGetAttribLocation(program, name.c_str());
|
||||
}
|
||||
|
||||
void setUniform(const std::string& name, GLint value)
|
||||
{
|
||||
GLint idx = gl()->glGetUniformLocation(program, name.c_str());
|
||||
if (idx == -1) return;
|
||||
|
||||
gl()->glUniform1i(idx, value);
|
||||
}
|
||||
|
||||
void setUniform(const std::string& name, GLfloat value)
|
||||
{
|
||||
GLint idx = gl()->glGetUniformLocation(program, name.c_str());
|
||||
if (idx == -1) return;
|
||||
|
||||
gl()->glUniform1f(idx, value);
|
||||
}
|
||||
|
||||
void setUniformVector3(const std::string& name, GLfloat value[3])
|
||||
{
|
||||
GLint idx = gl()->glGetUniformLocation(program, name.c_str());
|
||||
if (idx == -1) return;
|
||||
|
||||
gl()->glUniform3fv(idx, 1, value);
|
||||
}
|
||||
|
||||
void setUniformMatrix3(const std::string& name, GLfloat value[9])
|
||||
{
|
||||
GLint idx = gl()->glGetUniformLocation(program, name.c_str());
|
||||
if (idx == -1) return;
|
||||
|
||||
gl()->glUniformMatrix3fv(idx, 1, false, value);
|
||||
}
|
||||
|
||||
void use()
|
||||
{
|
||||
gl()->glUseProgram(program);
|
||||
}
|
||||
};
|
||||
|
||||
class Viewer : WithOpenGLBindings {
|
||||
private:
|
||||
bool shouldStop;
|
||||
GLFWwindow* window;
|
||||
GLuint triangle_vbo, triangle_vao;
|
||||
ShaderProgram renderShader;
|
||||
ShaderProgram renderGrayShader;
|
||||
std::string shader_folder;
|
||||
std::map<std::string,libfreenect2::Frame*> frames;
|
||||
Texture<F8C4> rgb;
|
||||
Texture<F32C1> ir;
|
||||
int win_width;
|
||||
int win_height;
|
||||
public:
|
||||
Viewer();
|
||||
void initialize();
|
||||
virtual void onOpenGLBindingsChanged(OpenGLBindings *b);
|
||||
bool render();
|
||||
void addFrame(std::string id,libfreenect2::Frame* frame);
|
||||
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
void winsize_callback(GLFWwindow* window, int w, int h);
|
||||
static void key_callbackstatic(GLFWwindow* window, int key, int scancode, int action, int mods);
|
||||
static void winsize_callbackstatic(GLFWwindow* window, int w, int h);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,10 @@
|
|||
FIND_LIBRARY(freenect2_LIBRARY freenect2
|
||||
PATHS @CMAKE_INSTALL_PREFIX@/lib
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
SET(freenect2_LIBRARIES ${freenect2_LIBRARY} @LIBFREENECT2_THREADING_LIBRARIES@)
|
||||
FIND_PATH(freenect2_INCLUDE_DIR @PROJECT_NAME@/libfreenect2.hpp
|
||||
PATHS @CMAKE_INSTALL_PREFIX@/include
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
SET(freenect2_INCLUDE_DIRS ${freenect2_INCLUDE_DIR})
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue