树莓派rock PI S 编译libjpeg
jpeglib下载地址:http://www.ijg.org/
下载
jpegsrc.v9d.tar.gz
wbyq@wbyq:~/work_pc$ cd jpeg-9d/ wbyq@wbyq:~/work_pc/jpeg-9d$ ./configure wbyq@wbyq:~/work_pc/jpeg-9d$ make wbyq@wbyq:~/work_pc/jpeg-9d$ sudo make install [sudo] wbyq 的密码: make[1]: 进入目录“/home/wbyq/work_pc/jpeg-9d” /bin/mkdir -p '/usr/local/lib' /bin/bash ./libtool --mode=install /usr/bin/install -c libjpeg.la '/usr/local/lib' libtool: install: /usr/bin/install -c .libs/libjpeg.so.9.4.0 /usr/local/lib/libjpeg.so.9.4.0 libtool: install: (cd /usr/local/lib && { ln -s -f libjpeg.so.9.4.0 libjpeg.so.9 || { rm -f libjpeg.so.9 && ln -s libjpeg.so.9.4.0 libjpeg.so.9; }; }) libtool: install: (cd /usr/local/lib && { ln -s -f libjpeg.so.9.4.0 libjpeg.so || { rm -f libjpeg.so && ln -s libjpeg.so.9.4.0 libjpeg.so; }; }) libtool: install: /usr/bin/install -c .libs/libjpeg.lai /usr/local/lib/libjpeg.la libtool: install: /usr/bin/install -c .libs/libjpeg.a /usr/local/lib/libjpeg.a libtool: install: chmod 644 /usr/local/lib/libjpeg.a libtool: install: ranlib /usr/local/lib/libjpeg.a libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /usr/local/lib ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/lib If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the '-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the 'LD_RUN_PATH' environment variable during linking - use the '-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to '/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- /bin/mkdir -p '/usr/local/bin' /bin/bash ./libtool --mode=install /usr/bin/install -c cjpeg djpeg jpegtran rdjpgcom wrjpgcom '/usr/local/bin' libtool: install: /usr/bin/install -c .libs/cjpeg /usr/local/bin/cjpeg libtool: install: /usr/bin/install -c .libs/djpeg /usr/local/bin/djpeg libtool: install: /usr/bin/install -c .libs/jpegtran /usr/local/bin/jpegtran libtool: install: /usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom libtool: install: /usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom /bin/bash /home/wbyq/work_pc/jpeg-9d/install-sh -d /usr/local/include /usr/bin/install -c -m 644 jconfig.h /usr/local/include/jconfig.h /bin/mkdir -p '/usr/local/include' /usr/bin/install -c -m 644 jerror.h jmorecfg.h jpeglib.h '/usr/local/include' /bin/mkdir -p '/usr/local/share/man/man1' /usr/bin/install -c -m 644 cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1 '/usr/local/share/man/man1' /bin/mkdir -p '/usr/local/lib/pkgconfig' /usr/bin/install -c -m 644 libjpeg.pc '/usr/local/lib/pkgconfig' make[1]: 离开目录“/home/wbyq/work_pc/jpeg-9d”
编译时需要注意 如果
gcc video_app.c yuv_to_jpeg.c -o app -ljpeg
编译成功后,运行app时出现
Wrong JPEG library version: library is 62, caller expects 90
说明系统中有两个版本的libjpeg库,笔者这里可能是opencv的导致的。
所以将编译改成这样,查找指定的lib 路径
gcc video_app.c yuv_to_jpg.c -o app /usr/local/lib/libjpeg.so
/usbcam_jpeg $ ./app /dev/video1 摄像头打开成功. 当前摄像头支持输出的图像格式如下: <'YUYV'--'YUYV 4:2:2'> 摄像头实际输出的图像尺寸:x=1280,y=1024 当前摄像头支持YUV格式图像输出! 设置当前摄像头采集帧率: 1秒30帧 当前摄像头实际采集帧率: 2秒15帧 摄像头缓冲区申请的数量: 4 VideoDeviceInit=0 image_buffer[0]=76B4D000 图片名称:0.jpg,字节大小:62570 image_buffer[1]=768CD000 图片名称:1.jpg,字节大小:66057 image_buffer[2]=7664D000 图片名称:2.jpg,字节大小:69249 image_buffer[3]=763CD000 图片名称:3.jpg,字节大小:69249 image_buffer[0]=76B4D000 图片名称:4.jpg,字节大小:69249 image_buffer[1]=768CD000 图片名称:5.jpg,字节大小:70668 image_buffer[2]=7664D000 图片名称:6.jpg,字节大小:68325 image_buffer[3]=763CD000 图片名称:7.jpg,字节大小:68325 image_buffer[0]=76B4D000 图片名称:8.jpg,字节大小:68325 image_buffer[1]=768CD000 图片名称:9.jpg,字节大小:69971 image_buffer[2]=7664D000 图片名称:10.jpg,字节大小:68604 image_buffer[3]=763CD000 图片名称:11.jpg,字节大小:68604 image_buffer[0]=76B4D000 图片名称:12.jpg,字节大小:68604 image_buffer[1]=768CD000 图片名称:13.jpg,字节大小:73135 image_buffer[2]=7664D000
不再报错。
源码下载地址
[lv]
链接:https://pan.baidu.com/s/1zHJlNwOeKdQ8cZH7bIpXBw 提取码:uvjx [/lv]