<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Custom Camera on Android]]></title><description><![CDATA[<p dir="auto">Hello,<br />
I use Qt 6.7.3 for Android on a Zebra-phone. The integrated camera app is not very usefull (e.g. always vertical preview of taken photos). Therefore I need a special camera modul with some feature on the video-preview:<br />
3x3 Grid and cutting of some pixel-lines at to top and buttom of the video-preview.</p>
<p dir="auto">On the right side of the dialog is a Button frame for control, on the left side I will sie the video.</p>
<p dir="auto">I tried 3 methods, but every had problems.</p>
<p dir="auto"><strong>1. Manipulate Vidoestream:</strong></p>
<pre><code>   VideoSurface = new TMyVideoSurface(this); // derived from QAbstractVideoSurface
    connect(VideoSurface, &amp;TMyVideoSurface::frameReceived,
    this, &amp;Camera_Frame::updateVideoPicture);
</code></pre>
<p dir="auto">This worked on Windows very good, but on Android its to slow - the video is delayed.<br />
The slow part should be, datatransfer from "Camera-RAM" to nommal RAM.</p>
<p dir="auto"><strong>2. Widget over the QVideoWidget</strong></p>
<pre><code>m_overlay= new TMyCameraOverlay(m_videoWidget);
</code></pre>
<p dir="auto">I see no overlay. I heared that the QVideoWidget "overdraws" all.</p>
<p dir="auto"><strong>3. Use QGraphicsScene:</strong></p>
<pre><code>//  Main part of the code
m_graphicsScene = new QGraphicsScene(this);
   m_graphicsView = new QGraphicsView(m_graphicsScene, this);
   m_graphicsView-&gt;setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
   m_graphicsView-&gt;setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

   m_videoItem = new QGraphicsVideoItem();
   m_graphicsScene-&gt;addItem(m_videoItem);
   // 3. Create  Custom-Overlay and put it in the Szene
   m_overlay = new TCameraOverlay();
   // Proxy makes normal Widget visible
   QGraphicsProxyWidget *proxy = m_graphicsScene-&gt;addWidget(m_overlay);
   proxy-&gt;setZValue(1); // Overlay in den forground !
   
   // Pack View in the Layout
   ui-&gt;ViewLayout-&gt;addWidget(m_graphicsView, 0, 0);

   // 4. Connect Camera (Set VideoItem as VideoOutput)
   m_captureSession = new QMediaCaptureSession(this);
   m_imageCapture = new QImageCapture(this);
   connect(m_imageCapture, &amp;QImageCapture::imageCaptured,
           this, &amp;Camera_Frame::processCapturedImage);

   m_captureSession-&gt;setCamera(m_camera);
   m_captureSession-&gt;setVideoOutput(m_videoItem); // Important: videoItem instead of videoWidget!
   m_captureSession-&gt;setImageCapture(m_imageCapture);
</code></pre>
<p dir="auto">But here I get a very strange effect. The <strong>whole</strong> window especialy the control-buttons do react on touch evens no more.</p>
<p dir="auto">Who has experiences with a camera modul on Android ?</p>
]]></description><link>https://forum.qt.io/topic/164996/custom-camera-on-android</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 18:40:37 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/164996.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 11 Aug 2026 11:21:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Custom Camera on Android on Wed, 12 Aug 2026 12:52:33 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/andy314">@<bdi>Andy314</bdi></a> solution one is the right answer but you're missing few things.<br />
You should not process the camera streams on the main thread, you need to create another thread for gettig the camera frames and sending them to the Ui</p>
<p dir="auto">Moreover, after getting the camera frame and display it, you should free the memory space consumed by it. otherwise it will be slower and take too much ram</p>
]]></description><link>https://forum.qt.io/post/839670</link><guid isPermaLink="true">https://forum.qt.io/post/839670</guid><dc:creator><![CDATA[Ronel_qtmaster]]></dc:creator><pubDate>Wed, 12 Aug 2026 12:52:33 GMT</pubDate></item><item><title><![CDATA[Reply to Custom Camera on Android on Tue, 11 Aug 2026 14:40:08 GMT]]></title><description><![CDATA[<p dir="auto">It seems that QCamera in Qt 6 is pretty much lacking, as you can't even adjust preview fps. It could slow because</p>
<ol>
<li>the camera might give you 30 fps, which the app cant handle. You'd need some own code to throttle it</li>
<li>similarly, the camera may use a way too large resolution #slow. That you can set in somewhere - first get a list of supported resolutions and select from there</li>
</ol>
<p dir="auto">And when it comes to drawing a grid etc., you can always show the output in a regular widget and draw anything you wish on top of every frame.</p>
]]></description><link>https://forum.qt.io/post/839661</link><guid isPermaLink="true">https://forum.qt.io/post/839661</guid><dc:creator><![CDATA[mvuori]]></dc:creator><pubDate>Tue, 11 Aug 2026 14:40:08 GMT</pubDate></item></channel></rss>