Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Add some life filters like in the app "aieye" #8

Open
nfsprodriver opened this issue Jul 15, 2017 · 7 comments
Open

Add some life filters like in the app "aieye" #8

nfsprodriver opened this issue Jul 15, 2017 · 7 comments
Milestone

Comments

@nfsprodriver
Copy link
Member

This would be a very cool feature!

@dark-eye
Copy link
Collaborator

@nfsprodriver I think this is a great feture to add but it probably should be added as a plugin and not as core functionality of the camera, I think this suggest that the camera app should have some kinda of plugin system to allow developers add functionality easily without worrying about the core code.

@Flohack74 What do you think?

@nfsprodriver
Copy link
Member Author

I think this would be the best idea 👍

@Flohack74
Copy link
Member

Please keep @sverzegnassi in the loop, he did the wonderful InstantFX which does similar stuff.

@sverzegnassi
Copy link
Contributor

sverzegnassi commented Jul 17, 2017

InstantFX uses the QtQuick Scene Graph as a framework for applying GPU-accelerated filters to pictures. It proved to be a viable solution that reduces the development costs of (e.g.) porting GPUImage from iOS, or implementing an ad-hoc solution like in Instagram.
However, I would suggest to use a different solution.

In InstantFX (and Instagram as well), there is an important constraint on the size of the image to elaborate: it can not be larger than the maximum texture size supported by the GPU. IIRC the most common limit is 4096x4096px; however, I didn't feel confident to use anything bigger than 2048x2048, as the hardware of UT low-end devices can easily get saturated.

Also, a further problem could appear if you want to apply real-time filters on the camera preview output. For instance, Instagram uses different filters for pictures and videos - the ones used for videos are much more lightweight than standard filters. In QML, any processing should last max. 1ms in order to grant a constant frame rate, so we might want to avoid anything too heavy.

All these limitations might be unsuitable in camera-app, as UT smartphones (e.g. Meizu Pro 5) can shoot up-to-21mpx pictures. On the contrary, InstantFX and Instagram are designed for the web, where a 2048x2048px picture is considered as "acceptable".

The QML Camera object (used by camera-app) provides some basic image processing[1]. Moreover, Qt provides a relevant example for your requests[2].

I really think QML CameraImageProcessing is the way to go, since camera-app is a general purpose app.

On other platforms, image filtering features are usually provided by third parties, or by the gallery app.
I've heard that our gallery-app maintainer would like to add InstantFX filters in his app. I would like to avoid redundant features in core apps; sadly, this might be the case. :/

[1] See http://doc.qt.io/qt-5/qml-qtmultimedia-cameraimageprocessing.html#colorFilter-prop
It might be relevant for bug #7 too...

[2] https://doc.qt.io/qt-5/qtmultimedia-multimedia-video-qmlvideofx-example.html

@dark-eye
Copy link
Collaborator

Wow @sverzegnassi thanks for the detailed response!.

Regarding this issue I`ll probably just add the QML CameraImageProcessing flags to the camera quick options menu as core camera-app filters as you are right and theres no need to duplicate features.

However I still think that a plugin system is required as some of the filters might require a live preview and some you would like to apply when taking the photo (like the date stamp one) also generally it helps to alleviate development complexity as it contain the code to a specific plugin , Think it`s too much on a core app?

@sverzegnassi
Copy link
Contributor

sverzegnassi commented Jul 18, 2017

I guess - but I'm not sure - that the live preview of a QML Camera object would respect the settings provided through CameraImageProcessing. In any case, it is still possible to apply shaders to a QML VideoOutput item through QQuickItem layers[1], in order to preview the expected result.

With regard to your second question, I agree with you. One of the reasons why InstantFX has no built-in camera support is that it wasn't worth for me to spend more time to rewrite everything. Moreover, IIRC camera-app implements some workaround in order to support all the Ubuntu Touch devices.

I would expect to have an official API for implementing such things, something that I can import through a "Ubuntu.Camera" QML module. It should provide not only the backend used in camera-app[2], but also a basic (and extendable) user interface which respects Ubuntu Touch UX specifications and camera-app visuals.

I don't think it would be too much work, since we would only move part of the development and maintenance costs to another project. Camera-app codebase would be much smaller and maintainable.

However, UBports is not going to release any further OTA for 15.04. It means that any effort of a new QML module wouldn't be available outside camera-app itself and third party apps wouldn't benefit from this. I'm sure @Flohack74 or @NeoTheThird can provide more information on this. :)

Huh, as a general reference, Nokia used to provide a great community-driven developer wiki with a lot of references about QML development and imaging (they have run a specific contest for this). Microsoft have shot the website down, but a cache is still available.

For instance:

[1] http://doc.qt.io/qt-5/qml-qtquick-item.html#item-layers
[2] Which could be used e.g. with a custom UI

@dark-eye
Copy link
Collaborator

dark-eye commented Jul 19, 2017

Hey @sverzegnassi ,

You've taken my suggestion further then I thought :) I actually meant just a plugin system to the camera app and other apps be damned! :).

But that seem as an actual problem in the sdk so it might be a good idea to create an issue to refactor the camera app to use a UBport camera class provided by the Ubuntu/UBPorts SDK that will be based on the core of the camera app, i think the first sterp to implement it is the refactor of the camera app so we will have the core class and the added ui/behavior in to sections of the code, this can then be adjusted and integrated as SDK/external package later.

I`ll create an issue about it...
(and about the plugin system :))

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants