Git Product home page Git Product logo

krupkat / xpano Goto Github PK

View Code? Open in Web Editor NEW
135.0 9.0 13.0 6.33 MB

Automated photo stiching tool. Lets you import a directory of images and then export the autodetected panoramas.

Home Page: https://krupkat.github.io/xpano/

License: GNU General Public License v3.0

CMake 2.77% C++ 90.43% Shell 3.99% PowerShell 1.42% Python 0.71% Ruby 0.03% Nix 0.64%
cpp imgui imgui-sdl opencv panorama panorama-stitching sdl

xpano's Introduction

tests clang-format clang-tidy

xpano

Xpano is a tool for panorama stitching with focus on simplicity and ease of use, major features include:

  • Auto detection of groups of images that can be stitched into panoramas
  • Preview + zoom + pan of the computed panoramas
  • Crop mode, boundary auto fill, selectable projection types
  • Projection adjustments: pitch, yaw and roll
  • Export of full resolution panoramas including exif metadata

Built with

The app uses the excellent OpenCV library for image manipulation and its stitching module for computing the panoramas.

Other dependencies include imgui, SDL, spdlog, Catch2, nativefiledialog-extended, alpaca, thread-pool, expected, Exiv2, multiblend, SIMDe and the Google Noto fonts.

Demo

Check out the demo on YouTube. This is how the app looks after importing a directory of 200 images.

Main Xpano gui

Installation

Install directly from Flathub or the Microsoft Store:

Download from Flathub  Download from the Microsoft Store

Get additional packages:

Command line

Xpano has basic CLI support, you can either run it fully automatic in the command line, or launch to gui with the --gui flag.

Xpano [<input files>] [--output=<path>] [--gui] [--help] [--version]

Development

The project can be built by running a single script from the misc/build directory. You will need at least CMake 3.21, git and a compiler with C++20 support.

NixOS

Run the build script from the root of the repository:

nix-shell misc/build/nix/default.nix
./misc/build/build-nixos.sh

Possible issues when running - troubleshooting.

MacOS

Library prerequisites: SDL2, spdlog, catch2

Install with brew: brew install sdl2 spdlog catch2

Install with macports: sudo port install libsdl2 spdlog catch2 (for details: #96)

Run the build script from the root of the repository:

./misc/build/build-macos.sh

Ubuntu 22.04

Library prerequisites:

sudo apt install libgtk-3-dev libopencv-dev libsdl2-dev libspdlog-dev

Run the build script from the root of the repository:

./misc/build/build-ubuntu-22.sh

Ubuntu 20.04

Build works with g++-10 from the system repository. You will have to install a more recent version of CMake, e.g. from Kitware.

Library prerequisites:

sudo apt install libgtk-3-dev

Run the build script from the root of the repository:

./misc/build/build-ubuntu-20.sh

Windows

Open the "Developer PowerShell for VS 2022" profile in Windows Terminal and run the build script from the root of the repository:

./misc/build/build-windows-latest.ps1

Contributions

Contributions are more than welcome, there is a couple of ideas for enhancements in open issues which you could take on - if you start working on one of them, please add a comment there.

Please check the contribution guidelines for further details regarding formatting and coding style.

License

Distributed under the GPL-3.0-or-later license. See the full license text for more information.

Contact

Tomas Krupka - krupkat.cz

xpano's People

Contributors

altonss avatar ghostvaibhav avatar krupkat avatar mstraeten avatar poshi1865 avatar strogonoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xpano's Issues

Enhancement: recognize TIFF files with .tif or .TIF extension

Bug description
-AnotherRawTherapee exports TIFF files with '.tif'
-.tif or .TIF not visible with default filter; I have to switch to 'all' to find
-.tif or .TIF not processed with 'all files' filter; when selected, images are not loaded
-if I rename extensions to .tiff or .TIFF, the files are loaded and processed

Desktop (please complete the following information):

  • OS:
    Linux Mint
  • Version:
    app: 0.11.0
    os: 21.1
  • Method of installation:
    APT repository on launchpad

MacOS build

Add a workflow to build on macos.

There might be some issues with compiler compatibility with some of the c++20 features, but in general it should work - all the dependencies are supported.

Metadata support

cv::imwrite doesn't support metadata writing, so the output files from Xpano currently have none

It would be nice to copy over some of the metadata from the input files + add a comment like "stitched from n panos by Xpano".

Probably will need to integrate https://github.com/Exiv2/exiv2

Bug report window

Add a bug report window accessible from the Help menu:

help

  1. Put the BugReportPane object in PanoGui here, with implementation similar to the existing AboutPane.

  2. Window contents

  3. There should be "copy to clipboard" buttons next to actionable items.

  4. Stretch goal: Parse the log file from the previous launch (xpano.1.log) and if there is an [error] entry show the bug report window indicating that there was an error in the last run.

    • Add a toggle "don't show this again", which will need to persist its state in the config

This issue will likely be split into multiple pull requests.

unable to launch on OSX, dylib error

Bug description
Cloned latest release (today) and installed on OSX 13.1 with no errors and 48 tests pass.

Launching ~/xpano/install/bin/Xpano aborts due to dylib files not found.

fleming@Flemings-Mac-mini ~ % /Users/fleming/Documents/GitHub/xpano/install/bin/Xpano ; exit;
dyld[56853]: Library not loaded: @rpath/libopencv_imgcodecs.407.dylib
Referenced from: /Users/fleming/Documents/GitHub/xpano/install/bin/Xpano
Reason: tried: '/System/Volumes/Preboot/Cryptexes/OS@rpath/libopencv_imgcodecs.407.dylib' (no such file), '/usr/local/lib/libopencv_imgcodecs.407.dylib' (no such file), '/usr/lib/libopencv_imgcodecs.407.dylib' (no such file, not in dyld cache)
zsh: abort /Users/fleming/Documents/GitHub/xpano/install/bin/Xpano

Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

These files are in ~/xpano/opencv/install/lib/cmake. Copying the aliases to /usr/local/lib did not fix issue.

macOS build fails (something about `spdlog`)

Thanks for this exciting bit of software! Can’t wait to try it.

Bug description

./misc/build/build-macos-12.sh
-- Performing Test NFD_USE_ALLOWEDCONTENTTYPES - Success
-- Found OpenCV: /Users/anileated/Developer/xpano/opencv/install (found version "4.7.0") found components: calib3d core features2d flann imgcodecs imgproc photo stitching 
CMake Error at CMakeLists.txt:87 (find_package):
  By not providing "Findspdlog.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "spdlog", but
  CMake did not find one.

  Could not find a package configuration file provided by "spdlog" with any
  of the following names:

    spdlogConfig.cmake
    spdlog-config.cmake

  Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
  "spdlog_DIR" to a directory containing one of the above files.  If "spdlog"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!
See also "/Users/anileated/Developer/xpano/build/CMakeFiles/CMakeOutput.log".cmake --version
cmake version 3.24.4

Desktop (please complete the following information):

  • OS: macOS 13.4
  • Version: 41deb4b
  • Method of installation: ./misc/build/build-macos-12.sh

Show buton does not show anything after importing 2 images

Initial situation
I imported 2 png files via the "Import images : Multiple files" button

  • Their thumbnails display correctly in the bottom "film strip" style area
  • In "list of pano" I have one pano titled "0,1" and a "show button
  • Hovering the "show" button displays one more instance of the 2 thumbnails attach to my cursor position
  • the right pano area is void

THE BUG :
Pushing the show buttons shows nothing
I have a "failed to stitch pano 0" with ERR_NEED_MORE_IMGS

ADDITIONAL INFO

  • displaying debug info show a "matched" list with a functional "show" button that shows "184 inliers" displayed in green on the image

Desktop infos:

  • OS: Gentoo - kernel 5.10.76-gentoo-r1 - profile 17.1 desktop (stable)
  • Version: xpano 0.9.0
  • Method of installation: flatpak

ONE TIME link to images
82.64.103.11/online/f.php?h=1OunIyVs
82.64.103.11/online/f.php?h=1OunIyVs

Couldn't load images OpenCV(4.6.0)

Bug description

~ ls -al *.jpeg  | wc -l 
3075
~ Xpano * --output=/tmp/panorama.jpeg
...
[2023-09-30 17:36:50.131] [XPano] [error] Couldn't load images OpenCV(4.6.0) ./modules/flann/src/miniflann.cpp:521: error: (-215:Assertion failed) (size_t)knn <= index_->size() in function 'runKnnSearch_'

All the images are part of the same one panorama picture, shoot with dwarf 2 .

Desktop (please complete the following information):

  • OS: Linux
  • Version: 0.16.1
  • Method of installation: dpkg

Persistent window size

Window size should persist between launches.

This is already true for the individual ImGui windows thanks to its imgui.ini file.

The SDL window however is initialized with a constant size Code location.

Check clang-tidy on push

Run clang-tidy check on push to main / pull requests.

Since clang-tidy requires a compilation database, it would make sense to slap this check on top of one of the existing build workflows, likely the Ubuntu one as it runs faster.

Existing windows script.

Drag n Drop not opening anything

Hi,
Grag n dropping PNG files over the interface (whichever part) won't open files, even though the icon when hovering suggest it will.
Nothing is logged in the Displayable debug info (CTRL+D)

Early exit when large field of view + perspective projection

Having a large field of view (close to 180 degrees or more), doesn't play well with the perspective projection ("rectilinear", see wide field of view examples in https://www.cambridgeincolour.com/tutorials/image-projections.htm).

This can lead to very large output images, which can in turn eat up all memory trying to allocate space for it. As a first solution, let's stop the algorithm early and show the user that this is the case.

Howto

Replace the blender::prepare call here with the following:

auto result_roi = cv::detail::resultRoi(corners, sizes);
// check if result_roi.size() is too large and exit early
blender_->prepare(result_roi);

Add a new return type here:

enum class Status {

Test on photos and make sure the app doesn't crash and shows the error.

Stretch goal

Make the max size of the panorama a user selectable value (in MPx):


This will help solve #102

Async license loading

The license files are currently being loaded before the start of the main gui: Code location.

  • Measure the impact / delay between launch and gui first showing up
  • Implement async loading of the files

Linux file dialog: case sensitive ext filter

We currently have the following supported extensions:

const std::array<std::string, 5> kSupportedExtensions = {"jpg", "jpeg", "tiff",
                                                         "png", "bmp"};

However on Linux this doesn't show files with uppercase extensions in the native file dialog.

Preview during loading

Add preview during loading, so that the user has something else than the progress bar to watch :)

  • Evaluate what kind of preview is worth the cost
  • First step would probably be to show image previews as they're being loaded

E.g. by adding a cv::Mat LoadingPreview() function here.

Crash while opening directory on Ubuntu 20.04

Bug description
Opening a directory on Ubuntu 20.04 + flatpak crashes the app.

$ flatpak run cz.krupkat.Xpano 
terminate called after throwing an instance of 'std::filesystem::__cxx11::filesystem_error'
  what():  filesystem error: directory iterator cannot open directory: Not a directory [/run/user/1000/doc/f2ef324/image00.jpg]

Desktop

  • OS: Ubuntu 20.04
  • Version: 0.11.0
  • Method of installation: flatpak

0.15: missing multiblend option on OSX arm

the multiblend option is missing even there're no errors in the build output
image

Desktop (please complete the following information):

  • OS: macOS Ventura
  • Version: 13.4
  • arm64
  • Method of installation: ./misc/build/build-macos-12.sh but in an macports environment

ERR PANO TOO LARGE

When I export a panoramic picture, the software reports an error:
ERR PANO TOO LARGE
Reset the adjustments through the edit menu.
微信图片_20240312162017

Can't create any Panorama

I tried to generate a Panorama with 11 images, there I get the error
ERR_CAMERA_PARAMS_ADJUST_FAIL

Then I wanted to try another one with 8 images it seemed to work (It was stitched and adjusted correctly) until I wanted to export it, but it failed with:
ERR_PANO_TOO_LARGE

Images are 4160px width and 6240px height
I could provide them if needed.

With Hugin it was no problem to create the panorama from.

PKGBUILD proposal for Arch linux

Please find below a tentative PKGBUILD for Arch users. Note that the ctest command in the check() section is commented out, until test #20 is fixed.

# Maintainer: Sébastien Guyader <[email protected]>

_pkgname=xpano
pkgname="$_pkgname-git"
pkgver=0.12.0.r1.g4d9afc6
pkgrel=1
pkgdesc="Automated photo stitching tool, with focus on simplicity and ease of use"
arch=('x86_64')
url='https://github.com/krupkat/xpano'
license=('GPL3')
depends=('gtk3' 'opencv>=4.4.0' 'sdl2' 'spdlog' 'catch2v3')
makedepends=('cmake' 'git')
provides=("$_pkgname")
conflicts=("$_pkgname")
source=('xpano::git+https://github.com/krupkat/xpano.git'
		'alpaca::git+https://github.com/p-ranav/alpaca.git'
		'imgui::git+https://github.com/krupkat/imgui.git'
		'nativefiledialog-extended::git+https://github.com/btzy/nativefiledialog-extended.git'
		'thread-pool::git+https://github.com/krupkat/thread-pool.git'
		)
md5sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')

pkgver(){
	cd $_pkgname
	git describe --long --tags --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	git -C xpano submodule init
	local _submodule
	for _submodule in alpaca imgui nativefiledialog-extended thread-pool
	do
		git -C xpano config --local submodule.external/${_submodule}.url "$srcdir/${_submodule}"
	done
	git -C xpano -c protocol.file.allow='always' submodule update
}

build() {
	cmake -B build -S $_pkgname \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_TESTING=ON \
		-DCMAKE_EXPORT_COMPILE_COMMANDS=OFF
	cmake --build build -j $(nproc)
}

check() {
	cd build
	#ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

Seamless blending

It doesn't look like Xpano is capable of seamless blending right now.

It becomes obvious when there's clear sky in the photos. Here is how hugin blends:

image

Here is what Xpano does:

Screenshot from 2023-04-09 14-09-31

You can clearly see darker patches of sky in the latter case.

There are multiple options how to deal with that. Enblend seems unmaintained, but https://horman.net/multiblend/ keeps getting updates apparently.

And then there's also https://github.com/weltyj/SkyFill to fill missing parts of the sky, if you are interested.

A lot of images in one panorama -> too high mem usage -> crash.

Bug description
If I try to stitch a panorama with a lot of (12, 15, 20 or more) images, the stitching progress is working normal from 0 up to a point of 90-99%.
But at this point, the progress slows down dramatically and memory usage is starting to increase, until all my RAM and swap is used and Xpano crashes (or get killed by the OS?).
Sometimes, this happens while calculating the preview, sometimes you can calculate the preview but it you calculate high res to export, it crashes.
I have 16GB RAM and 8GB swap, which is way more than a lot of other computer have.

Desktop (please complete the following information):

  • OS: Ubuntu Linux 22.04
  • Version: 0.15.1
  • Method of installation: Flatpak

Advanced loading parameters

The app by default loads images at half resolution and then computes the keypoints and descriptors.

These should be configurable in the options.

  • resizing factor
  • number of keypoints to detect per image
  • keypoint/descriptor algorithms

Image loading: Code location
Loading dispatch: Code location
Options menu: Code location

Better cancellation support for stitching

Problem description
Currently the OpenCV stitch function cannot be cancelled from within Xpano.

This can lead to the progress appearing stuck (though the gui continues working).

When a user selects a new panorama / edits the current panorama by adding/removing an image a new stitch operation is enqueued.

The app behaves correctly in the sense that the new result is the one that will be shown to the user, but the old computation can still hog the CPU. In the worst case CPU can go to 100% and the app shows nothing for a long time.

Solution
Put "checkpoints" in the stitch function from where the function can be canceled.

The most unpredictable part of the pipeline is the estimateCameraParams function, so it would be worth to start there. The question to figure out is whether the changes needed will require using an OpenCV fork.

It would also be nice to figure out a way to get better progress report from this function (future issue probably).

Selectable registration resolution

Add an option to select registration resolution (in MPx) for the stitching algorithm. The images are downscaled to this size for finding matches between images.

The default value is 0.6MPx and that could be an issue e.g. if stitching two photos with electrical wires spanning over both of them.

Howto

Stretch goal

Find / take some pictures where this effect can be demonstrated and add them to the PR.

Error log detection

After #54 added a bug report window, let's add automatic error log detection on startup:

  • Parse the log file from the previous launch (xpano.1.log) and if there is an [error] entry show the bug report window indicating that there was an error in the last run.
  • Add a toggle "don't show this again", which will need to persist its state in the config

Stitching scans

Add support for stitching scans (https://docs.opencv.org/4.x/d2/d8d/classcv_1_1Stitcher.html#a114713924ec05a0309f4df7e918c0324ac706a6a118a4a648fef8b2fca5950e2a):

Howto

The value is selected here:

auto stitcher = stitcher::Stitcher::Create(cv::Stitcher::PANORAMA);

Extend stitching user options with a new enum (panorama / scans):

struct StitchUserOptions {

  • the new enum will need a Label function and a constant array with all values, please check the other examples

Add a widget to select the value in gui (use utils::imgui::ComboBox for selecting an enum value):

Action DrawStitchOptionsMenu(pipeline::StitchAlgorithmOptions* stitch_options,

If Scans mode is selected

  • disable projection types widget + wave correction in the gui
  • add an if statement in the Stitch function when setting up stitcher and set the values according to stitcher.cc

Stretch goal

Test on real scans, compare the two modes and add the images to the PR.

Export pano database

Implement export/import of the pano database.

  • save urls to currently opened images and the panos that were detected by the program to a db file
  • implement import of the db file, correctly handling missing images

AppImage?

Bug description
DE: XPano ist leider nur als riesiges FlatPak erhältlich. Wäre es möglch, es auch als AppImage anzubieten?
EN: XPano is unfortunately only available as huge FlatPak, Is it possible to offer it as well as Appimage?

Desktop (please complete the following information):

  • OS: Debian Linux
  • Version: LMDE 5 Elsie / Debian 11 „Bullseye“
  • Method of installation: none yet

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.