1.å¦ä½è®¾ç½®ç³»ç»å¯ä¸ç launcher
2.Ubuntu下Qt如何使用openCV库
å¦ä½è®¾ç½®ç³»ç»å¯ä¸ç launcher
ããå®ä¹ä¸ä¸ªç§æçfilteré项ï¼ç¶åç¨è¿ä¸ªé项æ¥è¿æ»¤HOME.ããä¸è¬æ åµä¸æ们使ç¨Manifestä¸å®ä¹ç<category android:name="android.intent.category.HOME"æ¥è¿æ»¤çï¼ããæ们ç°å¨å¢å ä¸ä¸ªç§æçHOME_FIRSTè¿æ»¤ãããå¨Intent.java(frameworks/base/core/java/android/content/Intent.java)ä¸æ·»å 两è¡ä»£ç ãã//lixinso:æ·»å CATEGORY_HOME_FIRSTãã@SdkConstant(SdkConstantType.INTENT_CATEGORY)ããpublic static final String CATEGORY_HOME_FIRST = "android.intent.category.HOME_FIRST";ãã3ï¼ä¿®æ¹åCATEGORY_HOMEç¸å ³çææçå°æ¹ï¼é½æ¹æHOME_FIRSTï¼ä¸»è¦æ¯frameworkä¸çè¿å 个å°æ¹ï¼ããframeworks/base/services/java/com/android/server/am/ActivityManagerService.javaä¸ãã//intent.addCategory(Intent.CATEGORY_HOME);ããæ¹æintent.addCategory(Intent.CATEGORY_HOME_FIRST); //lixinso:ãã//if (r.intent.hasCategory(Intent.CATEGORY_HOME)) { ããæ¹æif (r.intent.hasCategory(Intent.CATEGORY_HOME_FIRST)) { //lixinso: Intent.CATEGORY_HOME -> Intent.CATEGORY_HOME_FIRSTããframeworks/base/services/java/com/android/server/am/HistoryRecorder.javaä¸ãã// _intent.hasCategory(Intent.CATEGORY_HOME) &&ããæ¹æ _intent.hasCategory(Intent.CATEGORY_HOME_FIRST) && //lixinso: Intent.CATEGORY_HOME->Intent.CATEGORY_HOME_FIRSTããframeworks/policies/base/mid/com/android/internal/policy/impl/MidWindowManager.javaä¸ãã//mHomeIntent.addCategory(Intent.CATEGORY_HOME);ããæ¹æ mHomeIntent.addCategory(Intent.CATEGORY_HOME_FIRST); //lixinsoããframeworks/policies/base/mid/com/android/internal/policy/impl/RecentApplicationsDialog.javaä¸ãã//new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME),源码0);ããæ¹æ new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME_FIRST),0); //lixinsoããframeworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.javaä¸ãã//mHomeIntent.addCategory(Intent.CATEGORY_HOME);ããæ¹æ mHomeIntent.addCategory(Intent.CATEGORY_HOME_FIRST); //lixinsoããframeworks/policies/base/phone/com/android/internal/policy/impl/RecentApplicationsDialog.javaä¸ãã//ResolveInfo homeInfo = pm.resolveActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME),0);ããæ¹æ ResolveInfo homeInfo = pm.resolveActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME_FIRST),0); //lixinsoãã4) åä¸ä¸ªèªå·±çLauncher.ããå¯ä»¥åèandroid sampleä¸çLauncherï¼æè androidæºä»£ç ä¸ç /packages/apps/Launcher æ¥åãããå¨Launcherä¸æ è®°å ¶æ¯ä¸æ¯Launcherçæå ³é®ç代ç æ¶Manifestä¸çfilter:android:name="android.intent.category.HOME"ããç°å¨æ们å®ä¹äºèªå·±çfilter,é£ä¹ï¼æ们å¨æ们èªå·±åçLauncherä¸å°Manifestæ¹ä¸ºï¼ãã<application android:process="android.process.acore3" android:icon="@drawable/icon" android:label="@string/app_name">ãã<activity android:name=".FirstAppActivity"ããandroid:label="@string/app_name">ãã<intent-filter>ãã<action android:name="android.intent.action.MAIN" />ãã<category android:name="android.intent.category.HOME_FIRST" />ãã<category android:name="android.intent.category.DEFAULT" />ãã<category android:name="android.intent.category.MONKEY" />ãã</intent-filter>ãã</activity>ãã</application>ããç¶åå°ç¼è¯å¥½çapkæ¾å°/out/target/product/generic/system/appç®å½ä¸ããã5)å°Androidèªå¸¦çLauncherå é¤æï¼å æ¬æºä»£ç (packages/apps/Launcher)åapk(/out/target/product/generic/system/app/Launcher.apk)ããã6)ããåå®è¿äºå·¥ä½ï¼å°±å¯ä»¥éæ°ç¼è¯Androidäºï¼æ们å¯ä»¥ç¼è¯ä¿®æ¹è¿çå 个ç¸å ³çå ãããå¦æä¹åç¼è¯è¿äºAndroidæºç ï¼å¯ä»¥ç¨mmmå½ä»¤æ¥ç¼è¯é¨åçæ¹å¨ãããè¿ééè¦è¿æ ·ç¼è¯ï¼ãã$ . build/envsetup.shãã$ mmm frameworks/baseãã$ mmm frameworks/base/services/javaãã$ mmm frameworks/policies/base/midãã$ mmm frameworks/policies/base/phoneãã7)ããç¼è¯å®æåéæ°çæimgæ件ããã$ make snodãã8) ç°å¨å¯ä»¥å¯å¨Android模æå¨æ¥çææäºãããé¦å 设置ç¯å¢åéï¼ãã$ export ANDROID_PRODUCT_OUT= ./out/target/product/genericããç¶ååæ¢å°ãã$ cd ./out/host/linux-x/binããè¿è¡ãã$ ./emulatorããè¿æ ·æ们å¯å¨ç模æå¨éé¢ç¨çimageå°±æ¯æ们åæç¼è¯å¥½çèªå·±å®å¶çä¸è¥¿äºãããä»æ¨¡æå¨ä¸å¯ä»¥çå°å¯å¨çLauncheræ¯æ们èªå·±çLauncherï¼ä¸ä¼åºç°é»è®¤çLauncheräºï¼ä¹ä¸ä¼åºç°éæ©çé¢ã
Ubuntu下Qt如何使用openCV库
我在网上查找安装方法时有两种方式,第一种方案在第三步测试的源码时候没有成功,不知道问题出在哪里,源码换用了第二种方式。源码如果直接用第二种方式安装不成功,源码腾讯新闻app源码可以试试进行第一种方式的源码cloneset 源码第2步。
安装环境是源码Ubuntu .,内核版本2.6..。源码OpenCV版本为2.4.3。源码
第一种方式,源码参考org.cn/index.php/Debian%E4%B8%8B%E5%AE%%E8%A3%
1.更新下载更新软件包列表信息
$ apt-get update
2.查询OpenCV相关软件包
查询获得的源码内容和OpenCV软件包版本有关
复制代码
$ apt-cache search opencv
libcv-dev - development files for libcv
libcv4 - computer vision library
libcvaux-dev - development files for libcvaux
libcvaux4 - computer vision extension library
libhighgui-dev - development files for libhighgui
libhighgui4 - computer vision GUI library
opencv-doc - OpenCV documentation and examples
python-opencv - Python bindings for the computer vision library
harpia - Image Processing/Computer Vision Automatic Prgm. Tool
复制代码
3.测试
进入软件目录/sample/cpp,执行以下命令
g++ `pkg-config opencv --libs --cflags opencv` drawing.cpp -o drawing
成功编译并能执行表示安装成功。
第二种方式,源码OpenCV 2.4.3同样适用,源码linuxtop源码参考自/Linux/-/.htm
1.安装必要的源码依赖包
这一步我略去了,因为原文中提到的源码ffmepg1我并不需要安装,并且我是从第一种方式转过来的,就没有安装这些包,kombu源码不过还是列在下面:
sudo apt-get install build-essential libgtk2.0-dev l www.hbbz.com ibjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
2.安装OpenCV
(1)下载OpenCV 2.4.3 /projects/opencvlibrary/
(2) tar -xvf OpenCV-2.4.3.tar.bz2
(3)将其复制到 “ home/你的计算机名/”下;
(4)cd OpenCV-2.4.3
(5)mkdir release
(6)cd release
(7)
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_TBB=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
如果没有cmake,apt-get install就行
(8) make
(9)sudo make install
3.添加库的路径
(1)sudo gedit /etc/ld.so.conf.d/opencv.conf
文件可能需要创建,添加下面内容并保存
/usr/local/lib
(2)sudo ldconfig
(3) sudo gedit /etc/environment
添加下面内容
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
这时,再回到OpenCV-2.4.3/sample/cpp下时,datapipeline源码用第一种方式的测试方法,drawing.cpp文件就能正确编译,而且也可以通过生成的文件看到效果了。
.1.6更新:QT调用openCV库(ixunjishu/qianrushipeixun/.html)
QT的安装过程就略去了,注意需要QT设计器和QTcreator,前者我是下源码编译的,后者用软件中心装的。
配置QT, sudo gedit /usr/share/qt4/mkspecs/default/qmake.conf
在文件内添加了下面两句:
QMAKE_INCDIR = /usr/include/opencv
QMAKE_LIBS = -lcvaux -lcv -lcxcore -lhighgui -lml
实例程序,创建一个QT4 Console Application,代码如下:
复制代码
#include <cv.h>
#include <highgui.h>
int main()
{
IplImage *img = 0;
img = cvLoadImage("Lena.bmp",-1);//Lena.bmp在所建工程的目录下
cvNamedWindow("lena", 1);
cvShowImage("lena", img);
cvWaitKey(0);
return 0;
}
复制代码
关键的一步,在工程的.pro文件添加下面的内容:
复制代码
INCLUDEPATH += /usr/include/opencv
LIBS += /usr/lib/libcv.so \
/usr/lib/libcvaux.so \
/usr/lib/libcxcore.so \
/usr/lib/libhighgui.so \
/usr/lib/libml.so
复制代码
这时就能编译运行了。