initial commit
This commit is contained in:
commit
4e24d82c36
7015 changed files with 2913008 additions and 0 deletions
4
AUTHORS.md
Executable file
4
AUTHORS.md
Executable file
|
@ -0,0 +1,4 @@
|
|||
# Authors
|
||||
|
||||
* Mihailov-Ovsyannikov Daniil, <necron-x@mail.ru>
|
||||
* Maintainer, 2023
|
83
CODE_OF_CONDUCT.md
Executable file
83
CODE_OF_CONDUCT.md
Executable file
|
@ -0,0 +1,83 @@
|
|||
# Code of Conduct
|
||||
|
||||
## What is this code of conduct for?
|
||||
|
||||
Code of conduct is a current set of rules of the Open Mobile Platform
|
||||
which informs you how we expect
|
||||
the members of the Open Mobile Platform community
|
||||
will interact while contributing and communicating.
|
||||
We are committed to providing a friendly, safe and welcoming
|
||||
environment for all, regardless of gender, gender identity and expression,
|
||||
sexual orientation, ability, physical appearance, body size, race, age,
|
||||
socioeconomic status, religion (or lack thereof),
|
||||
or other marginalized aspect of community members.
|
||||
We expect all members of the Open Mobile Platform community
|
||||
to abide by this Code of Conduct whenever interacting
|
||||
in Open Mobile Platform venues
|
||||
(merge requests, pull requests, issues, 1-1 or group chat, meetups, conferences, etc.)
|
||||
|
||||
## Examples of appropriate behavior
|
||||
|
||||
* Using welcoming and inclusive language.
|
||||
* Being respectful of differing viewpoints and experiences.
|
||||
* Gracefully accepting constructive criticism.
|
||||
* Focusing on what is best for the community.
|
||||
* Showing empathy towards other community members.
|
||||
|
||||
## Examples of inappropriate behavior
|
||||
|
||||
Because we come from a variety of backgrounds,
|
||||
we do not want to assume that everyone has the same assumptions
|
||||
about what is and is not appropriate.
|
||||
Here are some examples of inappropriate behavior
|
||||
that are incompatible with our community's ethos:
|
||||
|
||||
* spamming, trolling, intentionally disrupting conversations,
|
||||
or irrelevant solicitation or advertisement;
|
||||
* making demeaning or discriminatory comments;
|
||||
* making negative assumptions about someone's background,
|
||||
abilities, or intentions;
|
||||
* harassing or stalking individuals (online or in person).
|
||||
|
||||
In general: treat others how you would like to be treated,
|
||||
were you in their place.
|
||||
Do ask questions.
|
||||
Do keep conflicts productively focused on technical issues.
|
||||
Do remember that we are all people, not robots,
|
||||
and all equally deserving of sensitivity and respect.
|
||||
|
||||
## What will organizers do about inappropriate behavior?
|
||||
|
||||
If we notice you doing or saying something inappropriate,
|
||||
an organizer will ask you to stop.
|
||||
We will not demonize you.
|
||||
But please do stop the inappropriate behavior
|
||||
so we can get back to writing and discussing code in a safe environment.
|
||||
If you have philosophical disagreements about what is actually inappropriate,
|
||||
please take them to a separate public or private conversation
|
||||
with an Open Mobile Platform maintainer
|
||||
so we don't turn pull requests into an ethics debate.
|
||||
If you keep doing unacceptable things,
|
||||
we will likely ban you, report you to the administration,
|
||||
or take other appropriate action.
|
||||
|
||||
## What if I see or am subject to what feels like inappropriate behavior?
|
||||
|
||||
Let us know.
|
||||
Please notify a community organizer as soon as possible.
|
||||
Full contact information is listed in the Contact Info section of this document.
|
||||
All communications will be kept strictly confidential,
|
||||
unless otherwise required by law.
|
||||
No issue will be considered too inconsequential or unimportant for us
|
||||
to have a conversation about.
|
||||
|
||||
## Contact Info
|
||||
|
||||
If you need to report an incident,
|
||||
please contact <community@omp.ru>.
|
||||
|
||||
This work is licensed under a Creative Commons Attribution 3.0 Unported License
|
||||
For attribution requirements:
|
||||
«Open Mobile Platform Code of Conduct»
|
||||
Copyright (c) 2021 Open Mobile Platform LLC,
|
||||
used under a [Creative Commons Attribution Unported license](http://creativecommons.org/licenses/by/3.0/).
|
169
CONTRIBUTING.md
Executable file
169
CONTRIBUTING.md
Executable file
|
@ -0,0 +1,169 @@
|
|||
# Contributor License Agreements
|
||||
|
||||
Thank you for your interest in contributing
|
||||
to software projects managed by Open Mobile Platform («We» or «Us»).
|
||||
This contributor agreement («Agreement»)
|
||||
documents the rights granted by contributors to Us.
|
||||
To make this document effective,
|
||||
please sign it and send it to Us by email or electronic submission.
|
||||
This is a legally binding document,
|
||||
so please read it carefully before agreeing to it.
|
||||
The Agreement may cover more than one software project managed by Us.
|
||||
|
||||
## 1. Definitions
|
||||
|
||||
**«We» or «Us»** means Open Mobile Platform Limited Liability Company
|
||||
(Open Mobile Platform LLC),
|
||||
420500, Republic of Tatarstan, Verkhneuslonsky District,
|
||||
Innopolis, Universitetskaya Street, h. 7, office 59,
|
||||
OGRN (Primary State Registration Number) 1161690087020.
|
||||
|
||||
**«You»** means the individual who Submits a Contribution to Us.
|
||||
|
||||
**«Contribution»** means any work of authorship
|
||||
that is Submitted by You to Us
|
||||
in which You own or assert ownership of the Copyright.
|
||||
|
||||
**«Copyright»** means all rights protecting works of authorship
|
||||
owned or controlled by You,
|
||||
including copyright, moral and neighboring rights, as appropriate,
|
||||
for the full term of their existence including any extensions by You.
|
||||
|
||||
**«Material»** means the work of authorship
|
||||
which is made available by Us to third parties.
|
||||
When this Agreement covers more than one software project,
|
||||
the Material means the work of authorship
|
||||
to which the Contribution was Submitted.
|
||||
After You Submit the Contribution,
|
||||
it may be included in the Material.
|
||||
|
||||
**«Submit»** means any form of electronic, verbal, or written communication
|
||||
sent to Us or our representatives,
|
||||
including but not limited to electronic mailing lists,
|
||||
source code control systems, and issue tracking systems
|
||||
that are managed by, or on behalf of, Us
|
||||
for the purpose of discussing and improving the Material,
|
||||
but excluding communication that is conspicuously marked
|
||||
or otherwise designated in writing by You as «Not a Contribution».
|
||||
|
||||
**«Submission Date»** means the date
|
||||
on which You Submit a Contribution to Us.
|
||||
|
||||
**«Effective Date»** means the date You execute this Agreement
|
||||
or the date You first Submit a Contribution to Us,
|
||||
whichever is earlier.
|
||||
|
||||
**«Media»** means any portion of a Contribution which is not software.
|
||||
|
||||
## 2. Grant of Rights
|
||||
|
||||
### 2.1. Copyright License
|
||||
|
||||
(a) You retain ownership of the Copyright in Your Contribution
|
||||
and have the same rights to use or license the Contribution
|
||||
which You would have had without entering into the Agreement.
|
||||
|
||||
(b) To the maximum extent permitted by the relevant law,
|
||||
You grant to Us a perpetual, worldwide, non-exclusive,
|
||||
transferable, royalty-free, irrevocable license
|
||||
under the Copyright covering the Contribution,
|
||||
with the right to sublicense
|
||||
such rights through multiple tiers of sublicensees,
|
||||
to reproduce, modify, display, perform and distribute
|
||||
the Contribution as part of the Material;
|
||||
provided that this license is conditioned upon compliance with Section 2.3.
|
||||
|
||||
### 2.2. Patent License
|
||||
|
||||
For patent claims including, without limitation,
|
||||
method, process, and apparatus claims
|
||||
which You own, control or have the right to grant, now or in the future,
|
||||
You grant to Us a perpetual, worldwide, non-exclusive,
|
||||
transferable, royalty-free, irrevocable patent license,
|
||||
with the right to sublicense these rights to multiple tiers of sublicensees,
|
||||
to make, have made, use, sell, offer for sale, import
|
||||
and otherwise transfer the Contribution
|
||||
and the Contribution in combination with the Material
|
||||
(and portions of such combination).
|
||||
This license is granted only to the extent
|
||||
that the exercise of the licensed rights infringes such patent claims;
|
||||
and provided that this license is conditioned upon compliance with Section 2.3.
|
||||
|
||||
### 2.3. Outbound License
|
||||
|
||||
Based on the grant of rights in Sections 2.1 and 2.2,
|
||||
if We include Your Contribution in a Material,
|
||||
We may license the Contribution under any license,
|
||||
including copyleft, permissive, commercial, or proprietary licenses.
|
||||
As a condition on the exercise of this right,
|
||||
We agree to also license the Contribution
|
||||
under the terms of the license or licenses
|
||||
which We are using for the Material on the Submission Date.
|
||||
|
||||
### 2.4. Our Rights
|
||||
|
||||
You acknowledge that We are not obligated
|
||||
to use Your Contribution as part of the Material
|
||||
and may decide to include any Contribution We consider appropriate.
|
||||
|
||||
## 3. Agreement
|
||||
|
||||
You confirm that:
|
||||
|
||||
(a) You have the legal authority to enter into this Agreement.
|
||||
|
||||
(b) You own the Copyright and patent claims
|
||||
covering the Contribution which are required
|
||||
to grant the rights under Section 2.
|
||||
|
||||
(c) The grant of rights under Section 2
|
||||
does not violate any grant of rights
|
||||
which You have made to third parties, including Your employer.
|
||||
If You are an employee,
|
||||
You have had Your employer approve this Agreement
|
||||
or sign the Entity version of this document.
|
||||
If You are less than eighteen years old,
|
||||
please have Your parents or guardian sign the Agreement.
|
||||
|
||||
## 4. Disclaimer
|
||||
|
||||
EXCEPT FOR THE EXPRESS WARRANTIES IN SECTION 3,
|
||||
THE CONTRIBUTION IS PROVIDED «AS IS».
|
||||
MORE PARTICULARLY, ALL EXPRESS OR IMPLIED WARRANTIES
|
||||
INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE
|
||||
AND NON-INFRINGEMENT ARE EXPRESSLY DISCLAIMED BY YOU TO US.
|
||||
TO THE EXTENT THAT ANY SUCH WARRANTIES CANNOT BE DISCLAIMED,
|
||||
SUCH WARRANTY IS LIMITED IN DURATION TO THE MINIMUM PERIOD PERMITTED BY LAW.
|
||||
|
||||
## 5. Miscellaneous
|
||||
|
||||
5.1. This Agreement will be governed by and construed
|
||||
in accordance with the laws of Russian Federation.
|
||||
|
||||
5.2. This Agreement sets out the entire agreement between You
|
||||
and Us for Your Contributions to Us
|
||||
and overrides all other agreements or understandings.
|
||||
|
||||
5.3. If You or We assign the rights or obligations
|
||||
received through this Agreement to a third party,
|
||||
as a condition of the assignment,
|
||||
that third party must agree in writing
|
||||
to abide by all the rights and obligations in the Agreement.
|
||||
|
||||
5.4. The failure of either party to require performance
|
||||
by the other party of any provision of this Agreement in one situation
|
||||
shall not affect the right of a party
|
||||
to require such performance at any time in the future.
|
||||
A waiver of performance under a provision in one situation
|
||||
shall not be considered a waiver of the performance
|
||||
of the provision in the future or a waiver of the provision in its entirety.
|
||||
|
||||
5.5. If any provision of this Agreement is found void and unenforceable,
|
||||
such provision will be replaced to the extent possible with a provision
|
||||
that comes closest to the meaning of the original provision
|
||||
and which is enforceable.
|
||||
The terms and conditions set forth in this Agreement
|
||||
shall apply notwithstanding any failure of essential purpose
|
||||
of this Agreement or any limited remedy
|
||||
to the maximum extent possible under law.
|
30
LICENSE.BSD-3-CLAUSE.md
Executable file
30
LICENSE.BSD-3-CLAUSE.md
Executable file
|
@ -0,0 +1,30 @@
|
|||
# The 3-Clause BSD License
|
||||
|
||||
_Copyright (C) 2022 Open Mobile Platform LLC_
|
||||
|
||||
Redistribution and use in source and binary forms,
|
||||
with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain
|
||||
the above copyright notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce
|
||||
the above copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holder nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
26
README.md
Executable file
26
README.md
Executable file
|
@ -0,0 +1,26 @@
|
|||
# Application Template
|
||||
|
||||
The project provides a template for Aurora OS applications.
|
||||
Not detect faces yet. =(
|
||||
|
||||
The main purpose is to clearly demonstrate
|
||||
almost minimal source code
|
||||
to get a correct and extensible application.
|
||||
|
||||
The source code of the project is provided under
|
||||
[the license](LICENSE.BSD-3-CLAUSE.md),
|
||||
that allows it to be used in third-party applications.
|
||||
|
||||
The [contributor agreement](CONTRIBUTING.md)
|
||||
documents the rights granted by contributors to the Open Mobile Platform.
|
||||
|
||||
[Code of conduct](CODE_OF_CONDUCT.md) is a current set of rules
|
||||
of the Open Mobile Platform which informs you how we expect
|
||||
the members of the community will interact while contributing and communicating.
|
||||
|
||||
For information about contributors see [AUTHORS](AUTHORS.md).
|
||||
|
||||
## Project Structure
|
||||
|
||||
The project has a common structure
|
||||
of an application based on C++ and QML for Aurora OS.
|
96
app/app.pro
Executable file
96
app/app.pro
Executable file
|
@ -0,0 +1,96 @@
|
|||
################################################################################
|
||||
##
|
||||
## Copyright (C) 2022 Open Mobile Platform LLC.
|
||||
## Contact: https://community.omprussia.ru/open-source
|
||||
##
|
||||
## This file is part of the Aurora OS Application Template project.
|
||||
##
|
||||
## Redistribution and use in source and binary forms,
|
||||
## with or without modification, are permitted provided
|
||||
## that the following conditions are met:
|
||||
##
|
||||
## * Redistributions of source code must retain the above copyright notice,
|
||||
## this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright notice,
|
||||
## this list of conditions and the following disclaimer
|
||||
## in the documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of the copyright holder nor the names of its contributors
|
||||
## may be used to endorse or promote products derived from this software
|
||||
## without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
## FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
## IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
## OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
## LOSS OF USE, DATA, OR PROFITS;
|
||||
## OR BUSINESS INTERRUPTION)
|
||||
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
## EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
################################################################################
|
||||
|
||||
QT += opengl
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
TARGET = com.gitlab.danyok.cameracv
|
||||
|
||||
QT += multimedia core concurrent dbus
|
||||
|
||||
DEFINES += \
|
||||
DBUS_SERVICE=\\\"com.gitlab.danyok.cameracv\\\" \
|
||||
DBUS_PATH=\\\"com/gitlab/danyok/cameracv\\\" \
|
||||
DBUS_INTERFACE=\\\"com.gitlab.danyok.cameracv\\\" \
|
||||
|
||||
CONFIG += \
|
||||
sailfishapp \
|
||||
sailfishapp_i18n \
|
||||
|
||||
PKGCONFIG += \
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/../libs/opencv/modules/core/include \
|
||||
$$PWD/../libs/opencv/modules/imgproc/include \
|
||||
$$PWD/../libs/opencv/modules/objdetect/include \
|
||||
$$OUT_PWD/../libs/opencv \
|
||||
|
||||
DEPENDPATH += \
|
||||
$$PWD/../libs/opencv/modules/core/include \
|
||||
$$PWD/../libs/opencv/modules/imgproc/include \
|
||||
$$PWD/../libs/opencv/modules/objdetect/include \
|
||||
$$OUT_PWD/../libs/opencv \
|
||||
|
||||
LIBS += \
|
||||
-L$$OUT_PWD/../libs/opencv/lib -lopencv_core -lopencv_imgproc -lopencv_objdetect -lopencv_calib3d -lopencv_features2d -lopencv_flann
|
||||
|
||||
TRANSLATIONS += \
|
||||
translations/com.gitlab.danyok.cameracv.ts \
|
||||
translations/com.gitlab.danyok.cameracv-ru.ts \
|
||||
|
||||
HEADERS += \
|
||||
src/qcvdetectfilter.h \
|
||||
|
||||
SOURCES += \
|
||||
src/main.cpp \
|
||||
src/qcvdetectfilter.cpp \
|
||||
|
||||
DISTFILES += \
|
||||
qml/icons/cameracv.svg \
|
||||
qml/cover/DefaultCoverPage.qml \
|
||||
qml/pages/MainPage.qml \
|
||||
qml/pages/AboutPage.qml \
|
||||
qml/cameracv.qml \
|
||||
translations/*.ts \
|
||||
com.gitlab.danyok.cameracv.desktop \
|
||||
|
||||
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172
|
||||
|
||||
RESOURCES += \
|
||||
res.qrc
|
15
app/com.gitlab.danyok.cameracv.desktop
Executable file
15
app/com.gitlab.danyok.cameracv.desktop
Executable file
|
@ -0,0 +1,15 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
X-Nemo-Application-Type=silica-qt5
|
||||
X-Nemo-Single-Instance=no
|
||||
X-Aurora-Single-Cover=yes
|
||||
Icon=com.gitlab.danyok.cameracv
|
||||
Exec=/usr/bin/com.gitlab.danyok.cameracv
|
||||
Name=CameraCV
|
||||
Name[ru]=CameraCV
|
||||
|
||||
[X-Sailjail]
|
||||
Permissions=Audio;Camera;Documents;Downloads;Internet;MediaIndexing;Microphone;Music;Pictures;PublicDir;RemovableMedia;UserDirs;Videos
|
||||
OrganizationName=com.gitlab.danyok
|
||||
ApplicationName=cameracv
|
||||
ExecDBus=/usr/bin/com.gitlab.danyok.cameracv %u
|
BIN
app/icons/108x108/com.gitlab.danyok.cameracv.png
Executable file
BIN
app/icons/108x108/com.gitlab.danyok.cameracv.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
BIN
app/icons/128x128/com.gitlab.danyok.cameracv.png
Executable file
BIN
app/icons/128x128/com.gitlab.danyok.cameracv.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 9.7 KiB |
BIN
app/icons/172x172/com.gitlab.danyok.cameracv.png
Executable file
BIN
app/icons/172x172/com.gitlab.danyok.cameracv.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
BIN
app/icons/86x86/com.gitlab.danyok.cameracv.png
Executable file
BIN
app/icons/86x86/com.gitlab.danyok.cameracv.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 5.9 KiB |
47
app/qml/cameracv.qml
Executable file
47
app/qml/cameracv.qml
Executable file
|
@ -0,0 +1,47 @@
|
|||
/*******************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 Open Mobile Platform LLC.
|
||||
** Contact: https://community.omprussia.ru/open-source
|
||||
**
|
||||
** This file is part of the Aurora OS Application Template project.
|
||||
**
|
||||
** Redistribution and use in source and binary forms,
|
||||
** with or without modification, are permitted provided
|
||||
** that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer
|
||||
** in the documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the copyright holder nor the names of its contributors
|
||||
** may be used to endorse or promote products derived from this software
|
||||
** without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION)
|
||||
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
ApplicationWindow {
|
||||
objectName: "applicationWindow"
|
||||
initialPage: Qt.resolvedUrl("pages/MainPage.qml")
|
||||
cover: Qt.resolvedUrl("cover/DefaultCoverPage.qml")
|
||||
allowedOrientations: defaultAllowedOrientations
|
||||
}
|
54
app/qml/cover/DefaultCoverPage.qml
Executable file
54
app/qml/cover/DefaultCoverPage.qml
Executable file
|
@ -0,0 +1,54 @@
|
|||
/*******************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 Open Mobile Platform LLC.
|
||||
** Contact: https://community.omprussia.ru/open-source
|
||||
**
|
||||
** This file is part of the Aurora OS Application Template project.
|
||||
**
|
||||
** Redistribution and use in source and binary forms,
|
||||
** with or without modification, are permitted provided
|
||||
** that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer
|
||||
** in the documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the copyright holder nor the names of its contributors
|
||||
** may be used to endorse or promote products derived from this software
|
||||
** without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION)
|
||||
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
CoverBackground {
|
||||
objectName: "defaultCover"
|
||||
|
||||
CoverPlaceholder {
|
||||
objectName: "placeholder"
|
||||
text: qsTr("Application Template")
|
||||
icon {
|
||||
source: Qt.resolvedUrl("../icons/cameracv.svg")
|
||||
sourceSize { width: icon.width; height: icon.height }
|
||||
}
|
||||
forceFit: true
|
||||
}
|
||||
}
|
17
app/qml/icons/cameracv.svg
Executable file
17
app/qml/icons/cameracv.svg
Executable file
|
@ -0,0 +1,17 @@
|
|||
<svg width="1024" height="1024" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<path id="Background" d="m0 357.5c0-180.46 0-245.38 56.06-301.44s120.99-56.06 326.74-56.06h258.39c205.76 0 270.68 0 326.74 56.06s56.06 120.99 56.06 326.74v258.39c0 205.76 0 270.68-56.06 326.74-56.06 56.059-120.99 56.059-326.74 56.059h-258.39c-205.76 0-270.68 0-326.74-56.059-56.06-56.06-56.06-120.99-56.06-326.74z" fill="#003e88"/>
|
||||
<mask id="Frame_Mask" maskUnits="userSpaceOnUse">
|
||||
<use xlink:href="#Background"/>
|
||||
</mask>
|
||||
<g fill="none" mask="url(#Frame_Mask)" stroke="#4169e1" stroke-width="1024">
|
||||
<path d="m-2e-5 512h1024" stroke-dasharray="1.024, 49.152, 1.024, 0"/>
|
||||
<path d="m512-2.41e-5v1024" stroke-dasharray="1.024, 49.152, 1.024, 0"/>
|
||||
<path d="m-2e-5 512h1024" stroke-dasharray="2.56, 506.88, 2.56, 0"/>
|
||||
<path d="m512-2.41e-5v1024" stroke-dasharray="2.56, 506.88, 2.56, 0"/>
|
||||
</g>
|
||||
<radialGradient id="Aurora_Gradient" cx="253.16" cy="572.03" r="346.86" gradientTransform="matrix(1.7323 .99965 -1 1.7329 540.61 -618.36)" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#fff" offset="0"/>
|
||||
<stop stop-color="#fff" stop-opacity="0" offset="1"/>
|
||||
</radialGradient>
|
||||
<path d="m820.13 625.96h-23.404a3.7229 3.7229 0 0 1-3.2222-5.5952l8.1207-14.064a12.388 12.388 0 0 0 0-12.41l-35.161-60.959-53.775 93.007h-17.831a3.7229 3.7229 0 0 1-3.2222-5.5952l59.109-102.32a12.388 12.388 0 0 0 0-12.41l-35.161-60.959-204.15 353.24-9.2745-16.045a9.8624 9.8624 0 0 1 0-9.9277l197.7-341.96a12.388 12.388 0 0 0 0-12.41l-35.161-60.959-204.21 353.19-9.2528-16.045a9.8624 9.8624 0 0 1 0-9.9277l197.75-342.05a12.388 12.388 0 0 0 0-12.41l-35.182-61.003-206.7 357.61h-17.722a3.7229 3.7229 0 0 1-3.2221-5.5952l211.92-366.76a12.453 12.453 0 0 0 0-12.41l-35.182-60.959-257.66 445.72h-17.831a3.7229 3.7229 0 0 1-3.2221-5.5952l263.02-455.02a12.388 12.388 0 0 0 0-12.41l-35.204-60.938-346.86 601.06h208.15l138.16 238.94 138.18-238.94h209.22z" fill="url(#Aurora_Gradient)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2 KiB |
87
app/qml/pages/AboutPage.qml
Executable file
87
app/qml/pages/AboutPage.qml
Executable file
|
@ -0,0 +1,87 @@
|
|||
/*******************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 Open Mobile Platform LLC.
|
||||
** Contact: https://community.omprussia.ru/open-source
|
||||
**
|
||||
** This file is part of the Aurora OS Application Template project.
|
||||
**
|
||||
** Redistribution and use in source and binary forms,
|
||||
** with or without modification, are permitted provided
|
||||
** that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer
|
||||
** in the documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the copyright holder nor the names of its contributors
|
||||
** may be used to endorse or promote products derived from this software
|
||||
** without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION)
|
||||
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import Sailfish.Silica 1.0
|
||||
|
||||
Page {
|
||||
objectName: "aboutPage"
|
||||
allowedOrientations: Orientation.All
|
||||
|
||||
SilicaFlickable {
|
||||
objectName: "flickable"
|
||||
anchors.fill: parent
|
||||
contentHeight: layout.height
|
||||
|
||||
Column {
|
||||
id: layout
|
||||
objectName: "layout"
|
||||
width: parent.width
|
||||
|
||||
PageHeader {
|
||||
objectName: "pageHeader"
|
||||
title: qsTr("About Application")
|
||||
}
|
||||
|
||||
Label {
|
||||
objectName: "descriptionText"
|
||||
anchors { left: parent.left; right: parent.right; margins: Theme.horizontalPageMargin }
|
||||
color: palette.highlightColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("#descriptionText")
|
||||
}
|
||||
|
||||
SectionHeader {
|
||||
objectName: "licenseHeader"
|
||||
text: qsTr("3-Clause BSD License")
|
||||
}
|
||||
|
||||
Label {
|
||||
objectName: "licenseText"
|
||||
anchors { left: parent.left; right: parent.right; margins: Theme.horizontalPageMargin }
|
||||
color: palette.highlightColor
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("#licenseText")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
136
app/qml/pages/MainPage.qml
Executable file
136
app/qml/pages/MainPage.qml
Executable file
|
@ -0,0 +1,136 @@
|
|||
/*******************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 Open Mobile Platform LLC.
|
||||
** Contact: https://community.omprussia.ru/open-source
|
||||
**
|
||||
** This file is part of the Aurora OS Application Template project.
|
||||
**
|
||||
** Redistribution and use in source and binary forms,
|
||||
** with or without modification, are permitted provided
|
||||
** that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer
|
||||
** in the documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the copyright holder nor the names of its contributors
|
||||
** may be used to endorse or promote products derived from this software
|
||||
** without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION)
|
||||
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
import QtQuick 2.6
|
||||
import Sailfish.Silica 1.0
|
||||
import QtMultimedia 5.6
|
||||
import com.danyok.classes 1.0
|
||||
|
||||
Page {
|
||||
objectName: "mainPage"
|
||||
allowedOrientations: Orientation.Portrait
|
||||
|
||||
CvDetectFilter
|
||||
{
|
||||
id: testFilter
|
||||
onObjectDetected:
|
||||
{
|
||||
if((w == 0) || (h == 0))
|
||||
{
|
||||
smile.visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var r = video.mapNormalizedRectToItem(Qt.rect(x, y, w, h));
|
||||
smile.x = r.x;
|
||||
smile.y = r.y;
|
||||
smile.width = r.width;
|
||||
smile.height = r.height;
|
||||
smile.visible = true;
|
||||
console.log(w , h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Camera
|
||||
{
|
||||
id: camera
|
||||
}
|
||||
|
||||
ShaderEffect
|
||||
{
|
||||
id: videoShader
|
||||
property variant src: video
|
||||
property variant source: video
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: upRect
|
||||
width: parent.width
|
||||
height: parent.height * 0.1
|
||||
anchors.top: parent.top
|
||||
|
||||
ListView {
|
||||
anchors.fill: parent
|
||||
|
||||
model: QtMultimedia.availableCameras
|
||||
delegate: Text {
|
||||
text: modelData.displayName
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
camera.stop()
|
||||
camera.deviceId = modelData.deviceId
|
||||
cameraStartTimer.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer
|
||||
{
|
||||
id: cameraStartTimer; interval: 500;running: false; repeat: false; onTriggered: camera.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: rect1
|
||||
width: parent.width
|
||||
height: parent.height * 0.9
|
||||
anchors.top: upRect.bottom
|
||||
VideoOutput
|
||||
{
|
||||
id: video
|
||||
anchors.fill: parent
|
||||
source: camera
|
||||
autoOrientation: false
|
||||
|
||||
filters: [testFilter]
|
||||
|
||||
Image
|
||||
{
|
||||
id: smile
|
||||
source: "qrc:/res/smile.png"
|
||||
visible: false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
6
app/res.qrc
Normal file
6
app/res.qrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>res/faceclassifier.xml</file>
|
||||
<file>res/smile.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
4613
app/res/faceclassifier.xml
Normal file
4613
app/res/faceclassifier.xml
Normal file
File diff suppressed because it is too large
Load diff
13319
app/res/faceclassifier_cat_filter.xml
Normal file
13319
app/res/faceclassifier_cat_filter.xml
Normal file
File diff suppressed because it is too large
Load diff
BIN
app/res/smile.png
Normal file
BIN
app/res/smile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
59
app/src/main.cpp
Executable file
59
app/src/main.cpp
Executable file
|
@ -0,0 +1,59 @@
|
|||
/*******************************************************************************
|
||||
**
|
||||
** Copyright (C) 2022 Open Mobile Platform LLC.
|
||||
** Contact: https://community.omprussia.ru/open-source
|
||||
**
|
||||
** This file is part of the Aurora OS Application Template project.
|
||||
**
|
||||
** Redistribution and use in source and binary forms,
|
||||
** with or without modification, are permitted provided
|
||||
** that the following conditions are met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright notice,
|
||||
** this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright notice,
|
||||
** this list of conditions and the following disclaimer
|
||||
** in the documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the copyright holder nor the names of its contributors
|
||||
** may be used to endorse or promote products derived from this software
|
||||
** without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS;
|
||||
** OR BUSINESS INTERRUPTION)
|
||||
** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
**
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QScopedPointer>
|
||||
#include <QGuiApplication>
|
||||
#include <QQuickView>
|
||||
|
||||
#include <sailfishapp.h>
|
||||
#include "qcvdetectfilter.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QScopedPointer<QGuiApplication> application(SailfishApp::application(argc, argv));
|
||||
application->setOrganizationName(QStringLiteral("com.gitlab.danyok"));
|
||||
application->setApplicationName(QStringLiteral("cameracv"));
|
||||
|
||||
QScopedPointer<QQuickView> view(SailfishApp::createView());
|
||||
qmlRegisterType<QCvDetectFilter>("com.danyok.classes", 1, 0, "CvDetectFilter");
|
||||
qRegisterMetaType<QList<QRect>>("QList<QRect>");
|
||||
view->setSource(SailfishApp::pathTo(QStringLiteral("qml/cameracv.qml")));
|
||||
view->show();
|
||||
|
||||
return application->exec();
|
||||
}
|
126
app/src/qcvdetectfilter.cpp
Executable file
126
app/src/qcvdetectfilter.cpp
Executable file
|
@ -0,0 +1,126 @@
|
|||
#include "qcvdetectfilter.h"
|
||||
|
||||
cv::CascadeClassifier classifier;
|
||||
|
||||
QVideoFilterRunnable* QCvDetectFilter::createFilterRunnable()
|
||||
{
|
||||
return new QCvDetectFilterRunnable(this);
|
||||
}
|
||||
|
||||
QImage QCvDetectFilterRunnable::QVideoFrameToQImage(QVideoFrame *videoFrame )
|
||||
{
|
||||
if ( videoFrame->handleType() == QAbstractVideoBuffer::NoHandle )
|
||||
{
|
||||
QImage image(videoFrame->bits(),
|
||||
videoFrame->width(),
|
||||
videoFrame->height(),
|
||||
QVideoFrame::imageFormatFromPixelFormat(videoFrame->pixelFormat()));
|
||||
if ( image.isNull() ) return QImage();
|
||||
if ( image.format() != QImage::Format_ARGB32 ) return image.convertToFormat( QImage::Format_ARGB32 );
|
||||
return image;
|
||||
}
|
||||
if ( videoFrame->handleType() == QAbstractVideoBuffer::GLTextureHandle )
|
||||
{
|
||||
QImage image( videoFrame->width(), videoFrame->height(), QImage::Format_ARGB32 );
|
||||
GLuint textureId = static_cast<GLuint>( videoFrame->handle().toInt() );
|
||||
QOpenGLContext* ctx = QOpenGLContext::currentContext();
|
||||
QOpenGLFunctions* f = ctx->functions();
|
||||
GLuint fbo;
|
||||
f->glGenFramebuffers( 1, &fbo );
|
||||
GLint prevFbo;
|
||||
f->glGetIntegerv( GL_FRAMEBUFFER_BINDING, &prevFbo );
|
||||
f->glBindFramebuffer( GL_FRAMEBUFFER, fbo );
|
||||
f->glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureId, 0 );
|
||||
f->glReadPixels( 0, 0, videoFrame->width(), videoFrame->height(), GL_RGBA, GL_UNSIGNED_BYTE, image.bits() );
|
||||
f->glBindFramebuffer( GL_FRAMEBUFFER, static_cast<GLuint>( prevFbo ) );
|
||||
return image.rgbSwapped();
|
||||
}
|
||||
return QImage();
|
||||
}
|
||||
|
||||
QVideoFrame QCvDetectFilterRunnable::run(QVideoFrame *input, const QVideoSurfaceFormat &surfaceFormat, RunFlags flags)
|
||||
{
|
||||
Q_UNUSED(flags);
|
||||
input->map(QAbstractVideoBuffer::ReadOnly);
|
||||
// qDebug() << "HandleType: " << surfaceFormat.handleType();
|
||||
|
||||
if(surfaceFormat.handleType() == QAbstractVideoBuffer::NoHandle or surfaceFormat.handleType() == QAbstractVideoBuffer::GLTextureHandle)
|
||||
{
|
||||
QImage image = QVideoFrameToQImage(input);
|
||||
image = image.convertToFormat(QImage::Format_RGB888);
|
||||
cv::Mat mat(image.height(),
|
||||
image.width(),
|
||||
CV_8UC3,
|
||||
image.bits(),
|
||||
image.bytesPerLine());
|
||||
|
||||
cv::flip(mat, mat, 0);
|
||||
|
||||
if(classifier.empty())
|
||||
{
|
||||
QFile xml(":/res/faceclassifier.xml");
|
||||
if(xml.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QTemporaryFile temp;
|
||||
if(temp.open())
|
||||
{
|
||||
temp.write(xml.readAll());
|
||||
temp.close();
|
||||
if(classifier.load(temp.fileName().toStdString()))
|
||||
{
|
||||
qDebug() << "Successfully loaded classifier!";
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Could not load classifier.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Can't open temp file.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Can't open XML.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<cv::Rect> detected;
|
||||
|
||||
/*
|
||||
* Resize in not mandatory but it can speed up things quite a lot!
|
||||
*/
|
||||
QSize resized = image.size().scaled(320, 240, Qt::KeepAspectRatio);
|
||||
cv::resize(mat, mat, cv::Size(resized.width(), resized.height()));
|
||||
|
||||
classifier.detectMultiScale(mat, detected, 1.1);
|
||||
|
||||
// We'll use only the first detection to make sure things are not slow on the qml side
|
||||
if(detected.size() > 0)
|
||||
{
|
||||
// Normalize x,y,w,h to values between 0..1 and send them to UI
|
||||
emit filter->objectDetected(float(detected[0].x) / float(mat.cols),
|
||||
float(detected[0].y) / float(mat.rows),
|
||||
float(detected[0].width) / float(mat.cols),
|
||||
float(detected[0].height) / float(mat.rows));
|
||||
qDebug() << "Object detected!";
|
||||
}
|
||||
else
|
||||
{
|
||||
emit filter->objectDetected(0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "Other surface formats are not supported yet!";
|
||||
}
|
||||
|
||||
input->unmap();
|
||||
return *input;
|
||||
}
|
38
app/src/qcvdetectfilter.h
Executable file
38
app/src/qcvdetectfilter.h
Executable file
|
@ -0,0 +1,38 @@
|
|||
#ifndef QCVDETECTFILTER_H
|
||||
#define QCVDETECTFILTER_H
|
||||
|
||||
#include <QAbstractVideoFilter>
|
||||
#include <QDebug>
|
||||
#include <QTemporaryFile>
|
||||
#include <QMutex>
|
||||
#include "opencv2/core.hpp"
|
||||
#include "opencv2/imgproc.hpp"
|
||||
#include "opencv2/objdetect.hpp"
|
||||
#include <QtOpenGL>
|
||||
|
||||
class QCvDetectFilter : public QAbstractVideoFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QVideoFilterRunnable *createFilterRunnable();
|
||||
|
||||
signals:
|
||||
void objectDetected(float x, float y, float w, float h);
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
class QCvDetectFilterRunnable : public QVideoFilterRunnable
|
||||
{
|
||||
public:
|
||||
QCvDetectFilterRunnable(QCvDetectFilter *creator) {filter = creator;}
|
||||
QVideoFrame run(QVideoFrame *input, const QVideoSurfaceFormat &surfaceFormat, RunFlags flags);
|
||||
QImage QVideoFrameToQImage(QVideoFrame *videoFrame );
|
||||
|
||||
private:
|
||||
void dft(cv::InputArray input, cv::OutputArray output);
|
||||
QCvDetectFilter *filter;
|
||||
};
|
||||
|
||||
#endif // QCVDETECTFILTER_H
|
43
app/translations/com.gitlab.danyok.cameracv-ru.ts
Executable file
43
app/translations/com.gitlab.danyok.cameracv-ru.ts
Executable file
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="ru">
|
||||
<context>
|
||||
<name>AboutPage</name>
|
||||
<message>
|
||||
<location filename="../qml/pages/AboutPage.qml" line="58"/>
|
||||
<source>About Application</source>
|
||||
<translation>О приложении</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/AboutPage.qml" line="68"/>
|
||||
<source>#descriptionText</source>
|
||||
<translation><p>Проект предоставляет шаблон приложений для ОС&nbsp;Аврора.</p>
|
||||
<p>Основная цель&nbsp;— наглядно продемонстрировать практически минимальный исходный код для получения корректного и расширяемого приложения.</p></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/AboutPage.qml" line="83"/>
|
||||
<source>#licenseText</source>
|
||||
<translation><p><i>Copyright (C) 2022 Open Mobile Platform LLC</i></p>
|
||||
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
|
||||
<ol>
|
||||
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
|
||||
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
|
||||
<li>Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.</li>
|
||||
</ol>
|
||||
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/AboutPage.qml" line="73"/>
|
||||
<source>3-Clause BSD License</source>
|
||||
<translation>Лицензия 3-Clause BSD</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DefaultCoverPage</name>
|
||||
<message>
|
||||
<location filename="../qml/cover/DefaultCoverPage.qml" line="47"/>
|
||||
<source>Application Template</source>
|
||||
<translation>Шаблон приложения</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
43
app/translations/com.gitlab.danyok.cameracv.ts
Executable file
43
app/translations/com.gitlab.danyok.cameracv.ts
Executable file
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="en">
|
||||
<context>
|
||||
<name>AboutPage</name>
|
||||
<message>
|
||||
<location filename="../qml/pages/AboutPage.qml" line="58"/>
|
||||
<source>About Application</source>
|
||||
<translation>About Application</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/AboutPage.qml" line="68"/>
|
||||
<source>#descriptionText</source>
|
||||
<translation><p>The project provides a template for Aurora OS applications.</p>
|
||||
<p>The main purpose is to clearly demonstrate almost minimal source code to get a correct and extensible application.</p></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/AboutPage.qml" line="83"/>
|
||||
<source>#licenseText</source>
|
||||
<translation><p><i>Copyright (C) 2022 Open Mobile Platform LLC</i></p>
|
||||
<p>Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p>
|
||||
<ol>
|
||||
<li>Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</li>
|
||||
<li>Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</li>
|
||||
<li>Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.</li>
|
||||
</ol>
|
||||
<p>THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/AboutPage.qml" line="73"/>
|
||||
<source>3-Clause BSD License</source>
|
||||
<translation>3-Clause BSD License</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DefaultCoverPage</name>
|
||||
<message>
|
||||
<location filename="../qml/cover/DefaultCoverPage.qml" line="47"/>
|
||||
<source>Application Template</source>
|
||||
<translation>Application Template</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
54
com.gitlab.danyok.cameracv.subdirs.pro
Executable file
54
com.gitlab.danyok.cameracv.subdirs.pro
Executable file
|
@ -0,0 +1,54 @@
|
|||
################################################################################
|
||||
##
|
||||
## Copyright (C) 2022 Open Mobile Platform LLC.
|
||||
## Contact: https://community.omprussia.ru/open-source
|
||||
##
|
||||
## This file is part of the Aurora OS Application Template project.
|
||||
##
|
||||
## Redistribution and use in source and binary forms,
|
||||
## with or without modification, are permitted provided
|
||||
## that the following conditions are met:
|
||||
##
|
||||
## * Redistributions of source code must retain the above copyright notice,
|
||||
## this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright notice,
|
||||
## this list of conditions and the following disclaimer
|
||||
## in the documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of the copyright holder nor the names of its contributors
|
||||
## may be used to endorse or promote products derived from this software
|
||||
## without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
## FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
## IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
## OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
## LOSS OF USE, DATA, OR PROFITS;
|
||||
## OR BUSINESS INTERRUPTION)
|
||||
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
## EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
################################################################################
|
||||
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS = \
|
||||
libs \
|
||||
app \
|
||||
|
||||
app.depends = libs
|
||||
|
||||
OTHER_FILES += \
|
||||
rpm/com.gitlab.danyok.cameracv.spec \
|
||||
AUTHORS.md \
|
||||
CODE_OF_CONDUCT.md \
|
||||
CONTRIBUTING.md \
|
||||
LICENSE.BSD-3-CLAUSE.md \
|
||||
README.md \
|
||||
|
92
libs/libs.pro
Executable file
92
libs/libs.pro
Executable file
|
@ -0,0 +1,92 @@
|
|||
################################################################################
|
||||
##
|
||||
## Copyright (C) 2021-2022 Open Mobile Platform LLC.
|
||||
## Contact: https://community.omprussia.ru/open-source
|
||||
##
|
||||
## This file is part of the Document Scanner project.
|
||||
##
|
||||
## Redistribution and use in source and binary forms,
|
||||
## with or without modification, are permitted provided
|
||||
## that the following conditions are met:
|
||||
##
|
||||
## * Redistributions of source code must retain the above copyright notice,
|
||||
## this list of conditions and the following disclaimer.
|
||||
## * Redistributions in binary form must reproduce the above copyright notice,
|
||||
## this list of conditions and the following disclaimer
|
||||
## in the documentation and/or other materials provided with the distribution.
|
||||
## * Neither the name of the copyright holder nor the names of its contributors
|
||||
## may be used to endorse or promote products derived from this software
|
||||
## without specific prior written permission.
|
||||
##
|
||||
## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
## FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
## IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
## OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
## LOSS OF USE, DATA, OR PROFITS;
|
||||
## OR BUSINESS INTERRUPTION)
|
||||
## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
## (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
## EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
##
|
||||
################################################################################
|
||||
|
||||
TEMPLATE = aux
|
||||
|
||||
OPENCV_PATH = $$OUT_PWD/opencv
|
||||
|
||||
opencv_build.commands = \
|
||||
cmake -S $$IN_PWD/opencv/ -B $$OPENCV_PATH \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_SKIP_RPATH=ON \
|
||||
-DBUILD_LIST=core,imgproc,objdetect \
|
||||
-DBUILD_EXAMPLES=OFF \
|
||||
-DBUILD_DOCS=OFF \
|
||||
-DBUILD_PERF_TESTS=OFF \
|
||||
-DBUILD_TESTS=OFF \
|
||||
-DBUILD_SHARED_LIBS=ON \
|
||||
-DBUILD_ZLIB=ON \
|
||||
-DBUILD_TIFF=ON \
|
||||
-DBUILD_WEBP=ON \
|
||||
-DBUILD_OPENJPEG=ON \
|
||||
-DBUILD_PNG=ON \
|
||||
-DBUILD_TIFF=ON \
|
||||
-DBUILD_WEBP=ON \
|
||||
-DBUILD_OPENJPEG=ON \
|
||||
-DBUILD_PNG=ON \
|
||||
-DBUILD_PROTOBUF=OFF \
|
||||
-DPROTOBUF_UPDATE_FILES=ON \
|
||||
-DCV_TRACE=OFF \
|
||||
-DENABLE_PRECOMPILED_HEADERS=OFF \
|
||||
-DOPENCV_GENERATE_PKGCONFIG=OFF \
|
||||
-DOpenGL_GL_PREFERENCE=GLVND \
|
||||
-DWITH_CAROTENE=OFF \
|
||||
-DWITH_GDAL=OFF \
|
||||
-DWITH_IPP=OFF \
|
||||
-DWITH_ITT=OFF \
|
||||
-DWITH_OPENGL=ON \
|
||||
-DWITH_OPENCL=OFF \
|
||||
-DWITH_OPENEXR=OFF \
|
||||
-DWITH_QT=ON \
|
||||
-DWITH_V4L=OFF; \
|
||||
make $$OPENCV_MFLAGS -C $$OPENCV_PATH \
|
||||
|
||||
opencv_install.depends = opencv_build
|
||||
opencv_install.path = /usr/share/com.gitlab.danyok.cameracv/lib
|
||||
opencv_install.files = $$OPENCV_PATH/lib/*.so*
|
||||
opencv_install.CONFIG = no_check_exist # this flag is necessary for the correct generation of the makefile
|
||||
|
||||
PRE_TARGETDEPS += \
|
||||
opencv_build \
|
||||
|
||||
QMAKE_EXTRA_TARGETS += \
|
||||
opencv_build \
|
||||
opencv_install \
|
||||
|
||||
INSTALLS += \
|
||||
opencv_install \
|
27
libs/opencv/.gitignore
vendored
Normal file
27
libs/opencv/.gitignore
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
# ignore dot files/directories
|
||||
.*
|
||||
!.gitignore
|
||||
|
||||
*.autosave
|
||||
*.pyc
|
||||
*.user
|
||||
*~
|
||||
Thumbs.db
|
||||
tags
|
||||
tegra/
|
||||
bin/
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.obj
|
||||
*.stamp
|
||||
*.depend
|
||||
*.rule
|
||||
*.tmp
|
||||
*/debug
|
||||
*.suo
|
||||
*.log
|
||||