Skip to content

Commit

Permalink
Merge pull request #593 from Kicer86/_360_viewer
Browse files Browse the repository at this point in the history
360⁰ viewer
  • Loading branch information
Kicer86 committed Jan 11, 2024
2 parents beda9fb + 1106b70 commit caae5e0
Show file tree
Hide file tree
Showing 16 changed files with 205 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/aur/photobroom-git/.SRCINFO
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pkgbase = photobroom-git
depends = qt6-multimedia
depends = qt6-declarative
depends = qt6-svg
depends = qt6-quick3d
depends = dlib
depends = opencv
depends = jsoncpp
Expand Down
2 changes: 1 addition & 1 deletion .github/aur/photobroom-git/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ arch=('i686' 'x86_64')
url="https://github.com/Kicer86/photobroom"
license=('GPL3')
groups=()
depends=('exiv2' 'qt6-base' 'qt6-multimedia' 'qt6-declarative' 'qt6-svg' 'dlib' 'opencv' 'jsoncpp')
depends=('exiv2' 'qt6-base' 'qt6-multimedia' 'qt6-declarative' 'qt6-svg' 'qt6-quick3d' 'dlib' 'opencv' 'jsoncpp')
makedepends=('cmake' 'magic_enum' 'qt6-tools' 'imagemagick' 'libwebp' 'cs-libguarded' 'boost')
optdepends=()
provides=('photobroom')
Expand Down
79 changes: 68 additions & 11 deletions .github/expected_file_list
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ Qt6QmlLocalStorage.dll
Qt6QmlModels.dll
Qt6QmlWorkerScript.dll
Qt6QmlXmlListModel.dll
qt6quick3dassetimport.dll
qt6quick3dassetutils.dll
qt6quick3d.dll
qt6quick3deffects.dll
qt6quick3dhelpers.dll
qt6quick3dparticleeffects.dll
qt6quick3dparticles.dll
qt6quick3druntimerender.dll
qt6quick3dspatialaudio.dll
qt6quick3dutils.dll
Qt6QuickControls2.dll
Qt6QuickControls2Impl.dll
Qt6QuickDialogs2.dll
Expand All @@ -76,6 +86,9 @@ Qt6QuickLayouts.dll
Qt6QuickParticles.dll
Qt6QuickShapes.dll
Qt6QuickTemplates2.dll
qt6quicktimeline.dll
qt6shadertools.dll
qt6spatialaudio.dll
Qt6Sql.dll
Qt6Svg.dll
Qt6Widgets.dll
Expand All @@ -88,25 +101,20 @@ qt_plugins\imageformats\qgif.dll
qt_plugins\imageformats\qico.dll
qt_plugins\imageformats\qjpeg.dll
qt_plugins\imageformats\qsvg.dll
qt_plugins\multimedia\ffmpegmediaplugin.dll
qt_plugins\multimedia\windowsmediaplugin.dll
qt_plugins\networkinformation\qnetworklistmanagerd.dll
qt_plugins\networkinformation\qnetworklistmanager.dll
qt_plugins\platforms\qwindows.dll
qt_plugins\qmltooling\qmldbg_debugger.dll
qt_plugins\qmltooling\qmldbg_inspector.dll
qt_plugins\qmltooling\qmldbg_local.dll
qt_plugins\qmltooling\qmldbg_messages.dll
qt_plugins\qmltooling\qmldbg_nativedebugger.dll
qt_plugins\qmltooling\qmldbg_native.dll
qt_plugins\qmltooling\qmldbg_preview.dll
qt_plugins\qmltooling\qmldbg_profiler.dll
qt_plugins\qmltooling\qmldbg_quickprofiler.dll
qt_plugins\qmltooling\qmldbg_server.dll
qt_plugins\qmltooling\qmldbg_tcp.dll
qt_plugins\sqldrivers\qsqlite.dll
qt_plugins\sqldrivers\qsqlodbc.dll
qt_plugins\sqldrivers\qsqlpsql.dll
qt_plugins\styles\qwindowsvistastyle.dll
qt_plugins\tls\qcertonlybackendd.dll
qt_plugins\tls\qcertonlybackend.dll
qt_plugins\tls\qopensslbackendd.dll
qt_plugins\tls\qopensslbackend.dll
qt_plugins\tls\qschannelbackendd.dll
qt_plugins\tls\qschannelbackend.dll
QtQml\Models\modelsplugin.dll
QtQml\Models\plugins.qmltypes
Expand All @@ -120,6 +128,52 @@ QtQml\WorkerScript\workerscriptplugin.dll
QtQml\XmlListModel\plugins.qmltypes
QtQml\XmlListModel\qmldir
QtQml\XmlListModel\qmlxmllistmodelplugin.dll
qtquick3d\assetutils\plugins.qmltypes
qtquick3d\assetutils\qmldir
qtquick3d\assetutils\qtquick3dassetutilsplugin.dll
qtquick3d\effects\additivecolorgradient.qml
qtquick3d\effects\blur.qml
qtquick3d\effects\brushstrokes.qml
qtquick3d\effects\chromaticaberration.qml
qtquick3d\effects\colormaster.qml
qtquick3d\effects\depthoffieldhqblur.qml
qtquick3d\effects\desaturate.qml
qtquick3d\effects\distortionripple.qml
qtquick3d\effects\distortionsphere.qml
qtquick3d\effects\distortionspiral.qml
qtquick3d\effects\edgedetect.qml
qtquick3d\effects\emboss.qml
qtquick3d\effects\flip.qml
qtquick3d\effects\fxaa.qml
qtquick3d\effects\gaussianblur.qml
qtquick3d\effects\hdrbloomtonemap.qml
qtquick3d\effects\motionblur.qml
qtquick3d\effects\qmldir
qtquick3d\effects\qtquick3deffectplugin.dll
qtquick3d\effects\quick3deffects.qmltypes
qtquick3d\effects\scatter.qml
qtquick3d\effects\scurvetonemap.qml
qtquick3d\effects\tiltshift.qml
qtquick3d\effects\vignette.qml
qtquick3d\helpers\axishelper.qml
qtquick3d\helpers\debugview.qml
qtquick3d\helpers\orbitcameracontroller.qml
qtquick3d\helpers\plugins.qmltypes
qtquick3d\helpers\qmldir
qtquick3d\helpers\qtquick3dhelpersplugin.dll
qtquick3d\helpers\wasdcontroller.qml
qtquick3d\particleeffects\qmldir
qtquick3d\particleeffects\qtquick3dparticleeffectsplugin.dll
qtquick3d\particleeffects\quick3dparticleeffects.qmltypes
qtquick3d\particles3d\plugins.qmltypes
qtquick3d\particles3d\qmldir
qtquick3d\particles3d\qtquick3dparticles3dplugin.dll
qtquick3d\plugins.qmltypes
qtquick3d\qmldir
qtquick3d\qquick3dplugin.dll
qtquick3d\spatialaudio\plugins.qmltypes
qtquick3d\spatialaudio\qmldir
qtquick3d\spatialaudio\quick3dspatialaudioplugin.dll
QtQuick\Controls\Basic\AbstractButton.qml
QtQuick\Controls\Basic\ActionGroup.qml
QtQuick\Controls\Basic\Action.qml
Expand Down Expand Up @@ -548,6 +602,9 @@ QtQuick\Shapes\qmlshapesplugin.dll
QtQuick\Templates\plugins.qmltypes
QtQuick\Templates\qmldir
QtQuick\Templates\qtquicktemplates2plugin.dll
qtquick\timeline\plugins.qmltypes
qtquick\timeline\qmldir
qtquick\timeline\qtquicktimelineplugin.dll
QtQuick\tooling\Component.qml
QtQuick\tooling\Enum.qml
QtQuick\tooling\Member.qml
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ jobs:
qt6-base-dev \
qt6-declarative-dev \
qt6-multimedia-dev \
libqt6svg6-dev \
qt6-quick3d-dev \
qt6-quick3d-dev-tools \
qt6-l10n-tools \
libqt6shadertools6-dev \
libqt6svg6-dev \
libqt6quick3druntimerender6 \
libboost-dev \
libopencv-dev \
libdlib-dev \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.4.0'
version: '6.4.3'
cache: 'true'
modules: 'qtmultimedia'
modules: 'qtmultimedia qtquick3d qtshadertools qtquicktimeline'

