Skip to content

Commit

Permalink
Modify python example for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas authored and Lucas committed May 5, 2020
1 parent 648f92c commit 87d93be
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ set(CPACK_SOURCE_GENERATOR "Developer")
add_subdirectory(examples/DepthMeasure)
add_subdirectory(examples/ParseVXL)
add_subdirectory(examples/ExtractRawData)
add_subdirectory(examples/SimplePointCloudViewer)
#add_subdirectory(examples/SimplePointCloudViewer)

9 changes: 2 additions & 7 deletions wrappers/python/exampes/ExtractDepthFromVxl/run.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
#!/bin/bash
export POINTCLOUD_SDK_PATH="./../../../../libs/windows"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
export PYTHONPATH=$POINTCLOUD_SDK_PATH/lib/python3:$PYTHONPATH
echo "$PYTHONPATH"
python3 vxltocsv.py

python vxltocsv.py
7 changes: 5 additions & 2 deletions wrappers/python/exampes/ExtractDepthFromVxl/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
export POINTCLOUD_SDK_PATH="./../../../../libs/macos"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
export PYTHONPATH=$POINTCLOUD_SDK_PATH/lib/python2.7:$PYTHONPATH
export PYTHONPATH=$POINTCLOUD_SDK_PATH/lib/python3:$PYTHONPATH
echo "$PYTHONPATH"
python vxltocsv.py
echo "$POINTCLOUD_SDK_PATH"
echo "$DYLD_LIBRARY_PATH"
echo "$LD_LIBRARY_PATH"
python3 vxltocsv.py
30 changes: 29 additions & 1 deletion wrappers/python/exampes/ExtractDepthFromVxl/vxltocsv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,34 @@
# Exit shortcut keys:
# Input [Enter] Key
###
import sys
import os
def getDefaultSdkPath():
path = ''

if sys.platform == 'win32':
import win32api
path = win32api.GetLongPathName(os.path.dirname(os.path.realpath(sys.argv[0]))+"\\..\\..\\..\\..")
print('path',path)
path = path + os.sep + "libs"+os.sep +"windows"
print('path',path)
elif sys.platform == 'darwin':
path = sys.path[0] + os.sep + "PointCloudSDK"+os.sep +"macos"

if os.path.isdir(path):
return path
else:
print('Failed to get default PointCloud SDK path')
return None
sdkPath = getDefaultSdkPath()

libPath = sdkPath + os.sep + "lib"
pythonPath = libPath + os.sep + "python3"
print("pythonPath ",pythonPath)
sys.path.append(libPath)
sys.path.append(pythonPath)

print("***** SDK path:",sdkPath," libPath:",libPath)

import PointCloud
import numpy as np
Expand Down Expand Up @@ -62,5 +90,5 @@ def vxltocsv(filename):


if __name__ == "__main__":
vxltocsv("xxxx.vxl")
vxltocsv("test.vxl")

14 changes: 14 additions & 0 deletions wrappers/python/exampes/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Python versin
1. For windows ,please use python 3.5.4 32bit
2. For mac , please use python 3.5.4 64bit
3. For ubuntu , please use python 3.6.5 64bit

## Path setting

In the PATH variable of the environment variable in the control panel of windows, add an item as below:

"E:\workspace\libPointCloud-master\libs\windows\lib"

PS. Please modify "E:\workspace\libPointCloud-master" to your real path.


32 changes: 31 additions & 1 deletion wrappers/python/exampes/ShowDepthNoGUI/ShowDepthNoGUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,36 @@
# Input [Enter] Key
###

import sys
import os

def getDefaultSdkPath():
path = ''

if sys.platform == 'win32':
import win32api
path = win32api.GetLongPathName(os.path.dirname(os.path.realpath(sys.argv[0]))+"\\..\\..\\..\\..")
print('path',path)
path = path + os.sep + "libs"+os.sep +"windows"
print('path',path)
elif sys.platform == 'darwin':
path = sys.path[0] + os.sep + "PointCloudSDK"+os.sep +"macos"

if os.path.isdir(path):
return path
else:
print('Failed to get default PointCloud SDK path')
return None
sdkPath = getDefaultSdkPath()

libPath = sdkPath + os.sep + "lib"
pythonPath = libPath + os.sep + "python3"
print("pythonPath ",pythonPath)
sys.path.append(libPath)
sys.path.append(pythonPath)

print("***** SDK path:",sdkPath," libPath:",libPath)

import PointCloud
import numpy as np
import sys
Expand Down Expand Up @@ -99,7 +129,7 @@ def stop(self):
if len(devices) == 1:
print(" Find one device.")
window = MainWindow(cameraSystem)
key = raw_input("Input enter key to quit.")
key = input("Input enter key to quit.")
print(" Quit now.")
window.stop()
else:
Expand Down
21 changes: 14 additions & 7 deletions wrappers/python/exampes/ShowDepthNoGUI/run.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/bin/bash
export POINTCLOUD_SDK_PATH="./../../../../libs/windows"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
export PYTHONPATH=$POINTCLOUD_SDK_PATH/lib/python3:$PYTHONPATH
echo "$PYTHONPATH"
python3 ShowDepthNoGUI.py

echo curent folder : "%~dp0"
echo current path : "%~f0"
set POINTCLOUD_SDK_PATH="%~dp0..\..\..\..\libs\windows"
echo POINTCLOUD_SDK_PATH : %POINTCLOUD_SDK_PATH%
set DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
set LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
set PYTHONPATH="E:\workspace\libPointCloud-master\libs\windows\lib\python3
echo "%POINTCLOUD_SDK_PATH%"
echo "%PYTHONPATH%"
set PATH= %~dp0..\..\..\..\libs\windows\lib;%~dp0..\..\..\..\libs\windows\lib\python3;%PATH%
echo %PATH%

python ShowDepthNoGUI.py
2 changes: 1 addition & 1 deletion wrappers/python/exampes/ShowDepthNoGUI/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$POINTCLOUD_SDK_PATH/lib"
export PYTHONPATH=$POINTCLOUD_SDK_PATH/lib/python3:$PYTHONPATH
echo "$PYTHONPATH"
python ShowDepthNoGUI.py
python3 ShowDepthNoGUI.py

0 comments on commit 87d93be

Please sign in to comment.