| 1 |
/* ============================================================ |
| 2 |
* |
| 3 |
* This file is a part of digiKam project |
| 4 |
* https://www.digikam.org |
| 5 |
* |
| 6 |
* Date : 2024-11-10 |
| 7 |
* Description : Performs face detection and recognition |
| 8 |
* |
| 9 |
* SPDX-FileCopyrightText: 2024-2026 by Gilles Caulier <caulier dot gilles at gmail dot com> |
| 10 |
* SPDX-FileCopyrightText: 2024-2025 by Michael Miller <michael underscore miller at msn dot com> |
| 11 |
* |
| 12 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 13 |
* |
| 14 |
* ============================================================ */ |
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
// Qt includes |
| 19 |
|
| 20 |
#include <QImage> |
| 21 |
#include <QRectF> |
| 22 |
|
| 23 |
// Local includes |
| 24 |
|
| 25 |
#include "digikam_opencv.h" |
| 26 |
#include "mlpipelinepackagefoundation.h" |
| 27 |
#include "faceutils.h" |
| 28 |
#include "iteminfo.h" |
| 29 |
#include "dimg.h" |
| 30 |
|
| 31 |
|
| 32 |
namespace Digikam |
| 33 |
{ |
| 34 |
|
| 35 |
class FacePipelinePackageBase : public MLPipelinePackageFoundation |
| 36 |
{ |
| 37 |
public: |
| 38 |
|
| 39 |
enum EditPipelineAction |
| 40 |
{ |
| 41 |
Confirm, |
| 42 |
Remove, |
| 43 |
RemoveAll, |
| 44 |
EditTag, |
| 45 |
EditRegion, |
| 46 |
AddManually, |
| 47 |
DeleteRejectedFaceTagList |
| 48 |
}; |
| 49 |
|
| 50 |
public: |
| 51 |
|
| 52 |
FacePipelinePackageBase() = default; |
| 53 |
explicit FacePipelinePackageBase(qlonglong _imageId, |
| 54 |
int _serialNumber = -1); |
| 55 |
|
| 56 |
explicit FacePipelinePackageBase(qlonglong _imageId, |
| 57 |
const FaceTagsIface& _face, |
| 58 |
int _serialNumber = -1); |
| 59 |
|
| 60 |
explicit FacePipelinePackageBase(const ItemInfo& _info, |
| 61 |
EditPipelineAction _action, |
| 62 |
int _serialNumber = -1); |
| 63 |
|
| 64 |
explicit FacePipelinePackageBase(const ItemInfo& _info, |
| 65 |
const FaceTagsIface& _face, |
| 66 |
int _tagId, |
| 67 |
const TagRegion& _region, |
| 68 |
const DImg& _image, |
| 69 |
EditPipelineAction _action, |
| 70 |
bool _retrain, |
| 71 |
int _serialNumber = -1); |
| 72 |
|
| 73 |
virtual ~FacePipelinePackageBase() override; |
| 74 |
|
| 75 |
public: |
| 76 |
|
| 77 |
ItemInfo info; |
| 78 |
FaceTagsIface face; |
| 79 |
QImage thumbnail; |
| 80 |
DImg image; |
| 81 |
QList<QRectF> faceRects; |
| 82 |
cv::Mat features; |
| 83 |
int label = -1; |
| 84 |
int tagId = -1; |
| 85 |
TagRegion region; |
| 86 |
EditPipelineAction action = EditPipelineAction::Confirm; |
| 87 |
bool useForTraining = false; |
| 88 |
bool retrain = false; |
| 89 |
QList<cv::Mat> featuresList; |
| 90 |
QList<int> labelList; |
| 91 |
QList<FaceTagsIface> faceList; |
| 92 |
QList<int> exclusionIdentityIds; |
| 93 |
int serialNumber = -1; |
| 94 |
|
| 95 |
private: |
| 96 |
|
| 97 |
/// @note disabled |
| 98 |
FacePipelinePackageBase(const FacePipelinePackageBase&) = delete; |
| 99 |
FacePipelinePackageBase& operator=(const FacePipelinePackageBase&) = delete; |
| 100 |
}; |
| 101 |
|
| 102 |
} // namespace Digikam |