- name: Cache external tools
uses: actions/cache@v3
Expand Down
10 changes: 10 additions & 0 deletions docs/usefull_links - 360⁰ photos.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
https://github.com/mymike00/photosphere2-ut
https://github.com/mymike00/qphotosphere
https://github.com/mymike00/photosphere-ut
https://github.com/lazarus-pkgs/panini
https://github.com/paoletto/qphotosphere
https://forum.shotcut.org/t/plugins-for-360-video/12396
https://wiki.panotools.org/Panorama_Viewers
https://legacy-www.math.harvard.edu/archive/21a_spring_06/exhibits/panoramas/index.html
https://github.com/cazitouni/QgisGLViewer
https://stackoverflow.com/questions/56293314/how-can-i-load-a-qpaintedtextureimage-into-a-qtexturematerial
1 change: 1 addition & 0 deletions src/core/iexif_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ struct CORE_EXPORT IExifReader
PixelXDimension, // long
PixelYDimension, // long
Exposure, // float
Projection, // string
};

virtual ~IExifReader() = default;
Expand Down
4 changes: 4 additions & 0 deletions src/core/implementation/aexif_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ std::optional<std::any> AExifReader::get(const QString& path, const IExifReader:
case TagType::Exposure:
result = exiv_result(readRational(TagType::Exposure));
break;

case TagType::Projection:
result = exiv_result(readString(TagType::Projection));
break;
}

