{"id":9704,"url":"https://patchwork.libcamera.org/api/patches/9704/?format=json","web_url":"https://patchwork.libcamera.org/patch/9704/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200922100400.30766-7-david.plowman@raspberrypi.com>","date":"2020-09-22T10:04:00","name":"[libcamera-devel,6/6] qcam: Add command line option to test IspCrop control","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"432696e295f9ec6148c8c4f3a520e4b09065bf9e","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/9704/mbox/","series":[{"id":1308,"url":"https://patchwork.libcamera.org/api/series/1308/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1308","date":"2020-09-22T10:03:54","name":"Digital zoom","version":1,"mbox":"https://patchwork.libcamera.org/series/1308/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/9704/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/9704/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C1619BF01C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 22 Sep 2020 10:04:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8362962FE5;\n\tTue, 22 Sep 2020 12:04:15 +0200 (CEST)","from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EA26062FDA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Sep 2020 12:04:12 +0200 (CEST)","by mail-wm1-x332.google.com with SMTP id e17so2708434wme.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 22 Sep 2020 03:04:12 -0700 (PDT)","from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tg14sm26369595wrv.25.2020.09.22.03.04.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 22 Sep 2020 03:04:11 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"qjMt04Ij\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=L4AmPElkGZryXc7UPUCU4tjAIGgErk1azYH9/WZBAVw=;\n\tb=qjMt04IjzzAH8CRq5IAJVtAMdbd/+Ktp0GqG0pkRIR25oqdr2kC9SLjTgC/K1Ro70n\n\tYqcfT5VdDrue6tL1gqkmGDL+qbvTX8PfkrZfxbrc5AcPWGIBqOXkHO52S1zRYU9sGFlv\n\tfQo7f0rSPQc0vdYaZBBqsXnYfGO0EpJC4pxVO9/TdCRBEgN+ro05GiD5YSYDPJWx+EFI\n\tHzajpYnhbLWlPItj3HPFJd2hRF5PkMezD1Z6GqPIBURePIa6/4xXIeNtaUkLIftJR2mt\n\tiE4iiTh9PLNbPFzVUT/Z3P0w6YfHbIj+DBEnVYGZC8K492LZSuk0LlfmNUswsjR4fnej\n\t08ig==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=L4AmPElkGZryXc7UPUCU4tjAIGgErk1azYH9/WZBAVw=;\n\tb=jNqWVEHm1eEjq0899VdTvDFWDZ3zwlozxyGwlRSLOYjm0Egui3QyJ2GjIVApt9Vr1X\n\tLdcEhToyLGPvlZpIeeCAZwbrUQ1avvyOU3w1HwAxW4VekAp1j1QW/CJM/wFe6uZJpYmP\n\t+m7gUEuPgEQgfRizKcn8xLnF4/Tn6wSZBmWA6KvUbHXGNQidWtwZF8AsWDNf6zuIGevU\n\tihSAgi7AUTmZYyrVg3B6T0HRtZFwxzTTl/UNDhHomJZsqi3fjIVwtL1M/ZdZkGaCPqQy\n\trt1xea1FDVPLVrbf2KCmyxMn7aYVsewFk4YsnlbMPnnKSY26y1nYoEJZ6QqBHhui7MVn\n\t683A==","X-Gm-Message-State":"AOAM532XC7cJytrEUvEEUiPQDcj3Eyt88ClYTloZurFlHYp3j2FUphfx\n\tedYCyidzyI88gPRc8fF9gYTVub6BtZv7iw==","X-Google-Smtp-Source":"ABdhPJyzX2j1dAqIIsbBfz62f0/dNuXPS3gGkwHrcYPrXsHBOM4MgmoW6NuVRI/Oq96yRr2avbG6LA==","X-Received":"by 2002:a05:600c:2909:: with SMTP id\n\ti9mr151948wmd.160.1600769052078; \n\tTue, 22 Sep 2020 03:04:12 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 22 Sep 2020 11:04:00 +0100","Message-Id":"<20200922100400.30766-7-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20200922100400.30766-1-david.plowman@raspberrypi.com>","References":"<20200922100400.30766-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 6/6] qcam: Add command line option to test\n\tIspCrop control","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This allows the user to request digital zoom by adding, for example,\n\"-z 0.25,0.25,0.5,0.5\" which would give a 2x zoom, still centred in\nthe middle of the image.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/qcam/main.cpp        |  3 +++\n src/qcam/main_window.cpp | 20 ++++++++++++++++++++\n src/qcam/main_window.h   |  1 +\n 3 files changed, 24 insertions(+)","diff":"diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\nindex f60d3ce..9f8435d 100644\n--- a/src/qcam/main.cpp\n+++ b/src/qcam/main.cpp\n@@ -38,6 +38,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])\n \t\t\t \"renderer\", ArgumentRequired, \"renderer\");\n \tparser.addOption(OptStream, &streamKeyValue,\n \t\t\t \"Set configuration of a camera stream\", \"stream\", true);\n+\tparser.addOption(OptZoom, OptionString,\n+\t\t\t \"Specify crop for digital zoom as fractions x,y,width,height e.g. 0.25,0.25,0.5,0.5\",\n+\t\t\t \"zoom\", ArgumentRequired, \"zoom\");\n \n \tOptionsParser::Options options = parser.parse(argc, argv);\n \tif (options.isSet(OptHelp))\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 985743f..fb54b15 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -25,6 +25,8 @@\n #include <QtDebug>\n \n #include <libcamera/camera_manager.h>\n+#include <libcamera/control_ids.h>\n+#include <libcamera/property_ids.h>\n #include <libcamera/version.h>\n \n #include \"dng_writer.h\"\n@@ -502,6 +504,24 @@ int MainWindow::startCapture()\n \t\trequests.push_back(request);\n \t}\n \n+\t/* Set up digital zoom if it was requested on the command line. */\n+\tif (options_.isSet(OptZoom)) {\n+\t\tstd::string zoom = options_[OptZoom].toString();\n+\t\tfloat x, y, width, height;\n+\n+\t\tif (sscanf(zoom.c_str(), \"%f,%f,%f,%f\", &x, &y, &width, &height) == 4) {\n+\t\t\tSize sensorArea = camera_->properties().get(properties::SensorOutputSize);\n+\t\t\tRectangle crop(x * sensorArea.width,\n+\t\t\t\t       y * sensorArea.height,\n+\t\t\t\t       width * sensorArea.width,\n+\t\t\t\t       height * sensorArea.height);\n+\n+\t\t\trequests.front()->controls().set(controls::IspCrop, crop);\n+\t\t} else {\n+\t\t\tqWarning() << \"Invalid zoom values - ignoring\";\n+\t\t}\n+\t}\n+\n \t/* Start the title timer and the camera. */\n \ttitleTimer_.start(2000);\n \tframeRateInterval_.start();\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 5c61a4d..e46eb70 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -39,6 +39,7 @@ enum {\n \tOptHelp = 'h',\n \tOptRenderer = 'r',\n \tOptStream = 's',\n+\tOptZoom = 'z',\n };\n \n class CaptureRequest\n","prefixes":["libcamera-devel","6/6"]}