File indexing completed on 2025-01-05 03:58:13
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 28/08/2021 0007 * Description : a command line tool to read focus points metadata with ExifTool 0008 * 0009 * SPDX-FileCopyrightText: 2021-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 // Qt includes 0016 0017 #include <QString> 0018 #include <QCoreApplication> 0019 0020 // Local includes 0021 0022 #include "digikam_debug.h" 0023 #include "focuspoints_extractor.h" 0024 0025 using namespace Digikam; 0026 0027 int main(int argc, char** argv) 0028 { 0029 QCoreApplication app(argc, argv); 0030 0031 if (argc != 2) 0032 { 0033 qCDebug(DIGIKAM_TESTS_LOG) << "afpointread - CLI tool to read focus points metadata with ExifTool from image"; 0034 qCDebug(DIGIKAM_TESTS_LOG) << "Usage: <image to read>"; 0035 return -1; 0036 } 0037 0038 FocusPointsExtractor* const fpreader = new FocusPointsExtractor(qApp, QString::fromUtf8(argv[1])); 0039 FocusPointsExtractor::ListAFPoints points = fpreader->get_af_points(); 0040 0041 qCDebug(DIGIKAM_TESTS_LOG) << "Make/Model from" << argv[1] << ":" << fpreader->make() << "/" << fpreader->model(); 0042 qCDebug(DIGIKAM_TESTS_LOG) << "Original Image Size:" << fpreader->originalSize(); 0043 0044 if (!points.isEmpty()) 0045 { 0046 int id = 1; 0047 0048 Q_FOREACH (const FocusPoint& fp, points) 0049 { 0050 qCDebug(DIGIKAM_TESTS_LOG) << id << "AF Focus region found in" << argv[1] << ":" << fp; 0051 qCDebug(DIGIKAM_TESTS_LOG) << id << "AF Focus coordinates in image" << argv[1] << ":" << fp.getRectBySize(fpreader->originalSize()); 0052 ++id; 0053 } 0054 } 0055 else 0056 { 0057 qCDebug(DIGIKAM_TESTS_LOG) << "No AF Focus region found in" << argv[1]; 0058 } 0059 0060 delete fpreader; 0061 0062 return 0; 0063 }