QT with 2 webcam with iMX6

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

QT with 2 webcam with iMX6

QT with 2 webcam with iMX6

This is based on L5.10.35 BSP where you have to install QT static build:

Qt 5.15 static build:

Assuming your sysroot is at "/sysroot-cross" and your toolchain is at "/Toolchain"
your qt-source is at /Qt-5.15

PATH=/sysroot-cross/bin:/sysroot-cross/sbin:/Toolchain/bin

mkdir /Qt-5.15/mkspecs/qws/linux-imx6-g++
create in this dir the textfile "qmake.conf" with this content:
####################### snip qmake.conf ##############################

include(../../common/linux.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-linux-gnueabi-gcc
QMAKE_CFLAGS            = -pipe -isystem /sysroot-cross/include -isystem /sysroot-cross/usr/include
QMAKE_CXX               = arm-linux-gnueabi-g++
QMAKE_CXXFLAGS          = -pipe -isystem /sysroot-cross/include -isystem /sysroot-cross/usr/include
QMAKE_INCDIR            = /sysroot-cross/include /sysroot-cross/usr/include
QMAKE_LIBDIR            = /sysroot-cross/lib /sysroot-cross/usr/lib

QMAKE_LINK              = arm-linux-gnueabi-g++
QMAKE_LINK_SHLIB        = arm-linux-gnueabi-g++
QMAKE_LFLAGS            = -L/sysroot-cross/lib -L/sysroot-cross/usr/lib -Wl,-rpath-link -Wl,/sysroot-cross/lib
QMAKE_LFLAGS           += -Wl,-rpath-link -Wl,/sysroot-cross/usr/lib

#Opengl
QMAKE_INCDIR_OPENGL = /Vivante/include
QMAKE_INCDIR_OPENGL += /Vivante/include/GL
QMAKE_INCDIR_OPENGL += /Vivante/include/EGL
QMAKE_INCDIR_OPENGL += /Vivante/include/GLES2
QMAKE_LIBDIR_OPENGL = /Vivante/lib
QMAKE_INCDIR_OPENGL_ES1 = $$QMAKE_INCDIR_OPENGL
QMAKE_LIBDIR_OPENGL_ES1 = $$QMAKE_LIBDIR_OPENGL
QMAKE_INCDIR_OPENGL_ES1CL = $$QMAKE_INCDIR_OPENGL
QMAKE_LIBDIR_OPENGL_ES1CL = $$QMAKE_LIBDIR_OPENGL
QMAKE_INCDIR_OPENGL_ES2 = /Vivante/include
QMAKE_INCDIR_OPENGL_ES2 += /Vivante/include/EGL
QMAKE_INCDIR_OPENGL_ES2 += /Vivante/include/GLES2
QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_OPENGL
QMAKE_INCDIR_EGL = $$QMAKE_INCDIR_OPENGL_ES2
QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL
QMAKE_LIBS_EGL = -lEGL -lGAL -lGLESv2 -lGLES_CM
QMAKE_LIBS_OPENGL_ES2 = -lEGL -lGAL -lGLESv2 -lGLES_CM
QMAKE_LIBS_OPENGL = -lEGL -lGAL -lGLESv2 -lGLES_CM
QMAKE_LIBS_OPENGL_QT = -lEGL -lGAL -lGLESv2 -lGLES_CM
QMAKE_LIBS_OPENGL_ES1 =
QMAKE_LIBS_OPENGL_ES1CL =

# modifications to linux.conf
QMAKE_AR                = arm-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           = arm-linux-gnueabi-objcopy
QMAKE_STRIP             = arm-linux-gnueabi-strip
QMAKE_CFLAGS_RELEASE   = -pipe -isystem /sysroot-cross/include -isystem /sysroot-cross/usr/include

load(qt_config)
####################### snip qmake.conf ##############################

create in the same dir the text file "qplatformdefs.h"
####################### snip qplatformdefs.h ##############################

#include "../../linux-g++/qplatformdefs.h"

####################### snip qplatformdefs.h ##############################

now goto dir /Qt-5.15

cd /Qt-5.15

call configure with

./configure -opensource -confirm-license -release -no-rpath -no-fast \
    -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite2 \
    -no-qt3support -no-mmx -no-3dnow -no-sse -no-sse2 -no-sse3 -no-ssse3 \
    -no-sse4.1 -no-sse4.2 -no-avx -no-optimized-qmake -no-nis -no-cups -pch \
    -reduce-relocations -force-pkg-config -prefix /usr -no-armfpa -make libs \
    -nomake docs -little-endian -embedded armv6 -qt-decoration-styled \
    -depths all -xplatform qws/linux-imx6-g++ -iconv -largefile -qt-gfx-linuxfb \
    -qt-gfx-multiscreen -qt-mouse-pc -qt-mouse-linuxinput -qt-libpng \
    -plugin-gfx-directfb -system-zlib -no-accessibility -no-gfx-transformed \
    -no-gfx-qvfb -no-gfx-vnc -no-kbd-tty -no-kbd-linuxinput -no-kbd-qvfb \
    -no-mouse-linuxtp -no-mouse-tslib -no-mouse-qvfb -no-libmng -no-libtiff \
    -no-gif -no-libjpeg -no-freetype -no-stl -no-glib -no-openssl -no-egl \
    -no-xmlpatterns -no-exceptions -no-multimedia -no-audio-backend -no-phonon \
    -no-phonon-backend -no-webkit -no-script -no-scripttools -no-svg -no-script \
    -no-declarative -no-sql-sqlite -no-qdbus -no-opengl -static -nomake tools \
    -nomake examples -nomake demos

when configuring is finished call make

after a looong time, when everything goes right, we have a staticly compiled Qt. DO NOT
call "make install". We will install manually:
copy from /Qt-5.15/bin the files moc, uic, rcc and qmake to somewhere in PATH, eg. /sysroot-cross/bin
copy the contents of dir /Qt-5.15/mkspecs to /sysroot-cross/usr/mkspec
copy the contents of dir /Qt-5.15/plugins to /sysroot-cross/usr/plugins
copy the contents of dir /Qt-5.15/include to /sysroot-cross/usr/include
copy the contents of dir /Qt-5.15/lib to /sysroot-cross/usr/lib

Test application camtest:

if you don't have/want directfb plugin remove from camtest.pro the lines

LIBS += -L/sysroot-cross/usr/plugins/gfxdrivers

QTPLUGIN += QDirectFBScreen

and the lines from main.cpp

#include <QtPlugin>

Q_IMPORT_PLUGIN(qdirectfbscreen)

generate makefile by typing

/sysroot-cross/bin/qmake -spec /sysroot-cross/usr/mkspecs/qws/linux-imx6-g++ camtest.pro

then make

you should set and activate your framebuffers with this script
################# snip ################################
fbset -fb /dev/fb0 -g 1024 768 1024 2304 16
echo -n 0 > /sys/class/graphics/fb0/blank
fbset -fb /dev/fb1 -g 1024 768 1024 1536 32
echo -n 0 > /sys/class/graphics/fb1/blank

modprobe galcore
modprobe uvcvideo
modprobe mxc_v4l2_capture

################# snip ################################

if you use directfb
then your /etc/directfbrc file should look like this:
######################## snip /etc/directfbrc #############
system=fbdev
fbdev=/dev/fb1
mode=1024x768
depth=32
pixelformat=ARGB
no-cursor
window-surface-policy=systemonly
######################## snip /etc/directfbrc #############

to start the application with directfb:
./camtest -qws -display directfb

without directfb using linuxfb:
./camtest -qws -display linuxfb:/dev/fb1

Notes about application:
1. The application shows 2 webcams in background-framebuffer (BG-FB).
The foreground-framebuffer (FG-FB) shows the qt-gui. FG-FB is configured
to be fully opaque and uses color-keying. On the BG-FB one cam is overlayed on the
other cam using IPU.
Optimization possibilities: the app copies the frames from the cams with memcpy. This
wouldn't be necessary, when the kernel usb-webcam interface (uvc) would support
V4L2_MEMORY_USERPTR method. through this way, you could pass the mapped IPU mmapped inbufs directly to v4l2 output buffers.

  1. If you get errors like NOSPC (-28) from uvc, this is a limitation of USB. My board is
    a MX6QSabre, where the two webcams are connected to the same usb-controller.
    With both webcams I had to limit the frame size to 320x250 and 160x120 at 25Hz. You might try higher res if you have other type of webcams (not usb).

Have fun

 

ラベル(3)
評価なし
バージョン履歴
最終更新日:
‎10-08-2021 10:24 AM
更新者: