Compared with dm3730, the A8 end recognition is indeed faster, but the goal is to use the dm8148 DSP end. The next step is to accelerate the DSP recognition. Dm8148 is a vehicle-mounted platform for Automotive Electronics. It can be used for Intelligent Instrument panoramic parking pedestrian recognition.
Main Program:
/***** Zoushiwen, gxut, Guangxi Institute of Technology, qq406460538 ***** // *****/extern "C" {# include <stdio. h> # include <string. h> # include <fcntl. h> # include <unistd. h> # include <stdint. h> # include <stdlib. h> # include <errno. h> # include <getopt. h> # include <sys/IOCTL. h> # include <sys/Mman. h> # include <sys/select. h> # include <sys/time. h> # include <Linux/FB. h> # include <Linux/videodev. h >}# include "opencv/highgui. H "# include" opencv/cv. H "# include" opencv/cxcore. H "# include" opencv/cvaux. H "# include" video_cap.h "# include" displayfb. H "# include" objdetect. H "int main (INT argc, char ** argv) {// declare iplimage pointer iplimage * pimg = NULL; iplimage * pcannyimg = NULL; iplimage * pgrayimg = NULL; iplimage * imagecolor = NULL; int width = 640; int Height = 480; videodevice * m_pvideodev = new videodevice (width, height); cdisplayfb * m_pdisplay = new cdisplayfb; cobjdetect * m_pobjdetect = new cobjdetect; /**************************** open capture ******** * ***************************/int rs; int index; unsigned char * PP; unsigned char * P; unsigned int Len; pp = (unsigned char *) malloc (width * height * 2 * sizeof (char )); rs = m_pvideodev-> opencamera ("/dev/video0"); If (RS <0) {printf ("error in opening camera device \ n"); Return Rs ;} /**************************** open capture end ******* * *********************** // * Open the display driver. */int ret; ret = m_pdisplay-> initfb ("/dev/fb0", width, height); If (Ret <0) {printf ("error in opening display device for Channel 0 \ n"); return ret;}/* Open Display end */imagecolor = cvcreateimage (cvsize (width, height ), ipl_depth_8u, 3); // initial the objdetect m_pobjdetect-> initdetect ("detect"); For (;) {Index = m_pvideodev-> get_frame (void **) & P, & Len); m_pvideodev-> yuvtorgb24_n (unsigned char *) P, (unsigned char *) imagecolor-> imagedata, width, height ); // m_pobjdetect-> detect_and_draw (imagecolor, 2.3, 1.5, 2.0); m_pdisplay-> copyimagetofb (unsigned char *) imagecolor-> imagedata, width, height ); rs = m_pvideodev-> unget_frame (); // ussleep (300000);} end: rs = m_pvideodev-> stop_capturing (); RS = m_pvideodev-> uninit_device (); rs = m_pvideodev-> close_device (); cvreleaseimage (& imagecolor); free (PP); m_pdisplay-> exitfb (); Delete [] m_pvideodev; Delete [] m_pdisplay; delete [] m_pobjdetect; Return-1 ;}
Makefile is as follows:
#LIB = -L/usr/lib/mysql -lmysqlclient -L./ -lcfg#INCLUDE = -I/usr/include/mysql #LIB = -L/home/omap/omap3530/dvsdk/dvsdk_3_00_02_44/linuxlibs/lib -ljpeg#INCLUDE = -I/home/omap/omap3530/dvsdk/dvsdk_3_00_02_44/linuxlibs/include#LIB = -L/home/omap/lib -ljpeg#INCLUDE = -I/home/omap/work/opencv/build/include#ROOTDIR = .KERNEL_DIR =/opt/DM8148/ezsdk/board-support/linux-2.6.37-psp04.04.00.01#This is root directory where Source is available. Change this path#to the one where source files are keptINSTALL_DIR = ./#this is the path to the executable where all the executables are keptEXE_DIR = ./bin#This is path to the Include files of Library#LIB_INC = $(INSTALL_DIR)/User_Library#This is the path the include folder of the kernel directory. The include#folder should contain all the necessary header filesINCLUDE_DIR = $(KERNEL_DIR)/include -I$(KERNEL_DIR)/arch/arm/include/ -I$(KERNEL_DIR)/arch/arm/plat-omap/include/#This is the prefix applied to the gcc when compiling applications and libraryCOMPILER_PREFIX = arm-none-linux-gnueabiCROSS_COMPILE = $(COMPILER_PREFIX)-#This is the toolchain base folder#TOOLCHAIN_DIR = /opt/codesourcery/2009q1-203TOOLCHAIN_DIR = /opt/DM8148/arm-2009q1#add cflagsCPPFLAGS += -march=armv7-a -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfpCPPFLAGS += -I$(TOOLCHAIN_DIR)/$(COMPILER_PREFIX)/libc/usr/include -I$(KERNEL_DIR)#Libc pathLDFLAGS="-isystem $(TOOLCHAIN_DIR)/$(COMPILER_PREFIX)/libc/lib"#This is the path to the Directory containing LibraryLIB_DIR = $(TOOLCHAIN_DIR)/$(COMPILER_PREFIX)/libc/libCFLAGS = -g -Os \-march=armv7-a \-fno-strict-aliasing \-fno-common \-ffixed-r8 \-msoft-float \-I$(INCLUDE_DIR) \-pipe \-mno-thumb-interwork \-Wall \-Wstrict-prototypes \-fno-stack-protector \ -D__EXPORTED_HEADERS__#LDFLAGS = -L/opt/codesourcery/arm-none-linux-gnueabi/libc/libLDFLAGS = -L/opt/DM8148/arm-2009q1/arm-none-linux-gnueabi/libc/libLIBS := -lpthread## Platform specific options#CFLAGS += -DCONFIG_TI81XX#$(CROSS_COMPILE)gcc $(CFLAGS) $(LDFLAGS) $(LIBS) -o $@ $(addsuffix .c,${@F})#CC =/opt/DM8148/arm-2009q1/bin/arm-none-linux-gnueabi-gccOPENCV2_2_INCLUDE_FILE=/opt/DM8148/opencv/opencv8148/include/OPENCV2_2_LIB_FILE=/opt/DM8148/opencv/opencv8148/libINCLUDE=-I$(OPENCV2_2_INCLUDE_FILE)LIB+=-L$(OPENCV2_2_LIB_FILE) -lopencv_core -lopencv_ml -lopencv_highgui -lopencv_objdetect -lopencv_imgprocCPPFLAG=-Wall -O2 -g -I$(OPENCV2_2_INCLUDE_FILE)TARGET = exeSRC = $(wildcard *.cpp *.o)OBJ = $(patsubst %.cpp, %.o, $(SRC))%.o : %.c, %.h$(CROSS_COMPILE)gcc -c $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBS) $< -o $@%.o : %.cpp$(CROSS_COMPILE)gcc -c $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBS) $< -o $@$(TARGET) : $(OBJ)$(CROSS_COMPILE)gcc $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBS) $^ -o $@ $(INCLUDE) $(LIB).PHONY: cleanclean:$(RM) $(TARGET) $(OBJ)