/************************************************************************* * I.MX6 Python3 OpenCV * 说明: * 移植一下OpenCV,看一下图像处理效果,目前感觉还行了,应该是不错的了。 * * 2017-2-14 深圳 南山平山村 曾剑锋 ************************************************************************/ 一、 参考文档: 1. OpenCV Python教程(1、图像的载入、显示和保存) http://blog.csdn.net/sunny2038/article/details/9057415 二、图片获取、处理: [zengjf@root ~] # python Python 3.5.2 (default, Jan 11 2017, 02:27:29) [GCC 4.8.3 20140320 (prerelease)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 as cv Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'cv2' [zengjf@root ~] # find / -iname cv2* /usr/lib/python3.5/site-packages/cv2.cpython-35m-x86_64-linux-gnu.so [zengjf@root ~] # mv /usr/lib/python3.5/site-packages/cv2.cpython-35m-x86_64-linux-gnu.so /usr/lib/python3.5/site-packages/cv2.so [zengjf@root ~] # fswebcam -d /dev/video1 --no-banner -r 640x480 zengjf.jpg --- Opening /dev/video1... Trying source module v4l2... /dev/video1 opened. No input was specified, using the first. --- Capturing frame... Captured frame in 0.00 seconds. --- Processing captured image... Disabling banner. Writing JPEG image to 'zengjf.jpg'. [zengjf@root ~] # python Python 3.5.2 (default, Jan 11 2017, 02:27:29) [GCC 4.8.3 20140320 (prerelease)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '3.1.0' >>> img = cv2.imread("./zengjf.jpg") >>> cv2.imwrite("./zengjf1.jpg", img, [int(cv2.IMWRITE_JPEG_QUALITY), 5]) True >>> quit()