Multi-Threaded Image Processing using Qt Camera
(Meh.at -) |
m (Meh.at -) |
||
| Line 1: | Line 1: | ||
[[Category:Draft]][[Category:Camera]][[Category:Performance]][[Category:Symbian]] | [[Category:Draft]][[Category:Camera]][[Category:Performance]][[Category:Symbian]] | ||
| − | {{Abstract|This article shows how to apply live image processing effects to the camera viewfinder and capture full resolution snapshots.}} | + | {{Abstract|This article shows how to apply live image processing effects to the camera viewfinder using multi-threading and capture full resolution snapshots.}} |
| − | |||
{{ArticleMetaData <!-- v1.2 --> | {{ArticleMetaData <!-- v1.2 --> | ||
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] --> | |sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] --> | ||
| Line 27: | Line 26: | ||
== Introduction == | == Introduction == | ||
| + | Image processing is a resource intensive task. This article describes means how to apply image processing effects to the camera viewfinder using multi-threading to keep the user interface responsive. The following topics are covered in detail: | ||
| + | * Using the Qt Mobility camera class in Qml. | ||
| + | * Spawning a worker thread for background image processing. | ||
| + | * Adding a simple black and white effect. | ||
| + | * Discussion about hardware acceleration. | ||
| + | * Conclusion. | ||
| + | The code provided here shows only the most important functional parts. The full code can be downloaded here (TODO). | ||
| + | <gallery> | ||
| + | File:Fipscamera 1336545122130.jpg|FIP Camera Mainview | ||
| + | File:Fipscamera 1336545141933.jpg|FIP Camera processing full resolution snapshot | ||
| + | </gallery> | ||
| + | |||
| + | == Using the Qt Mobility Camera in Qml == | ||
| + | The Qml camera component provides basic means to view and capture camera images directly from the Qml scripting language. For our purpose the Qml camera is not suitable because we need (i) live viewfinder image data stream and (ii) the final image as a data stream. | ||
| + | In this article a stripped-down version of the custom Qml camera component from the [http://projects.developer.nokia.com/camerademo Qt Camera Demo] is used which uses the Qt Mobility Camera classes. | ||
| + | |||
| + | === Project Preparation === | ||
| + | First, the Qt Mobility dependency and Symbian capabilities have to be added to the project (*.pro) file: | ||
| + | <code cpp> | ||
| + | symbian: { | ||
| + | TARGET.CAPABILITY += LocalServices \ # camera | ||
| + | ReadUserData \ # | ||
| + | WriteUserData \ # writing image file | ||
| + | UserEnvironment # camera | ||
| + | } | ||
| + | </code> | ||
| + | On Symbian, depending on the expected memory usage the heap- and stack sizes should be increased as well: | ||
| + | <code cpp> | ||
| + | symbian: { | ||
| + | TARGET.EPOCSTACKSIZE = 0x14000 | ||
| + | TARGET.EPOCHEAPSIZE = 0x20000 0x8000000 | ||
| + | } | ||
| + | </code> | ||
== Summary == | == Summary == | ||
Revision as of 13:28, 10 May 2012
This article shows how to apply live image processing effects to the camera viewfinder using multi-threading and capture full resolution snapshots.
Article Metadata
Contents |
Introduction
Image processing is a resource intensive task. This article describes means how to apply image processing effects to the camera viewfinder using multi-threading to keep the user interface responsive. The following topics are covered in detail:
- Using the Qt Mobility camera class in Qml.
- Spawning a worker thread for background image processing.
- Adding a simple black and white effect.
- Discussion about hardware acceleration.
- Conclusion.
The code provided here shows only the most important functional parts. The full code can be downloaded here (TODO).
Using the Qt Mobility Camera in Qml
The Qml camera component provides basic means to view and capture camera images directly from the Qml scripting language. For our purpose the Qml camera is not suitable because we need (i) live viewfinder image data stream and (ii) the final image as a data stream. In this article a stripped-down version of the custom Qml camera component from the Qt Camera Demo is used which uses the Qt Mobility Camera classes.
Project Preparation
First, the Qt Mobility dependency and Symbian capabilities have to be added to the project (*.pro) file:
symbian: {
TARGET.CAPABILITY += LocalServices \ # camera
ReadUserData \ #
WriteUserData \ # writing image file
UserEnvironment # camera
}
On Symbian, depending on the expected memory usage the heap- and stack sizes should be increased as well:
symbian: {
TARGET.EPOCSTACKSIZE = 0x14000
TARGET.EPOCHEAPSIZE = 0x20000 0x8000000
}
Summary
Add categories below. Remove Category:Draft when the page is complete or near complete