return result;
Expand Down
34 changes: 22 additions & 12 deletions src/core/implementation/exiv2_exif_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@

namespace
{
const std::map<AExifReader::TagType, const char *> exif_name =
const std::map<AExifReader::TagType, std::string_view> exif_name =
{
{ AExifReader::TagType::DateTimeOriginal, "Exif.Photo.DateTimeOriginal" },
{ AExifReader::TagType::Orientation, "Exif.Image.Orientation" },
{ AExifReader::TagType::SequenceNumber, "Exif.Sony1.SequenceNumber" },
{ AExifReader::TagType::PixelXDimension, "Exif.Photo.PixelXDimension" },
{ AExifReader::TagType::PixelYDimension, "Exif.Photo.PixelYDimension" },
{ AExifReader::TagType::Exposure, "Exif.Photo.ExposureBiasValue" },
{ AExifReader::TagType::Projection, "Xmp.GPano.ProjectionType" },
};
}

Expand Down Expand Up @@ -65,23 +66,32 @@ std::optional<std::string> Exiv2ExifReader::read(AExifReader::TagType type) cons

if (m_exif_data.get() != nullptr)
{
const Exiv2::ExifData &exifData = m_exif_data->exifData();
const Exiv2::ExifData& exifData = m_exif_data->exifData();
const Exiv2::XmpData& xmpData = m_exif_data->xmpData();

if (exifData.empty() == false)
{
Exiv2::ExifData::const_iterator tag_data = exifData.end();
auto exif_name_it = exif_name.find(type);
auto exif_name_it = exif_name.find(type);

assert(exif_name_it != exif_name.end());
assert(exif_name_it != exif_name.end());

if (exif_name_it != exif_name.end())
if (exif_name_it != exif_name.end())
{
const auto tag_name = exif_name_it->second;
if (tag_name.starts_with("Exif."))
{
const char* tag_name = exif_name_it->second;
tag_data = exifData.findKey(Exiv2::ExifKey(tag_name));
auto tag_data = exifData.findKey(Exiv2::ExifKey(tag_name.data()));

if (tag_data != exifData.end())
result = tag_data->toString();
}
else if (tag_name.starts_with("Xmp."))
{
auto tag_data = xmpData.findKey(Exiv2::XmpKey(tag_name.data()));

if (tag_data != exifData.end())
result = tag_data->toString();
if (tag_data != xmpData.end())
result = tag_data->toString();
}
else
assert(!"Unknow tag family");
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/gui/desktop/quick_items/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
find_package(Qt6 6.2 REQUIRED COMPONENTS
Multimedia
Quick
Quick3D
QuickWidgets
)

Expand Down Expand Up @@ -60,6 +61,7 @@ target_link_libraries(quick_items
project_utils

Qt::Quick
Qt::Quick3D
Qt::Widgets # TODO: remove ASAP
)

Expand Down
54 changes: 54 additions & 0 deletions src/gui/desktop/quick_items/Components/EquirectangularView.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@

import QtQuick
import QtQuick3D
import QtQuick3D.Helpers

View3D {
id: viewport
anchors.fill: parent

property alias source: sourceTexture.source

property real _scaleF: 1.0

environment: SceneEnvironment {
antialiasingMode: SceneEnvironment.MSAA
antialiasingQuality: SceneEnvironment.VeryHigh
lightProbe: Texture {
id: sourceTexture
}
backgroundMode: SceneEnvironment.SkyBox
}

Node {
id: originNode
PerspectiveCamera {
id: cameraNode
fieldOfView: 60 * viewport._scaleF
}
}

OrbitCameraController {
origin: originNode
camera: cameraNode
xInvert: true
yInvert: false
xSpeed: 0.5 * (viewport.width / viewport.height) * ySpeed // equation made up to keep horizonal moves as natural as possible
ySpeed: (1024 / viewport.height) / 10 * viewport._scaleF // All parameters chosen empirically.
}

MouseArea {
anchors.fill: parent

onWheel: function(wheel) {
var scaleF = viewport._scaleF - wheel.angleDelta.y / 120 * 0.05

if (scaleF > 2)
scaleF = 2
if (scaleF < 0.5)
scaleF = 0.5

viewport._scaleF = scaleF
}
}
}
3 changes: 3 additions & 0 deletions src/gui/desktop/quick_items/Components/MediaPreviewItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import QtMultimedia
import QtQuick.Controls
import quick_items

import photo_broom.singletons


Item {
property alias photoID: ctrl.photoID // set to make this Item work
property alias mediaType: ctrl.mode // get media type

MediaViewCtrl {
id: ctrl
core: PhotoBroomProject.coreFactory
}

BusyIndicator {
Expand Down
23 changes: 18 additions & 5 deletions src/gui/desktop/quick_items/Components/MediaViewItem.qml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@

import QtQuick
import quick_items
import photo_broom.singletons


Item {
property alias photoID: ctrl.photoID

MediaViewCtrl {
id: ctrl
core: PhotoBroomProject.coreFactory
}

Component {
id: staticImage

ZoomableImage {
ZoomableImage {
anchors.fill: parent

boundsBehavior: Flickable.StopAtBounds
Expand Down Expand Up @@ -45,15 +47,26 @@ Item {
}
}

Component {
id: equirectangularProjection

EquirectangularView {
anchors.fill: parent

source: ctrl.path
}
}

Loader {
anchors.fill: parent

sourceComponent: {
switch (ctrl.mode) {
case MediaViewCtrl.StaticImage: return staticImage;
case MediaViewCtrl.Video: return video;
case MediaViewCtrl.AnimatedImage: return animatedImage;
default: return undefined;
case MediaViewCtrl.StaticImage: return staticImage;
case MediaViewCtrl.Video: return video;
case MediaViewCtrl.AnimatedImage: return animatedImage;
case MediaViewCtrl.EquirectangularProjectionImage: return equirectangularProjection;
default: return undefined;
}
}
}
Expand Down
Loading

0 comments on commit caae5e0

Please sign in to comment.