Hello and thanks for the follow up! Yes, I am processing live video in c++. I’m implementing a custom qml component to display the results. Other than that, I don’t see why qml needs to be involved. I only need to turn on the camera, get preview-sized images, and tell it to capture full resolution stills.
This is pretty much the most basic thing you can do with a camera. Honestly it’s disappointing that even after years of claiming to support mobile it’s still difficult to do something so simple. QVideoProbe — as I mentioned I got this to work on Android a while ago but not on iOS. I get the impression that it is a hack to deal with Android’s java/c++ split personality. Tyler > On 2016/11/23, at 23:20, Jason H <jh...@gmx.com> wrote: > > I'm being ambiguous because it's been some time since I work with that part > of Qt, and I don't want to tell you something that's not true. > > The QML camera capture api provides athe url of a preview image which is a > URL (imageProviderUrl) - you'll need to use a ImageProvider to get the data. > > QQmlEngine *engine = QQmlEngine::contextForObject(this)->engine(); > QQmlImageProviderBase *imageProviderBase = > engine->imageProvider(imageProviderUrl.host()); > QQuickImageProvider *imageProvider = > static_cast<QQuickImageProvider*>(imageProviderBase); > QSize imageSize; > QString imageId = imageProviderUrl.path().remove(0,1); > QImage image = imageProvider->requestImage(imageId, &imageSize, imageSize); > > However if you are looking to process live video frames and not 1-offs, > you'll need to use QVideoProbe, but QVideoProbe would crash the app after > some time. *Somewhere* I *might* have code. However, since I wrote that code, > QVideoFilter is now a thing: > http://blog.qt.io/blog/2015/03/20/introducing-video-filters-in-qt-multimedia/ > > I am sorry I can't give you definites, but I hope that helps in some way. > > > Sent: Wednesday, November 23, 2016 at 7:51 AM > From: "Tyler Daniel" <ty...@rosette-research.com> > To: "Jason H" <jh...@gmx.com> > Cc: interest@qt-project.org > Subject: Re: [Interest] camera APIs -- intended usage > Hi, thanks very much for the response! > > I understand that you generally want the viewfinder to related to the screen > size and I suppose this is why there’s a separate viewfinder api. I’ve also > written native iOS camera apps before and have some familiarity with > AVFoundation. > > Unfortunately my questions stand: > > 1) how do I get viewfinder frames (live preview frames) at resolution X and > still images at resolution Y, where Y is the maximum resolution and X is > lower. > > 2) why does the setViewfinderSettings() and setEncodingSettings() example > below behave the way it does? is this a bug, or intended behavior? > > Tyler > > > > On 2016/11/23, at 3:29, Jason H <jh...@gmx.com <mailto:jh...@gmx.com>> wrote: > > The viewfinder corresponds to the screen size, the full-capture corresponds > to the CCD, or what you have the CCD configured to capture. The AVFoundation > API on iOS has support for capturing frames and resizing them to requested > sizes for various consumers. You're probably seeing something related to > that. It's probably giving you the highest resolution requested. > > When I capture the "preview" image in QML, it is sized accordingly. > > Sent: Monday, November 21, 2016 at 8:29 PM > From: "Tyler Daniel" <ty...@rosette-research.com > <mailto:ty...@rosette-research.com>> > To: interest@qt-project.org <mailto:interest@qt-project.org> > Subject: [Interest] camera APIs -- intended usage > Hi all, I recently posted this in the forums, where it was suggested that I > ask my questions here. Sorry if this is a duplicate for someone. > > I'm building an iOS camera app and need the viewfinder/preview frames in > c++-land. I also need full-resolution still images when a capture button is > pressed. > > I can subclass QAbstractSurface and use QCamera::setViewfinder() to get > frames. The problem is that the frames I get for the preview are the same > resolution as the still images. I'm testing on an iPhone 5, so I either get > 3264 or 1920, let's say 3k or 2k. > > I'm using QCamera and QCameraImageCapture in c++ code. > > If I use QCameraImageCapture::setEncodingSettings with 3k and > QCamera::setViewfinderSettings with 2k, I get 3k preview frames and 3k still > images. > > I would have thought that the viewfinder api affects the viewfinder > resolution and the camera image capture affects a separate still image > capture resolution. But this is not the behavior I'm seeing. > > Each of these classes are documented in the doxygen sense, but intended usage > and how they work together is not. The closest I can find is the detailed > description of QCameraImageCapture, which provides a nice code snippet, but… > resolution problems. > > Pretty much all smartphones and digital cameras show a lower-resolution > preview and capture stills at a higher resolution. > > My question is how to achieve this with iOS? What should work? How do I get > 2k preview frames in c++ and 3k still captures? > > I’ve looked at the example apps. They work on iOS in the sense that they > don't crash, but they exhibit the same behavior with previews and stills at > the same resolution. > > I’m currently working with 5.7 and 5.8 beta, but honestly I’ve had problems > with the camera apis for years now. On Android I hacked something that > worked with QVideoProbe, but only for Android. On iOS I gave up and went > native. Never found a solution that worked for more than one platform. > > > Any help would be most appreciated! > > Tyler > > _______________________________________________ Interest mailing list > Interest@qt-project.org <mailto:Interest@qt-project.org> > http://lists.qt-project.org/mailman/listinfo/interest > <http://lists.qt-project.org/mailman/listinfo/interest>
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest