How to implement a viewfinder using system camera
-
Hi, I posted the following questions several days ago. However I cannot read replies even I received several emails saying that someone posted a reply to my question. I can not see my original post in "My latest posts" either. I desperately need your help. So I open a new thread for the same question and close the original. I hope this thread will work just fine. Thank you!
=======
Hi, I am going to implement a viewfinder program to view, capture and record video and pictures, using the system camera. Based on the document, I see two approaches, widgets solution and QGraphicView solution.
-
In widgets solution, I need to use QCamera and QCameraViewfinder (QMediaRecorder and QCameraImageCapture) classes for the implementation. If I want to manually arrange the QCameraViewFinder in the UI form of Qt creator, where can I get the widget symbol? I could not find it in the “Widget Box” of the Qt creator.
-
In QGraphicView solution, I need to use QGraphicView, QGraphicScene, and QGraphicsVideoItem classes. In this approach, how can I connect the QCamera to the scene ? ( or to the QGraphicsVedioItem?) Should I use other class to represent the camera device?
Which approach do you prefer? Is there any C++ examples for this kind of project?
Your help and advice are greatly appreciated.
-
-
There is a "Camera Example":http://qt-project.org/doc/qt-5/qtmultimediawidgets-camera-example.html in Qt examples.
There are some other multimedia examples in Qt5.3.1/Examples/Qt-5.3/multimediawidgets/[quote author="stuartx" date="1407418420"]Hi, I posted the following questions several days ago. However I cannot read replies even I received several emails saying that someone posted a reply to my question. I can not see my original post in "My latest posts" either. I desperately need your help. So I open a new thread for the same question and close the original. I hope this thread will work just fine. Thank you![/quote]
There was a spam attack recently. They posted spam messages as replies to the questions. That is why you were getting email notifications. After cleanup those messages disappeared and that is why you don't see any responses in your thread. -
andreyc,
I try to run the camera example. I get the following error:
@Starting /home/sxu/Documents/QtApp/multimediawidgets/build-camera-Desktop_Qt_5_3_GCC_32bit-Debug/camera...
(<unknown>:2287): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(<unknown>:2287): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed
(<unknown>:2287): GStreamer-CRITICAL **: gst_object_ref_sink: assertion `GST_IS_OBJECT (object)' failed
(<unknown>:2287): GStreamer-CRITICAL **: gst_element_get_bus: assertion `GST_IS_ELEMENT (element)' failed
(<unknown>:2287): GStreamer-CRITICAL **: gst_bus_add_watch_full: assertion `GST_IS_BUS (bus)' failed
(<unknown>:2287): GStreamer-CRITICAL **: gst_bus_set_sync_handler: assertion `GST_IS_BUS (bus)' failed
(<unknown>:2287): GStreamer-CRITICAL **: gst_object_ref: assertion `object != NULL' failed
/home/sxu/Documents/QtApp/multimediawidgets/build-camera-Desktop_Qt_5_3_GCC_32bit-Debug/camera: symbol lookup error: /home/Qt/5.3/gcc/plugins/mediaservice/../../lib/libqgsttools_p.so.1: undefined symbol: gst_element_factory_list_get_elements
/home/sxu/Documents/QtApp/multimediawidgets/build-camera-Desktop_Qt_5_3_GCC_32bit-Debug/camera exited with code 127@The gstreamer is installed in my system. Any thing did I miss?
Thanks.
-
I have the same on CentOS 6.3 (gstreamer 0.10.29) with Qt 5.3.2. I guess Qt 5.3.2 needs at least gstreamer 0.10.30 for gst_element_factory_list_get_elements.