initialize vizionsdk
This commit is contained in:
117
.gitignore
vendored
Normal file
117
.gitignore
vendored
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
# Prerequisites
|
||||||
|
*.d
|
||||||
|
|
||||||
|
# Compiled Object files
|
||||||
|
*.slo
|
||||||
|
*.lo
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
|
||||||
|
# Precompiled Headers
|
||||||
|
*.gch
|
||||||
|
*.pch
|
||||||
|
|
||||||
|
# Compiled Dynamic libraries
|
||||||
|
*.so
|
||||||
|
*.dylib
|
||||||
|
*.dll
|
||||||
|
|
||||||
|
# Fortran module files
|
||||||
|
*.mod
|
||||||
|
*.smod
|
||||||
|
|
||||||
|
# Compiled Static libraries
|
||||||
|
*.lai
|
||||||
|
*.la
|
||||||
|
*.a
|
||||||
|
*.lib
|
||||||
|
|
||||||
|
# Executables
|
||||||
|
*.exe
|
||||||
|
*.out
|
||||||
|
*.app
|
||||||
|
|
||||||
|
# Build directories
|
||||||
|
build/
|
||||||
|
cmake-build-*/
|
||||||
|
out/
|
||||||
|
bin/
|
||||||
|
lib/
|
||||||
|
|
||||||
|
# CMake
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles/
|
||||||
|
CMakeScripts/
|
||||||
|
Testing/
|
||||||
|
Makefile
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
compile_commands.json
|
||||||
|
CTestTestfile.cmake
|
||||||
|
_deps
|
||||||
|
|
||||||
|
# IDEs
|
||||||
|
## CLion
|
||||||
|
.idea/
|
||||||
|
cmake-build-debug/
|
||||||
|
cmake-build-release/
|
||||||
|
|
||||||
|
## Visual Studio Code
|
||||||
|
.vscode/
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
## Visual Studio
|
||||||
|
.vs/
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
*.suo
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
*.VC.db
|
||||||
|
*.VC.opendb
|
||||||
|
|
||||||
|
## Xcode
|
||||||
|
*.xcodeproj
|
||||||
|
*.xcworkspace
|
||||||
|
xcuserdata/
|
||||||
|
|
||||||
|
# Debug files
|
||||||
|
*.dSYM/
|
||||||
|
*.su
|
||||||
|
*.idb
|
||||||
|
*.pdb
|
||||||
|
|
||||||
|
# OS files
|
||||||
|
## macOS
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
## Linux
|
||||||
|
*~
|
||||||
|
.directory
|
||||||
|
.Trash-*
|
||||||
|
|
||||||
|
## Windows
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Backup files
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
|
||||||
|
# Conan
|
||||||
|
conaninfo.txt
|
||||||
|
conanbuildinfo.cmake
|
||||||
|
conan.lock
|
||||||
|
|
||||||
|
# vcpkg
|
||||||
|
vcpkg_installed/
|
||||||
|
|
||||||
|
# Package managers
|
||||||
|
node_modules/
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
@@ -30,4 +30,12 @@ set_target_properties(vizionStreamer PROPERTIES
|
|||||||
BUILD_RPATH "${VIZIONSDK_LIB_DIR}"
|
BUILD_RPATH "${VIZIONSDK_LIB_DIR}"
|
||||||
INSTALL_RPATH "${VIZIONSDK_LIB_DIR}"
|
INSTALL_RPATH "${VIZIONSDK_LIB_DIR}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Copy VxConfig.conf to build directory on every build
|
||||||
|
add_custom_command(TARGET vizionStreamer POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
|
${CMAKE_SOURCE_DIR}/config/VxConfig.conf
|
||||||
|
${CMAKE_BINARY_DIR}/VxConfig.conf
|
||||||
|
COMMENT "Copying VxConfig.conf to build directory"
|
||||||
|
)
|
||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
|
|||||||
8
config/VxConfig.conf
Normal file
8
config/VxConfig.conf
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[VCI]
|
||||||
|
products = VCI
|
||||||
|
|
||||||
|
[VCS]
|
||||||
|
products = VCS,VLI,UVC-VLS
|
||||||
|
|
||||||
|
[TEVS]
|
||||||
|
products = TEVS
|
||||||
60
main.cpp
60
main.cpp
@@ -5,6 +5,66 @@
|
|||||||
// TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
// TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
|
// List available cameras
|
||||||
|
std::vector<std::string> devList;
|
||||||
|
int deviceCount = VxDiscoverCameraDevices(devList);
|
||||||
|
|
||||||
|
if (deviceCount == 0) {
|
||||||
|
std::cout << "No cameras found" << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << "Found " << deviceCount << " camera(s):" << std::endl;
|
||||||
|
for (size_t i = 0; i < devList.size(); i++) {
|
||||||
|
std::cout << "[" << i << "] " << devList[i] << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open camera
|
||||||
|
auto cam = VxInitialCameraDevice(0);
|
||||||
|
if (!cam || VxOpen(cam) != 0) {
|
||||||
|
std::cout << "Failed to initialize/open camera" << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get and set format
|
||||||
|
std::vector<VxFormat> fmtList;
|
||||||
|
if (VxGetFormatList(cam, fmtList) != 0) {
|
||||||
|
std::cout << "Failed to get format list" << std::endl;
|
||||||
|
VxClose(cam);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VxSetFormat(cam, fmtList[0]) != 0) {
|
||||||
|
std::cout << "Failed to set format" << std::endl;
|
||||||
|
VxClose(cam);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start streaming
|
||||||
|
if (VxStartStreaming(cam) != 0) {
|
||||||
|
std::cout << "Failed to start streaming" << std::endl;
|
||||||
|
VxClose(cam);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Capture 5 frames
|
||||||
|
std::shared_ptr<uint8_t[]> buffer(new uint8_t[fmtList[0].width * fmtList[0].height * 3]);
|
||||||
|
int dataSize;
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++) {
|
||||||
|
VX_CAPTURE_RESULT result = VxGetImage(cam, buffer.get(), &dataSize, 1000);
|
||||||
|
if (result == VX_CAPTURE_RESULT::VX_SUCCESS) {
|
||||||
|
std::cout << "Successfully captured frame " << i + 1 << " of size: " << dataSize << " bytes" << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << "Failed to capture frame " << i + 1 << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup
|
||||||
|
VxStopStreaming(cam);
|
||||||
|
VxClose(cam);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
// TIP See CLion help at <a href="https://www.jetbrains.com/help/clion/">jetbrains.com/help/clion/</a>. Also, you can try interactive lessons for CLion by selecting 'Help | Learn IDE Features' from the main menu.
|
// TIP See CLion help at <a href="https://www.jetbrains.com/help/clion/">jetbrains.com/help/clion/</a>. Also, you can try interactive lessons for CLion by selecting 'Help | Learn IDE Features' from the main menu.
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user