From 32a0674b6c8fd8f07a7cd6cf701946813fda4280 Mon Sep 17 00:00:00 2001 From: yair Date: Fri, 14 Nov 2025 11:30:10 +0200 Subject: [PATCH] Unify build process with PowerShell script and update documentation - Created build.ps1 to merge batch files with auto-copy to GST_PLUGIN_PATH - Updated README.md to focus on IDS uEye and rollingsum plugins only - Removed outdated batch files (build_idsueye_only.bat, build_idsueye_and_rollingsum.bat) - Removed unused build files (set_paths_and_run_cmake.bat, CMakeLists_idsueye_only.txt) - Updated .gitignore for build artifacts and plugin directory --- .gitignore | 2 + BUILD_IDSUEYE.md | 118 ------------ CMakeLists_idsueye_only.txt | 86 --------- README.md | 204 ++++++++------------ build.ps1 | 311 +++++++++++++++++++++++++++++++ build_idsueye_and_rollingsum.bat | 126 ------------- build_idsueye_only.bat | 100 ---------- set_paths_and_run_cmake.bat | 22 --- 8 files changed, 390 insertions(+), 579 deletions(-) delete mode 100644 BUILD_IDSUEYE.md delete mode 100644 CMakeLists_idsueye_only.txt create mode 100644 build.ps1 delete mode 100644 build_idsueye_and_rollingsum.bat delete mode 100644 build_idsueye_only.bat delete mode 100644 set_paths_and_run_cmake.bat diff --git a/.gitignore b/.gitignore index b027907..aee8485 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ _ReSharper*/ *.sdf *.opensdf ipch/ +gst_plugs/libgstidsueye.dll +gst_plugs/libgstrollingsum.dll diff --git a/BUILD_IDSUEYE.md b/BUILD_IDSUEYE.md deleted file mode 100644 index aeee77b..0000000 --- a/BUILD_IDSUEYE.md +++ /dev/null @@ -1,118 +0,0 @@ -# Building IDS uEye Plugin Only - -This guide explains how to build only the IDS uEye GStreamer plugin from the gst-plugins-vision project. - -## Prerequisites - -1. **IDS uEye SDK** must be installed on your system - - Default location (Windows): `C:\Program Files\IDS\uEye\Develop` - - If installed elsewhere, set the `IDSUEYE_DIR` CMake variable - -2. **Build tools**: - - CMake (version 2.8.0 or higher) - - Visual Studio 2019 or newer (on Windows) - - GStreamer development files (1.2.0 or higher) - -3. **Required GStreamer components**: - - GStreamer base library - - GStreamer video library - - GLib2 - - GObject - -## Building - -### Quick Build (Windows) - -Simply run the provided batch script: - -```batch -build_idsueye_only.bat -``` - -Or provide a custom GStreamer path: - -```batch -build_idsueye_only.bat "C:\path\to\gstreamer" -``` - -This will: -1. Create a `build_idsueye` directory -2. Use the standalone IDS uEye CMakeLists configuration -3. Configure the project with CMake -4. Build only the IDS uEye plugin -5. Output: `build_idsueye\sys\idsueye\Release\libgstidsueye.dll` - -**Default GStreamer location:** `C:\bin\gstreamer\1.0\msvc_x86_64` - -### Manual Build - -If you prefer manual control or need to customize the build: - -```batch -# Create build directory -mkdir build_idsueye -cd build_idsueye - -# Configure (adjust generator as needed) -cmake .. -G "Visual Studio 16 2019" -A x64 - -# Build only IDS uEye target -cmake --build . --config Release --target gstidsueye - -# Or for Debug build -cmake --build . --config Debug --target gstidsueye -``` - -### Custom IDS uEye SDK Location - -If your IDS uEye SDK is installed in a non-standard location: - -```batch -cmake .. -G "Visual Studio 16 2019" -A x64 -DIDSUEYE_DIR="C:\Path\To\IDS\uEye\Develop" -``` - -### Linux Build - -```bash -mkdir build_idsueye -cd build_idsueye -cmake .. -make gstidsueye -``` - -## Output - -The built plugin will be located at: -- **Windows Release**: `build_idsueye\sys\idsueye\Release\libgstidsueye.dll` -- **Windows Debug**: `build_idsueye\sys\idsueye\Debug\libgstidsueye.dll` -- **Linux**: `build_idsueye/sys/idsueye/libgstidsueye.so` - -## Installation - -To install the plugin to the GStreamer plugin directory: - -```batch -cmake --build . --config Release --target install -``` - -Or manually copy the DLL to your GStreamer plugins directory (typically `C:\gstreamer\1.0\msvc_x86_64\lib\gstreamer-1.0\`). - -## Troubleshooting - -### IDS uEye SDK Not Found - -If CMake cannot find the IDS uEye SDK: -1. Verify the SDK is installed -2. Check the installation path -3. Set `IDSUEYE_DIR` explicitly in the CMake command - -### Missing Dependencies - -If GStreamer dependencies are not found: -1. Ensure GStreamer and development headers are installed -2. Add GStreamer to your system PATH -3. Set `GSTREAMER_ROOT` environment variable if needed - -### Link Errors - -Make sure you're building for the correct architecture (x64 vs x86) matching your IDS uEye SDK installation. \ No newline at end of file diff --git a/CMakeLists_idsueye_only.txt b/CMakeLists_idsueye_only.txt deleted file mode 100644 index 638a733..0000000 --- a/CMakeLists_idsueye_only.txt +++ /dev/null @@ -1,86 +0,0 @@ -cmake_minimum_required(VERSION 3.5.0) - -project(gst-idsueye-plugin) - -# Values used when registering plugins -add_definitions(-DGST_PACKAGE_VERSION="idsueye-standalone") -add_definitions(-DGST_PACKAGE_LICENSE="LGPL") -add_definitions(-DGST_PACKAGE_ORIGIN="Unknown package origin") -add_definitions(-DGST_PACKAGE_NAME="${CMAKE_PROJECT_NAME}") -add_definitions(-DPACKAGE="${CMAKE_PROJECT_NAME} package") - -set(CMAKE_SHARED_MODULE_PREFIX "lib") -set(CMAKE_SHARED_LIBRARY_PREFIX "lib") - -# Add local cmake modules -list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) - -# Find required packages -find_package(GStreamer REQUIRED COMPONENTS base) -find_package(GStreamerPluginsBase REQUIRED COMPONENTS video) -find_package(GLIB2 REQUIRED) -find_package(GObject REQUIRED) -find_package(IDSuEye REQUIRED) - -# Setup include directories -include_directories( - . - ${GSTREAMER_INCLUDE_DIR} - ${GLIB2_INCLUDE_DIR} - ${IDSUEYE_INCLUDE_DIR}) - -# Set install directories -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - if (WIN32) - get_filename_component(_PREFIX "${GSTREAMER_PLUGIN_DIR}/../" REALPATH) - else () - set(_PREFIX "/usr/lib") - endif () - set(CMAKE_INSTALL_PREFIX "${_PREFIX}" - CACHE PATH "Common prefix for all installed files" FORCE) -endif() - -if (NOT PLUGIN_INSTALL_DIR) - set(PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/gstreamer-1.0/" - CACHE PATH "Location to install plugins") -endif() - -if (WIN32 AND NOT PDB_INSTALL_DIR) - set(PDB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/gstreamer-1.0/" - CACHE PATH "Location to install PDB debug files") -endif() - -# Build the IDS uEye plugin -set(SOURCES - sys/idsueye/gstidsueyesrc.c) - -set(HEADERS - sys/idsueye/gstidsueyesrc.h) - -set(libname gstidsueye) - -add_library(${libname} MODULE - ${SOURCES} - ${HEADERS}) - -target_link_libraries(${libname} - ${GLIB2_LIBRARIES} - ${GOBJECT_LIBRARIES} - ${GSTREAMER_LIBRARY} - ${GSTREAMER_BASE_LIBRARY} - ${GSTREAMER_VIDEO_LIBRARY} - ${IDSUEYE_LIBRARIES}) - -if (WIN32) - install(FILES $ DESTINATION ${PDB_INSTALL_DIR} COMPONENT pdb OPTIONAL) -endif() -install(TARGETS ${libname} LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR}) - -# Print configuration summary -message(STATUS "") -message(STATUS "IDS uEye Plugin Build Configuration:") -message(STATUS " GStreamer root: ${GSTREAMER_ROOT}") -message(STATUS " IDS uEye SDK: ${IDSUEYE_DIR}") -message(STATUS " Install prefix: ${CMAKE_INSTALL_PREFIX}") -message(STATUS " Plugin install dir: ${PLUGIN_INSTALL_DIR}") -message(STATUS "") \ No newline at end of file diff --git a/README.md b/README.md index 32704ef..0ab2da9 100644 --- a/README.md +++ b/README.md @@ -1,172 +1,122 @@ # gst-plugins-vision -GStreamer plugins related to the field of machine vision. +GStreamer plugins for IDS uEye cameras with frame analysis capabilities. -we only care for ids, +## Supported Elements -run using -``` +### Image Acquisition +- **idsueyesrc**: Video source for [IDS uEye cameras][1] (GigE Vision, USB 2/3, USB3 Vision) + +### Video Analysis +- **rollingsum**: Drops frames based on rolling mean analysis of a single column. Analyzes pixel column deviation from rolling baseline to detect anomalies or changes in the scene. + + +## Usage Examples + +### Basic capture from IDS uEye camera +```bash gst-launch-1.0 idsueyesrc config-file=whole-presacler64_autoexp-binningx2.ini ! queue ! autovideosink ``` -drop frame if sum of image is bigger then 0.5 -``` +### Frame filtering based on column analysis +Drop frames when column mean deviates from rolling baseline by more than 0.5: +```bash gst-launch-1.0 idsueyesrc config-file=whole-presacler64_autoexp-binningx2.ini ! videoconvert ! video/x-raw,format=GRAY8 ! rollingsum window-size=1000 column-index=1 threshold=0.5 ! queue ! autovideosink ``` **Note:** The `rollingsum` element analyzes a single column of pixels and drops frames when the column mean deviates from the rolling mean baseline by more than the threshold. Use `videoconvert` to ensure proper format negotiation. -Additional examples: +### Additional rollingsum examples + +Analyze column 320 with larger window: ```bash -# Analyze column 320 with larger window gst-launch-1.0 idsueyesrc config-file=whole-presacler64_autoexp-binningx2.ini ! videoconvert ! video/x-raw,format=GRAY8 ! rollingsum window-size=5000 column-index=320 threshold=0.3 ! queue ! autovideosink +``` -# Use stride for faster processing (sample every 2 rows) +Use stride for faster processing (sample every 2 rows): +```bash gst-launch-1.0 idsueyesrc config-file=whole-presacler64_autoexp-binningx2.ini ! videoconvert ! video/x-raw,format=GRAY8 ! rollingsum window-size=1000 column-index=1 stride=2 threshold=0.5 ! queue ! autovideosink +``` -# Lower threshold for more sensitive detection +Lower threshold for more sensitive detection: +```bash gst-launch-1.0 idsueyesrc config-file=whole-presacler64_autoexp-binningx2.ini ! videoconvert ! video/x-raw,format=GRAY8 ! rollingsum threshold=0.2 ! queue ! autovideosink ``` - -## Image acquisition elements - -- aptinasrc: Video source for [Aptina Imaging (On Semiconductor) dev kits][14] (USB dev kits) -- bitflowsrc: Video source for [BitFlow frame grabbers][10] (analog, Camera Link, CoaXPress) -- edtpdvsrc: Video source for [EDT PDV frame grabbers][1] (Camera Link) -- euresyssrc: Video source for [Euresys PICOLO, DOMINO and GRABLINK series frame grabbers][3] (analog, Camera Link) -- idsueyesrc: Video source for [IDS uEye cameras][11] (GigE Vision, USB 2/3, USB3 Vision) -- imperxflexsrc: Video source for [IMPERX FrameLink and FrameLink Express frame grabbers][5] (Camera Link) -- imperxsdisrc: Video source for [IMPERX HD-SDI Express frame grabbers][15] (SDI, HD-SDI) -- kayasrc: Video source for [KAYA Instruments frame grabbers][16] (Camera Link HS, CoaXPress, 10GigE Vision) -- matroxsrc: Video source for [MATROX Imaging Library (MIL)][12] (analog, Camera Link, Camera Link HS, CoaXPress, DVI-D, FireWire, GigE Vision, SDI) -- niimaqsrc: Video source for [National Instruments IMAQ frame grabbers][6] (analog, parallel digital, Camera Link) -- niimaqdxsrc: Video source for [National Instruments IMAQdx library][7] (GigE Vision, FireWire, USB3 Vision) -- phoenixsrc: Video source for [Active Silicon Phoenix frame grabbers][8] (HD-SDI, LVDS, Camera Link) -- pixcisrc: Video source for [EPIX PIXCI frame grabbers][4] (analog, LVDS, Camera Link) -- pleorasrc: Video source for [Pleora eBUS SDK devices][17] (GigE Vision, USB3 Vision) -- pylonsrc: Video source for [Basler Pylon sources][20] (GigE Vision, USB3 Vision) -- qcamsrc: Video source for [QImaging QCam cameras][21] (FireWire, discontinued) -- saperasrc: Video source for [Teledyne DALSA frame grabbers][9] (analog, Camera Link, HSLink, LVDS) - -## Image generation elements - -- edtpdvsink: Video sink for [EDT PDV Camera Link simulator][2] -- gigesimsink: Video sink for [A&B Soft GigESim][18] GigE Vision simulator -- kayasink: Video sink for [KAYA Instruments CXP simulator][16] -- pleorasink: Video sink for [Pleora eBUS SDK][19] GigE Vision transmitter - -## Other elements - -- extractcolor: Extract a single color channel -- klvinjector: Inject test synchronous KLV metadata -- klvinspector: Inspect synchronous KLV metadata -- rollingsum: Drops frames based on rolling mean analysis of a single column -- sfx3dnoise: Applies 3D noise to video -- videolevels: Scales monochrome 8- or 16-bit video to 8-bit, via manual setpoints or AGC - - ## Dependencies -- GStreamer 1.2.x or newer (1.8 needed for KLV) -- Specific frame grabber SDKs and/or licenses +- GStreamer 1.2.x or newer +- IDS uEye SDK (for camera support) -## Installation +## Building on Windows -- Install GStreamer 1.2.x or newer (1.8 needed for KLV) -- Build project (see below) or download [a release from Github](https://github.com/joshdoe/gst-plugins-vision/releases) (ZIP files under Assets) -- Extract files somewhere -- Create an environment variable `GST_PLUGIN_PATH` that points to where you extracted the files +### Quick Start with PowerShell Script -## Examples +The easiest way to build is using the provided PowerShell script: -Capture from a CoaXPress camera via a Kaya Komodo frame grabber, apply AGC to convert it to 8-bit monochrome, then output the video via A&B Software GigESim which generates GigE Vision video: -> `gst-launch-1.0 kayasrc ! videolevels auto=continuous ! gigesimsink` +```powershell +# Set the plugin installation path +$env:GST_PLUGIN_PATH = "C:\path\to\your\plugins" -Then in another command capture the GigE Vision video via Pleora eBUS and display the video to the screen: -> `gst-launch-1.0 pleorasrc ! autovideoconvert ! autovideosink` +# Build all plugins (IDS uEye + rollingsum) and auto-copy to GST_PLUGIN_PATH +.\build.ps1 -## Compiling +# Or build only IDS uEye plugin +.\build.ps1 -BuildType IDSuEyeOnly -### Windows +# Debug build without auto-copy +.\build.ps1 -Config Debug -NoCopy -- Install [Git](https://git-scm.com/) or download a ZIP archive -- Install [CMake](https://cmake.org/) -- Install [GStreamer distribution](https://gstreamer.freedesktop.org/download/) - or build from source. The installer should set - the installation path via the `GSTREAMER_1_0_ROOT_X86_64` environment variable. If - not set, set the CMake variable `GSTREAMER_ROOT` to your installation, the directory - containing `bin` and `lib` -- Install any camera or framegrabber software/SDK for those plugins you wish to - build. Check `cmake/modules` for any paths you may need to set. -- Run the following commands from a terminal or command prompt, assuming CMake - and Git are in your `PATH`. +# Custom GStreamer path +.\build.ps1 -GStreamerRoot "C:\custom\gstreamer\path" ``` + +For more options, see: +```powershell +Get-Help .\build.ps1 -Detailed +``` + +### Manual Build Process + +If you prefer to build manually: + +1. Install [CMake](https://cmake.org/) +2. Install [GStreamer distribution](https://gstreamer.freedesktop.org/download/) (default path: `C:\bin\gstreamer\1.0\msvc_x86_64`) +3. Install [IDS uEye SDK](https://www.ids-imaging.com) (default path: `C:\Program Files\IDS\uEye\Develop`) +4. Run: + +```bash git clone https://github.com/joshdoe/gst-plugins-vision.git cd gst-plugins-vision mkdir build cd build -cmake -G "Visual Studio 15 2017 Win64" .. +cmake .. -G "Visual Studio 16 2019" -A x64 -DGSTREAMER_ROOT="C:\bin\gstreamer\1.0\msvc_x86_64" +cmake --build . --config Release ``` -### Ubuntu +### Installation -Steps should be similar on other Linux distributions. +The `build.ps1` script automatically copies plugins to `$env:GST_PLUGIN_PATH` if set. Alternatively: -``` -apt-get install git cmake libgstreamer-plugins-base1.0-dev liborc-0.4-dev -git clone https://github.com/joshdoe/gst-plugins-vision.git -cd gst-plugins-vision -mkdir build -cd build -cmake .. -make +1. Set `GST_PLUGIN_PATH` environment variable to point to your plugin directory +2. Copy the built DLLs manually: + - `build\sys\idsueye\Release\libgstidsueye.dll` + - `build\gst\rollingsum\Release\libgstrollingsum.dll` + +### Verify Installation + +```bash +gst-inspect-1.0 idsueyesrc +gst-inspect-1.0 rollingsum ``` -### Installation and packaging +## Documentation -To install plugins, first make sure you've set `CMAKE_INSTALL_PREFIX` properly, -the default might not be desired (e.g., system path). For finer grained control -you can set `PLUGIN_INSTALL_DIR` and related variables to specify exactly where -you want to install plugins -``` -cmake --build . --target INSTALL -# or on Linux -make install -``` -- To create a package of all compiled plugins run: -``` -cmake --build . --target PACKAGE -# or on Linux -make package -``` +- [IDS uEye Build Instructions](BUILD_IDSUEYE.md) +- [Rolling Sum Filter Design](DESIGN_ROLLINGSUM.md) -## KLV +## See Also -KLV support is based on a GStreamer [merge request](https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/124) that has yet to be merged, so it is included here in the klv library. By default KLV support is disabled. To enable it set the CMake flag `ENABLE_KLV`. This will create the klv plugin, and make the pleora plugin dependent on the klv library. You'll need to ensure `libgstklv-1.0-1.dll` is in the system `PATH` on Windows, or on Linux make sure `libgstklv-1.0-1.so` is in the `LD_LIBRARY_PATH`. +- [Aravis](https://github.com/AravisProject/aravis) - Linux open source GStreamer plugin for GigE Vision and USB3 Vision cameras -See also --------- -- [Aravis][13], Linux open source GStreamer plugin for GigE Vision and USB3 Vision cameras - -[1]: http://www.edt.com/camera_link.html -[2]: http://www.edt.com/pcidv_cls.html -[3]: http://www.euresys.com/Products/FrameGrabber.asp -[4]: http://www.epixinc.com/products/index.htm#divtab1 -[5]: http://www.imperx.com/framegrabbers -[6]: http://sine.ni.com/nips/cds/view/p/lang/en/nid/1292 -[7]: http://sine.ni.com/nips/cds/view/p/lang/en/nid/12892 -[8]: http://www.activesilicon.com/products_fg_phx.htm -[9]: https://www.teledynedalsa.com/imaging/products/fg/ -[10]: http://www.bitflow.com -[11]: http://www.ids-imaging.com -[12]: http://www.matrox.com/imaging -[13]: https://github.com/AravisProject/aravis -[14]: https://www.onsemi.com -[15]: https://www.imperx.com/framegrabbers -[16]: https://kayainstruments.com -[17]: https://www.pleora.com -[18]: http://www.ab-soft.com/gigesim.php -[19]: https://www.pleora.com -[20]: https://www.baslerweb.com/ -[21]: https://www.photometrics.com/qimaging +[1]: http://www.ids-imaging.com diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..5eecedd --- /dev/null +++ b/build.ps1 @@ -0,0 +1,311 @@ +#Requires -Version 5.1 + +<# +.SYNOPSIS + Build GStreamer Vision Plugins + +.DESCRIPTION + Builds GStreamer vision plugins (IDS uEye, Rolling Sum, etc.) and copies them to GST_PLUGIN_PATH + +.PARAMETER GStreamerRoot + Path to GStreamer installation directory. Defaults to C:\bin\gstreamer\1.0\msvc_x86_64 + +.PARAMETER BuildType + Type of build: 'All' (default), 'IDSuEyeOnly' + +.PARAMETER Config + Build configuration: 'Release' (default) or 'Debug' + +.PARAMETER NoCopy + Skip copying plugins to GST_PLUGIN_PATH + +.EXAMPLE + .\build.ps1 + Build all plugins with default settings + +.EXAMPLE + .\build.ps1 -GStreamerRoot "C:\custom\gstreamer\path" + Build all plugins with custom GStreamer path + +.EXAMPLE + .\build.ps1 -BuildType IDSuEyeOnly + Build only IDS uEye plugin + +.EXAMPLE + .\build.ps1 -Config Debug -NoCopy + Build in Debug mode without copying to GST_PLUGIN_PATH +#> + +param( + [string]$GStreamerRoot = "", + [ValidateSet('All', 'IDSuEyeOnly')] + [string]$BuildType = 'All', + [ValidateSet('Release', 'Debug')] + [string]$Config = 'Release', + [switch]$NoCopy +) + +# Set error action preference +$ErrorActionPreference = "Stop" + +# Banner +Write-Host "========================================" -ForegroundColor Cyan +Write-Host "GStreamer Vision Plugins Build Script" -ForegroundColor Cyan +Write-Host "========================================" -ForegroundColor Cyan +Write-Host "" + +# Determine GStreamer root path +$defaultGStreamerRoot = "C:\bin\gstreamer\1.0\msvc_x86_64" + +if ($GStreamerRoot) { + Write-Host "Using GStreamer from parameter: $GStreamerRoot" -ForegroundColor Green +} elseif ($env:GSTREAMER_ROOT) { + $GStreamerRoot = $env:GSTREAMER_ROOT + Write-Host "Using GStreamer from environment: $GStreamerRoot" -ForegroundColor Green +} else { + $GStreamerRoot = $defaultGStreamerRoot + Write-Host "Using default GStreamer location: $GStreamerRoot" -ForegroundColor Green +} + +# Verify GStreamer directory exists +if (-not (Test-Path $GStreamerRoot)) { + Write-Host "" + Write-Host "ERROR: GStreamer directory does not exist: $GStreamerRoot" -ForegroundColor Red + Write-Host "" + Write-Host "Please provide correct GStreamer path:" -ForegroundColor Yellow + Write-Host " .\build.ps1 -GStreamerRoot 'C:\path\to\gstreamer'" -ForegroundColor Yellow + Write-Host "" + exit 1 +} + +Write-Host "" +Write-Host "Build Configuration:" -ForegroundColor Cyan +Write-Host " Build Type: $BuildType" -ForegroundColor White +Write-Host " Config: $Config" -ForegroundColor White +Write-Host " GStreamer: $GStreamerRoot" -ForegroundColor White +Write-Host "" + +# Determine build directory and CMakeLists configuration +if ($BuildType -eq 'IDSuEyeOnly') { + $buildDir = "build_idsueye" + $useStandaloneCMake = $true + $pluginPaths = @( + @{ Name = "libgstidsueye.dll"; RelPath = "Release\libgstidsueye.dll" } + ) + Write-Host "Building: IDS uEye plugin only" -ForegroundColor Yellow +} else { + $buildDir = "build" + $useStandaloneCMake = $false + $pluginPaths = @( + @{ Name = "libgstidsueye.dll"; RelPath = "sys\idsueye\Release\libgstidsueye.dll" }, + @{ Name = "libgstrollingsum.dll"; RelPath = "gst\rollingsum\Release\libgstrollingsum.dll" } + ) + Write-Host "Building: All plugins (IDS uEye, Rolling Sum)" -ForegroundColor Yellow +} + +Write-Host "" + +# Create build directory +if (-not (Test-Path $buildDir)) { + New-Item -ItemType Directory -Path $buildDir | Out-Null + Write-Host "Created build directory: $buildDir" -ForegroundColor Green +} else { + Write-Host "Using existing build directory: $buildDir" -ForegroundColor Green +} + +# Copy standalone CMakeLists if building IDS uEye only +if ($useStandaloneCMake) { + Copy-Item -Path "CMakeLists_idsueye_only.txt" -Destination "$buildDir\CMakeLists.txt" -Force + Write-Host "Using standalone IDS uEye CMakeLists configuration" -ForegroundColor Green +} + +Write-Host "" + +# Configure CMake +Write-Host "Configuring CMake..." -ForegroundColor Cyan +Write-Host "" + +Push-Location $buildDir +try { + if ($useStandaloneCMake) { + # For standalone build, configure from current directory + $cmakeArgs = @( + ".", + "-G", "Visual Studio 16 2019", + "-A", "x64", + "-DGSTREAMER_ROOT=$GStreamerRoot", + "-DCMAKE_PREFIX_PATH=$GStreamerRoot" + ) + } else { + # For full build, configure from parent directory + $cmakeArgs = @( + "..", + "-G", "Visual Studio 16 2019", + "-A", "x64", + "-DGSTREAMER_ROOT=$GStreamerRoot", + "-DCMAKE_PREFIX_PATH=$GStreamerRoot" + ) + } + + & cmake $cmakeArgs + + if ($LASTEXITCODE -ne 0) { + Write-Host "" + Write-Host "========================================" -ForegroundColor Red + Write-Host "CMake configuration failed!" -ForegroundColor Red + Write-Host "========================================" -ForegroundColor Red + Write-Host "" + Write-Host "Common issues:" -ForegroundColor Yellow + Write-Host "1. GStreamer not properly installed at: $GStreamerRoot" -ForegroundColor Yellow + Write-Host "2. IDS uEye SDK not found (default: C:\Program Files\IDS\uEye\Develop)" -ForegroundColor Yellow + Write-Host "3. Missing GStreamer development files" -ForegroundColor Yellow + Write-Host "" + Write-Host "To specify custom IDS uEye SDK location:" -ForegroundColor Yellow + Write-Host " `$env:IDSUEYE_DIR='C:\path\to\ueye\sdk'" -ForegroundColor Yellow + Write-Host " .\build.ps1" -ForegroundColor Yellow + Write-Host "" + exit 1 + } + + # Build the plugins + Write-Host "" + Write-Host "Building plugins..." -ForegroundColor Cyan + Write-Host "" + + & cmake --build . --config $Config + + if ($LASTEXITCODE -ne 0) { + Write-Host "" + Write-Host "========================================" -ForegroundColor Red + Write-Host "Build failed!" -ForegroundColor Red + Write-Host "========================================" -ForegroundColor Red + exit 1 + } + + # Collect built plugin paths (resolve to absolute paths while in build directory) + $builtPlugins = @() + foreach ($pluginInfo in $pluginPaths) { + $pluginPath = $pluginInfo.RelPath + if (Test-Path $pluginPath) { + $fullPath = (Resolve-Path $pluginPath).Path + $builtPlugins += $fullPath + Write-Host "Found plugin: $fullPath" -ForegroundColor Gray + } else { + Write-Host "Warning: Expected plugin not found: $pluginPath" -ForegroundColor Yellow + } + } + + Pop-Location + + Write-Host "" + Write-Host "========================================" -ForegroundColor Green + Write-Host "Build completed successfully!" -ForegroundColor Green + Write-Host "========================================" -ForegroundColor Green + Write-Host "" + + # Display built plugins + Write-Host "Built plugins:" -ForegroundColor Cyan + foreach ($plugin in $builtPlugins) { + Write-Host " - $plugin" -ForegroundColor White + } + Write-Host "" + + # Copy plugins to GST_PLUGIN_PATH if requested + if (-not $NoCopy) { + if ($env:GST_PLUGIN_PATH) { + Write-Host "Copying plugins to GST_PLUGIN_PATH..." -ForegroundColor Cyan + Write-Host " Destination: $env:GST_PLUGIN_PATH" -ForegroundColor White + Write-Host " Plugin count: $($builtPlugins.Count)" -ForegroundColor Gray + + if ($builtPlugins.Count -eq 0) { + Write-Host "" + Write-Host "Warning: No plugins found to copy!" -ForegroundColor Yellow + Write-Host "Build may have failed or plugins built to unexpected location." -ForegroundColor Yellow + } else { + Write-Host "" + + # Ensure the directory exists + if (-not (Test-Path $env:GST_PLUGIN_PATH)) { + New-Item -ItemType Directory -Path $env:GST_PLUGIN_PATH -Force | Out-Null + Write-Host "Created GST_PLUGIN_PATH directory: $env:GST_PLUGIN_PATH" -ForegroundColor Green + Write-Host "" + } + + # Copy each plugin + $copiedCount = 0 + foreach ($plugin in $builtPlugins) { + Write-Host " Copying: $plugin" -ForegroundColor Gray + $destPath = Join-Path -Path $env:GST_PLUGIN_PATH -ChildPath (Split-Path -Leaf $plugin) + Write-Host " To: $destPath" -ForegroundColor Gray + + # Verify source exists + if (-not (Test-Path $plugin)) { + Write-Host " ✗ Source file not found: $plugin" -ForegroundColor Red + continue + } + + try { + Copy-Item -Path $plugin -Destination $destPath -Force -ErrorAction Stop + Write-Host " ✓ Copied: $(Split-Path -Leaf $plugin)" -ForegroundColor Green + $copiedCount++ + } catch { + Write-Host " ✗ Failed to copy $(Split-Path -Leaf $plugin): $_" -ForegroundColor Red + } + Write-Host "" + } + + if ($copiedCount -eq $builtPlugins.Count) { + Write-Host "Successfully copied $copiedCount plugin(s) to GST_PLUGIN_PATH" -ForegroundColor Green + } elseif ($copiedCount -gt 0) { + Write-Host "Copied $copiedCount of $($builtPlugins.Count) plugin(s)" -ForegroundColor Yellow + } else { + Write-Host "Failed to copy any plugins!" -ForegroundColor Red + } + } + } else { + Write-Host "GST_PLUGIN_PATH environment variable is not set" -ForegroundColor Yellow + Write-Host "Skipping automatic copy. Plugins remain in build directory." -ForegroundColor Yellow + Write-Host "" + Write-Host "To set GST_PLUGIN_PATH:" -ForegroundColor Yellow + Write-Host " `$env:GST_PLUGIN_PATH = 'C:\path\to\plugins'" -ForegroundColor White + Write-Host "" + Write-Host "Or manually copy plugins to your GStreamer plugins directory:" -ForegroundColor Yellow + Write-Host " $GStreamerRoot\lib\gstreamer-1.0\" -ForegroundColor White + } + } else { + Write-Host "Skipping copy to GST_PLUGIN_PATH (-NoCopy specified)" -ForegroundColor Yellow + } + + Write-Host "" + Write-Host "========================================" -ForegroundColor Cyan + Write-Host "Next Steps" -ForegroundColor Cyan + Write-Host "========================================" -ForegroundColor Cyan + Write-Host "" + + if ($BuildType -eq 'IDSuEyeOnly') { + Write-Host "Verify installation with:" -ForegroundColor Yellow + Write-Host " gst-inspect-1.0 idsueyesrc" -ForegroundColor White + Write-Host "" + Write-Host "Example pipeline:" -ForegroundColor Yellow + Write-Host " gst-launch-1.0 idsueyesrc ! autovideosink" -ForegroundColor White + } else { + Write-Host "Verify installation with:" -ForegroundColor Yellow + Write-Host " gst-inspect-1.0 idsueyesrc" -ForegroundColor White + Write-Host " gst-inspect-1.0 rollingsum" -ForegroundColor White + Write-Host "" + Write-Host "Example pipeline:" -ForegroundColor Yellow + Write-Host " gst-launch-1.0 idsueyesrc config-file=config.ini ! rollingsum window-size=1000 column-index=1 threshold=0.5 ! autovideosink" -ForegroundColor White + } + Write-Host "" + +} catch { + Pop-Location + Write-Host "" + Write-Host "========================================" -ForegroundColor Red + Write-Host "Build script failed!" -ForegroundColor Red + Write-Host "========================================" -ForegroundColor Red + Write-Host "" + Write-Host "Error: $_" -ForegroundColor Red + Write-Host "" + exit 1 +} \ No newline at end of file diff --git a/build_idsueye_and_rollingsum.bat b/build_idsueye_and_rollingsum.bat deleted file mode 100644 index 94d634d..0000000 --- a/build_idsueye_and_rollingsum.bat +++ /dev/null @@ -1,126 +0,0 @@ -@echo off -REM Script to build IDS uEye and Rolling Sum plugins - -echo ======================================== -echo Building IDS uEye and Rolling Sum Plugins -echo ======================================== -echo. - -REM Set default GStreamer path (can be overridden by environment variable or command line) -set DEFAULT_GSTREAMER_ROOT=C:\bin\gstreamer\1.0\msvc_x86_64 - -REM Allow override via command line parameter -if not "%~1"=="" ( - set GSTREAMER_ROOT=%~1 - echo Using GStreamer from command line: %GSTREAMER_ROOT% -) else if defined GSTREAMER_ROOT ( - echo Using GStreamer from environment: %GSTREAMER_ROOT% -) else ( - set GSTREAMER_ROOT=%DEFAULT_GSTREAMER_ROOT% - echo Using default GStreamer location: %GSTREAMER_ROOT% -) - -REM Verify GStreamer directory exists -if not exist "%GSTREAMER_ROOT%" ( - echo ERROR: GStreamer directory does not exist: %GSTREAMER_ROOT% - echo. - echo Please provide correct GStreamer path: - echo build_idsueye_and_rollingsum.bat "C:\path\to\gstreamer" - echo. - exit /b 1 -) - -echo. - -REM Create build directory -if not exist build ( - mkdir build - echo Created build directory: build -) else ( - echo Using existing build directory: build -) - -echo. - -cd build - -REM Configure CMake -echo Configuring CMake... -echo. -cmake .. -G "Visual Studio 16 2019" -A x64 ^ - -DGSTREAMER_ROOT="%GSTREAMER_ROOT%" ^ - -DCMAKE_PREFIX_PATH="%GSTREAMER_ROOT%" - -if %ERRORLEVEL% NEQ 0 ( - echo. - echo ======================================== - echo CMake configuration failed! - echo ======================================== - echo. - echo Common issues: - echo 1. GStreamer not properly installed at: %GSTREAMER_ROOT% - echo 2. IDS uEye SDK not found (default: C:\Program Files\IDS\uEye\Develop) - echo 3. Missing GStreamer development files - echo. - echo To specify custom IDS uEye SDK location: - echo set IDSUEYE_DIR=C:\path\to\ueye\sdk - echo build_idsueye_and_rollingsum.bat - echo. - cd .. - exit /b 1 -) - -REM Build the plugins -echo. -echo Building plugins... -echo. -cmake --build . --config Release - -if %ERRORLEVEL% NEQ 0 ( - echo. - echo ======================================== - echo Build failed! - echo ======================================== - cd .. - exit /b 1 -) - -REM Install the plugins -echo. -echo Installing plugins to GStreamer directory... -echo. -cmake --build . --config Release --target install - -if %ERRORLEVEL% NEQ 0 ( - echo. - echo ======================================== - echo Installation failed! - echo ======================================== - echo. - echo You may need administrator privileges to install. - echo Try running this script as administrator. - echo. - cd .. - exit /b 1 -) - -echo. -echo ======================================== -echo Build and installation completed successfully! -echo ======================================== -echo. -echo Installed plugins: -echo - libgstidsueye.dll (IDS uEye camera source) -echo - libgstrollingsum.dll (Rolling sum filter) -echo. -echo Installation location: %GSTREAMER_ROOT%\lib\gstreamer-1.0\ -echo. -echo Verify installation with: -echo gst-inspect-1.0 idsueyesrc -echo gst-inspect-1.0 rollingsum -echo. -echo Example pipeline: -echo gst-launch-1.0 idsueyesrc config-file=config.ini ! rollingsum window-size=1000 column-index=1 threshold=0.5 ! autovideosink -echo. - -cd .. \ No newline at end of file diff --git a/build_idsueye_only.bat b/build_idsueye_only.bat deleted file mode 100644 index fd4783b..0000000 --- a/build_idsueye_only.bat +++ /dev/null @@ -1,100 +0,0 @@ -@echo off -REM Script to build only IDS uEye plugin - -echo ======================================== -echo Building IDS uEye Plugin Only -echo ======================================== -echo. - -REM Set default GStreamer path (can be overridden by environment variable or command line) -set DEFAULT_GSTREAMER_ROOT=C:\bin\gstreamer\1.0\msvc_x86_64 - -REM Allow override via command line parameter -if not "%~1"=="" ( - set GSTREAMER_ROOT=%~1 - echo Using GStreamer from command line: %GSTREAMER_ROOT% -) else if defined GSTREAMER_ROOT ( - echo Using GStreamer from environment: %GSTREAMER_ROOT% -) else ( - set GSTREAMER_ROOT=%DEFAULT_GSTREAMER_ROOT% - echo Using default GStreamer location: %GSTREAMER_ROOT% -) - -REM Verify GStreamer directory exists -if not exist "%GSTREAMER_ROOT%" ( - echo ERROR: GStreamer directory does not exist: %GSTREAMER_ROOT% - echo. - echo Please provide correct GStreamer path: - echo build_idsueye_only.bat "C:\path\to\gstreamer" - echo. - exit /b 1 -) - -echo. - -REM Create build directory -if not exist build_idsueye ( - mkdir build_idsueye - echo Created build directory: build_idsueye -) - -REM Copy standalone CMakeLists to build directory for configuration -copy /Y CMakeLists_idsueye_only.txt build_idsueye\CMakeLists.txt >nul -echo Using standalone IDS uEye CMakeLists configuration -echo. - -cd build_idsueye - -REM Configure CMake -echo Configuring CMake... -echo. -cmake . -G "Visual Studio 16 2019" -A x64 ^ - -DGSTREAMER_ROOT="%GSTREAMER_ROOT%" ^ - -DCMAKE_PREFIX_PATH="%GSTREAMER_ROOT%" - -if %ERRORLEVEL% NEQ 0 ( - echo. - echo ======================================== - echo CMake configuration failed! - echo ======================================== - echo. - echo Common issues: - echo 1. GStreamer not properly installed at: %GSTREAMER_ROOT% - echo 2. IDS uEye SDK not found (default: C:\Program Files\IDS\uEye\Develop) - echo 3. Missing GStreamer development files - echo. - echo To specify custom IDS uEye SDK location: - echo set IDSUEYE_DIR=C:\path\to\ueye\sdk - echo build_idsueye_only.bat - echo. - cd .. - exit /b 1 -) - -REM Build the plugin -echo. -echo Building gstidsueye plugin... -echo. -cmake --build . --config Release - -if %ERRORLEVEL% NEQ 0 ( - echo. - echo ======================================== - echo Build failed! - echo ======================================== - cd .. - exit /b 1 -) - -echo. -echo ======================================== -echo Build completed successfully! -echo ======================================== -echo. -echo Plugin location: build_idsueye\Release\libgstidsueye.dll -echo. -echo To install to GStreamer plugins directory, run: -echo cmake --build build_idsueye --config Release --target install -echo. - -cd .. \ No newline at end of file diff --git a/set_paths_and_run_cmake.bat b/set_paths_and_run_cmake.bat deleted file mode 100644 index 1294244..0000000 --- a/set_paths_and_run_cmake.bat +++ /dev/null @@ -1,22 +0,0 @@ -rem ######################################################################## -set GSTREAMER_DIR=C:\gstreamer -set LIBXML2_DIR=%GSTREAMER_DIR% -set LIBICONV_DIR=%GSTREAMER_DIR% -set GLIB2_DIR=%GSTREAMER_DIR% -set NIIMAQ_DIR=C:\Program Files\National Instruments -set EURESYS_DIR=C:\Program Files\Euresys\MultiCam -set OpenCV_DIR=C:\Users\joshua.doe\Apps\opencv - -rem Plugins will be installed under %CMAKE_PREFIX_PATH%\lib\gstreamer-0.10 -set CMAKE_PREFIX_PATH=C:\gstreamer - -rem cd mingw32 -rem del *ache* && cmake -G "MinGW Makefiles" .. - -rem cd vs9 -rem del *ache* && cmake -G "Visual Studio 9 2008" .. - -rem cmd -rem ######################################################################## - -cmake-gui \ No newline at end of file