BeagleBoard and OpenCV
- 格式:docx
- 大小:37.50 KB
- 文档页数:19
opencv金字塔构建buildpyramid源码解读(原创实用版)目录1.OpenCV 简介2.图像金字塔的概念3.OpenCV 构建图像金字塔的方法4.构建图像金字塔的代码实例5.总结正文1.OpenCV 简介OpenCV(Open Source Computer Vision Library)是一个开源的计算机视觉库,它包含了大量的图像处理和计算机视觉方面的算法。
OpenCV 的主要目的是提供一组通用的图像处理和计算机视觉算法,以便开发人员能够更加方便地实现图像处理和计算机视觉方面的功能。
2.图像金字塔的概念图像金字塔是一种多尺度表示方法,它包含了一组不同分辨率的图像。
这些图像都是通过对原始图像进行不同程度的降采样和上采样得到的。
图像金字塔在计算机视觉领域中有着广泛的应用,例如目标检测、图像分割和图像融合等。
3.OpenCV 构建图像金字塔的方法OpenCV 提供了一系列的函数来构建图像金字塔,其中最主要的函数是 pyrUp() 和 pyrDown()。
pyrUp() 函数用于向上采样,它可以将一幅图像放大到更高的分辨率。
pyrUp() 函数的原理是对原始图像进行上采样,然后通过插值方法得到更高分辨率的图像。
pyrDown() 函数用于向下采样,它可以将一幅图像缩小到更低的分辨率。
pyrDown() 函数的原理是对原始图像进行下采样,然后通过插值方法得到更低分辨率的图像。
4.构建图像金字塔的代码实例以下是一个使用 OpenCV 构建图像金字塔的代码实例:```pythonimport cv2# 读取原始图像img = cv2.imread("original_image.jpg")# 创建一个高斯金字塔gauss_pyr = cv2.pyrUp(img)# 创建一个拉普拉斯金字塔laplacian_pyr = cv2.pyrDown(gauss_pyr)# 显示原始图像和金字塔cv2.imshow("Original Image", img)cv2.imshow("Gaussian Pyramid", gauss_pyr)cv2.imshow("Laplacian Pyramid", laplacian_pyr)# 等待按键,然后关闭窗口cv2.waitKey(0)cv2.destroyAllWindows()```5.总结OpenCV 提供了一种方便的方式来构建图像金字塔,通过使用 pyrUp() 和 pyrDown() 函数,可以轻松地实现图像的放大和缩小。
opencv 4计算机视觉应用程序编程手册OpenCV 4计算机视觉应用程序编程手册一、OpenCV 4简介与安装OpenCV(Open Source Computer Vision Library)是一款开源的计算机视觉库,广泛应用于图像处理、视频分析、特征提取、目标检测等领域。
OpenCV 4在性能和功能上均有显著提升,支持Python、C++等多种编程语言。
本手册将带领读者了解OpenCV 4的基本概念,并在各种平台上安装使用。
二、计算机视觉基础概念与原理计算机视觉是一门研究如何让计算机从图像或视频中获取有意义信息的科学。
其主要任务包括图像处理、特征提取、目标检测、目标跟踪等。
在本章节中,我们将学习计算机视觉的基本概念和原理,为后续的实际项目打下基础。
三、图像处理与分析图像处理是计算机视觉的核心任务之一,主要包括图像读取、显示、存储、滤波、边缘检测等操作。
在本章节中,我们将学习OpenCV 4中常用的图像处理函数,并了解其应用场景。
四、特征提取与匹配特征提取是计算机视觉中关键的一环,旨在从图像中提取具有代表性的特征点。
常见的特征提取算法有SIFT、SURF、ORB等。
特征匹配则是寻找两幅图像中对应的特征点,常用的方法有暴力匹配、FLANN等。
在本章节中,我们将学习这些算法的原理及使用方法。
五、目标检测与跟踪目标检测是在图像或视频中查找特定目标的过程,常用的算法有R-CNN、Fast R-CNN、Faster R-CNN、SSD、YOLO等。
目标跟踪则是跟踪目标在连续帧中的位置,常用的方法有TLD、KCF等。
在本章节中,我们将学习这些目标检测与跟踪算法的原理及实现。
六、3D建模与增强现实3D建模是将二维图像转换为三维模型的一种技术,常用的工具有Open3D、Maya等。
增强现实则是将虚拟物体叠加到真实场景中,常用的框架有ARCore、ARKit等。
在本章节中,我们将学习3D建模与增强现实的基本原理及应用。
opencv国外博文摘要:1.OpenCV 简介2.OpenCV 在国外的发展3.OpenCV 的功能与应用4.OpenCV 国外博客的参考价值正文:1.OpenCV 简介OpenCV(Open Source Computer Vision Library)是一个开源的计算机视觉和机器学习软件库,它包含了大量的图像处理、视频分析和特征提取等算法。
OpenCV 的目的是为人工智能、机器视觉和计算机视觉等领域的研究人员和开发者提供一个通用且高效的平台。
2.OpenCV 在国外的发展OpenCV 自1999 年成立以来,得到了全球范围内许多研究人员和开发者的支持。
目前,OpenCV 已经成为了计算机视觉领域的事实标准,被广泛应用于各种国际性的项目和产品中。
在国外,OpenCV 同样具有广泛的影响力和关注度,许多知名的技术博客、媒体和社区都对其进行过详细的介绍和讨论。
3.OpenCV 的功能与应用OpenCV 的功能涵盖了计算机视觉的各个方面,包括图像处理、目标检测、人脸识别、手势识别、视频分析等。
OpenCV 提供了丰富的API 和库,使得开发者可以方便地在自己的项目中使用这些功能。
在国外,OpenCV 被广泛应用于安全监控、自动驾驶、无人机、医疗诊断、人机交互等领域。
4.OpenCV 国外博客的参考价值对于国内开发者来说,参考国外的OpenCV 博客可以了解到最新的技术发展动态,学习到一些新的算法和应用案例。
同时,这些博客也为国内开发者提供了一个了解国外计算机视觉领域研究方向和思路的窗口。
通过阅读这些博客,可以提高自己的技术水平,拓宽视野,为自己的项目和研究提供更多的灵感和启发。
综上所述,OpenCV 在国外的发展和应用已经取得了显著的成果,它的功能和应用领域也在不断拓展。
摘要图像处理技术,可以使模糊甚至不可见的图像变得清晰明亮。
另一方面,通过数字图像处理中的模式识别技术,可以将人眼无法识别的图像进行分类处理。
Open CV 是近年来推出的开源、免费的计算机视觉库,利用其所包含的函数可以很方便地实现数字图像处理。
同时利用面向对象的VC++ 6.0编程工具,用C++语言进行程序编写,大大提高了计算机的运行速度。
这次课程设计主要是了解和熟悉OpenCV的运用,并与VC++结合,用MFC建立一个单文档程序,识别一些电路板上的焊点,系统要实现图片的检测,然后利用阈值分割等方法识别了各种电路板上的焊点。
我们也可以先确定“感兴趣”的区域,再在这个区域之中进行识别,从而能够得到焊点的中心坐标。
关键词:Open CV;图像处理;VC++;焊点识别。
AbstractWith image processing technology, we can make blurred or even non-visible image become clear and bright. On the other hand, by pattern recognition technology in the digital image processing, the images which the human eyes cannot recognize can be classified. Open CV which is open and free computer vision library has developed in recent years. We can easily carry out digital image processing by making use of its functions. C++ programs compiled in the VC++ 6.0 greatly improve the rate of the computer. This design is mainly to understand and be familiar with the use of Open CV combined with VC + +.We use MFC to create a single document procedure to identify the solder joints of some circuit boards. We should achieve the function of the detection of the picture, and then we use the threshold segmentation method to identify solder joints of a variety of circuit boards. We can also determine the "interested" region, and we can identify in this area, so that we can get solder joints’center coordinates.Keywords:Open CV;image processing;VC++;Solder joints recognition第一章课题背景(或绪论、概述)1.1 OpenCV简介OpenCV是Intel开源计算机视觉库。
opencv 双目标定例子OpenCV双目标定的一个例子通常涉及使用棋盘格标定板来获取两个相机的内参(内部参数)和外参(外部参数),以及它们之间的相对位置关系。
以下是一个简化的OpenCV双目标定的步骤和示例代码:准备标定板:制作一个带有黑白棋格图案的标定板,通常棋盘格的角点数已知(如8x6)。
拍摄标定板图片:使用两个相机,从多个角度和位置拍摄标定板的照片,确保标定板在照片中清晰可见。
提取角点:使用OpenCV函数findChessboardCorners来检测棋盘格的角点。
标定相机:使用calibrateCamera函数对单个相机进行标定,得到内参和外参。
立体标定:使用stereoCalibrate函数进行双目标定,得到两个相机之间的相对位置关系(旋转矩阵R和平移向量T)。
验证标定结果:通过重投影误差来评估标定结果的准确性。
下面是一个简化的OpenCV双目标定的代码示例:pythonimport numpy as npimport cv2import glob# 设置棋盘格的角点数和尺寸board_size = (6, 9) # 棋盘格角点数(x, y)square_size = 1.0 # 棋盘格每个小格子的实际尺寸(单位:米)# 储存3D世界坐标和2D图像坐标objpoints = [] # 在世界坐标系中的3D点imgpoints_left = [] # 在左相机图像平面上的2D点imgpoints_right = [] # 在右相机图像平面上的2D点# 读取标定板图片images_left = glob.glob('left/*.jpg')images_right = glob.glob('right/*.jpg')for fname_left, fname_right in zip(images_left, images_right): img_left = cv2.imread(fname_left)img_right = cv2.imread(fname_right)gray_left = cv2.cvtColor(img_left, cv2.COLOR_BGR2GRAY)gray_right = cv2.cvtColor(img_right, cv2.COLOR_BGR2GRAY)# 提取棋盘格角点ret_left, corners_left = cv2.findChessboardCorners(gray_left, board_size, None)ret_right, corners_right = cv2.findChessboardCorners(gray_right, board_size, None)if ret_left and ret_right:objpoints.append(np.zeros((np.prod(board_size), 3), dtype=np.float32)objpoints[-1][:, :2] = np.mgrid[0:board_size[0], 0:board_size[1]].T.reshape(-1, 2) * square_sizeimgpoints_left.append(corners_left)imgpoints_right.append(corners_right)# 标定相机ret_left, mtx_left, dist_left, rvecs_left, tvecs_left = cv2.calibrateCamera(objpoints, imgpoints_left, gray_left.shape[::-1], None, None)ret_right, mtx_right, dist_right, rvecs_right, tvecs_right = cv2.calibrateCamera(objpoints, imgpoints_right, gray_right.shape[::-1], None, None)# 立体标定flags = 0Flags |= cv2.CALIB_FIX_INTRINSICret, mtx_left, mtx_right, dist_left, dist_right, R, T, E, F = cv2.stereoCalibrate(objpoints, imgpoints_left, imgpoints_right, mtx_left, dist_left, mtx_right, dist_right, gray_left.shape[::-1], Flags=Flags)# 验证标定结果mean_error = 0for i in range(len(objpoints)):imgpoints_left_2, imgpoints_right_2 = cv2.projectPoints(objpoints[i], R, T, mtx_left, dist_left, mtx_right, dist_right)error = cv2.norm(imgpoints_left[i], imgpoints_left_2, cv2.NORM_L2) / len(imgpoints_left[i])error += cv2.norm(imgpoints_right[i。
opencv 标定板内参及选点OpenCV是一个广泛使用的计算机视觉库,提供了一系列用于图像处理和计算机视觉的函数和算法。
其中一个重要的功能是相机标定,也就是通过对已知的标定板进行图像处理,得到相机的内参和畸变参数。
本文将介绍如何使用OpenCV进行相机标定,并讲解选取标定板的注意事项。
相机标定是计算机视觉中的重要步骤,它的目的是通过对已知几何形状的标定板进行图像处理,从而计算出相机的内参矩阵和畸变系数。
相机的内参主要包括焦距、主点坐标和像素宽高比等参数,而畸变系数则用于校正图像中的畸变。
相机标定是许多计算机视觉任务的基础,如相机姿态估计、三维重建等。
在OpenCV中,相机标定的函数为`cv2.calibrateCamera()`。
在调用这个函数之前,我们需要准备一个已知几何形状的标定板,并拍摄一组包含标定板的图像。
标定板可以是棋盘格、圆点阵列等,不同的标定板对应不同的标定算法。
选取标定板时,需要注意以下几点。
首先,标定板的几何形状要尽可能规则,以便于计算。
其次,标定板要有足够的对比度,以便于检测。
最后,标定板的大小要适中,不要过大或过小。
对于棋盘格标定板,常见的尺寸为8x6或9x7。
在进行相机标定时,需要提供一组包含标定板的图像。
这些图像应该在不同的角度和位置下拍摄,以覆盖相机的全视场。
为了提高标定的精度,最好使用不同焦距和光照条件下的图像。
在拍摄图像时,要保证标定板平面与相机光轴垂直,以避免透视畸变。
标定图像准备好后,就可以调用`cv2.calibrateCamera()`函数进行相机标定了。
该函数会返回相机的内参矩阵、畸变系数和旋转矩阵等信息。
内参矩阵可以用于计算相机的投影矩阵,而畸变系数可以用于校正图像中的畸变。
除了相机标定函数外,OpenCV还提供了其他相关函数,如`cv2.undistort()`可以用于校正图像中的畸变。
校正后的图像更加真实、准确,有助于提高后续计算机视觉任务的精度。
opencv aprilgrid标定OpenCV是一款开源的计算机视觉库,提供了丰富的图像处理和计算机视觉算法。
其中,AprilGrid是OpenCV中用于相机标定的一种特殊标定板。
本文将介绍AprilGrid标定的原理和使用方法。
相机标定是计算机视觉中一个重要的步骤,它用于确定相机的内部参数(如焦距、主点等)和外部参数(如相机位置和朝向),从而使得图像中的物体能够准确地被测量和分析。
在进行相机标定时,我们需要使用一个已知尺寸的标定板,通过拍摄不同位置和姿态下的图像,从中提取出特征点并计算相机参数。
AprilGrid是一种特殊的标定板,它由一系列黑白相间的方格组成,每个方格都有一个唯一的编码。
这些编码可以被用来检测和识别方格的位置和姿态。
相比于传统的棋盘格标定板,AprilGrid具有更好的鲁棒性和准确性。
AprilGrid的设计基于AprilTag,一种用于物体检测和识别的视觉标记系统。
AprilTag可以通过检测图像中的特定编码来确定物体的位置和姿态。
而AprilGrid则是在AprilTag的基础上进行改进,用于相机标定。
使用AprilGrid进行相机标定的步骤如下:1. 打印AprilGrid标定板,并粘贴在平整的表面上。
2. 使用相机拍摄多张包含AprilGrid标定板的图像,确保标定板在图像中有足够的视角变化。
3. 使用OpenCV中的函数对图像进行处理,提取出AprilGrid标定板的角点。
4. 根据提取到的角点,计算相机的内部参数和外部参数。
在实际使用AprilGrid进行相机标定时,我们需要注意以下几点:1. 标定板的尺寸应该足够大,并且要覆盖整个图像区域,以确保提取到足够多的角点。
2. 拍摄图像时要注意光照条件的一致性,避免过暗或过亮的环境。
3. 在提取角点时,可以使用OpenCV中的函数来自动检测,也可以手动标注。
相机标定是计算机视觉中的一个基础任务,它对于图像处理、目标检测和三维重建等应用都是非常重要的。
opencv板料定位的实现流程下载温馨提示:该文档是我店铺精心编制而成,希望大家下载以后,能够帮助大家解决实际的问题。
文档下载后可定制随意修改,请根据实际需要进行相应的调整和使用,谢谢!并且,本店铺为大家提供各种各样类型的实用资料,如教育随笔、日记赏析、句子摘抄、古诗大全、经典美文、话题作文、工作总结、词语解析、文案摘录、其他资料等等,如想了解不同资料格式和写法,敬请关注!Download tips: This document is carefully compiled by theeditor.I hope that after you download them,they can help yousolve practical problems. The document can be customized andmodified after downloading,please adjust and use it according toactual needs, thank you!In addition, our shop provides you with various types ofpractical materials,such as educational essays, diaryappreciation,sentence excerpts,ancient poems,classic articles,topic composition,work summary,word parsing,copy excerpts,other materials and so on,want to know different data formats andwriting methods,please pay attention!OpenCV在板料定位中的实现流程详解OpenCV,全称Open Source Computer Vision Library,是一个开源的计算机视觉库,包含了大量的图像和视频处理功能。
Beagle BoardFrom HBRC WikiJump to: navigation, search--Beagle board 12:25, 29 August 2008 (PDT)Contents[hide]∙ 1 A tutorial on setting up a system to do image processing with a BeagleBoard∙ 2 Why choose the BeagleBoard and OpenCV?∙ 3 History: why this Wiki page?∙ 4 Members who are/will be using the BeagleBoard and OpenCV∙ 5 using the BB as a 'device' versus as a 'host'∙ 6 what gets connected to your BB∙7 about webcams∙8 1) TUTORIAL: What to buy∙9 2) TUTORIAL: Installing Linux∙10 3) TUTORIAL: Talking to a webcam∙11 4) TUTORIAL: Programming OpenCV on the BeagleBoard∙12 Using the BeagleBoard's DSP for vision processingA tutorial on setting up a system to do image processing with a BeagleBoardThis wiki page will primarily act as a short cookbook on how to set up a system to do image processing with a BeagleBoard; following this tutorial/cookbook, you should have OpenCV routines running on about $250 worth of hardware. The HBRC has/will have a separate site for working with OpenCV.Why choose the BeagleBoard and OpenCV?Here are Nathan's slides from the November 19, 2008 HBRC meeting [1]And a video by TI showing the BEagleBoard used in a home environment [2]Up until now vision processing has required a specialized system, like the CMUcam3, or a large, power hungry PC. Specialized hardware, like the CMUcam3, have a market that is many orders of magnitude smaller than consumer devices, so they tend to be expensive and don't have much developer community support. PCs are cheap, but with Windows there is no simple way to get at data from a WebCam without using a Microsoft development environment(which is very powerful, but has a learning curve).The BeagleBoard has a OMAP3530 processor from TI, which is intended for the cell phone market. The cell phone market is billions/year, much much larger than the PC market. So there will be (already is!) a huge developer community growing around this chip. These latest cell phone chips support implementing full PC functionality. This means a robot based on a BeagleBoard can use the existing software infrastructure, including the Web.The BeagleBoard is 3"x3" and uses less than 2 watts, so its form factor and energy consumption is close to what members already have on their robots.Finally, the OMAP3530 has a DSP on it, which could be dedicated to vision processing, freeing developers from worrying about multiple processes competing for CPU cycles.There at many (>7) HBRC members who have played with OpenCV (ie Open Computer Vision). Everyone is impressed. The OpenCV libraries are comprehensive. O'Reilly has released 'Learning OpenCV', which provides and excellant overview of OpenCV. The Jan - May 2007 issues of Servo have a series of short articles, by Robin Hewitt, about using using OpenCV. You may see these articles and download the associated code examples on the Cognotics website at/opencv/servo_2007_series/index.html History: why this Wiki page?Nathan Monson showed up at the August 27, 2008 HBRC meeting with the just released BeagleBoard mated to a Quickcam 9000; and was able to process 800x600 YCrCb frames at 25FPS using only 4 watts. There were at least 5 members at the meeting who had played with OpenCV, and it appeared thatseveral attendees will buy a BeagleBoard. This wiki page is intended as a help area for such interested parties.There will be/is a huge number of resources for the BeagleBoard and OpenCV. This page should spare you from having to sift through all of this information. However, if good instructions already exists for something (like Linux installation instructions?), this page will just provide a link.John Slater started this page. If you don't wish to edit this page yourself, e-mail John ('johngslater - gmail') with suggested changes. Please note, if this page grows too large it defeats the original intention of the page.Members who are/will be using the BeagleBoard and OpenCVNathan Monson ---> slides from Nov 19 2008 HBRC talk: [3]John SlaterDave CurtisAlex SyEnrique RuizRalph GnauckKevin Bjorkeusing the BB as a 'device' versus as a 'host'The BB was designed to be compatible with the modern PC infrastructure, where you connect (and often power) most devices with a USB connection. The BB is kept small by having only one USB port. But the USB system was designed so you to connect a USB hub to a USB port, allowing more than one USB device to communicate though this single USB port.In "device mode", the BB to a powered by connecting its USB port to someother USB port which has power (usually a USB port on the PC you want to talk to).Or you can hook the BB to a USB hub. This is the "host mode", and you are now supplying power to other devices. Now you must hook a wallwart or other power source up to the BB.what gets connected to your BBWhen you buy a BB you get a board with a lot of connectors, but no cables.from /BeagleBoard#Components :File:/BeagleBoard/Beagle top notes.pngBecause you are interested in doing computer vision you WILL be hooking a web cam to a USB hub, which is connected to the BB. For the keyboard/mouse/monitor there are a couple of options, a lot of potential confusion about what kind of cables and software you need. But before this gets discussed, you need to know a bit about USB connectors/connections.USB connectors/connectionsI assume everyone is familiar with plugging things in to USB ports.Lets start with some common terminology: A computer 'cable' has 'plug' on one end, and a 'device' or 'plug' on the other end. A device may have 'ports' where you can insert the plug of a cable.As an example, a mouse device has a cable. One end of the mouse's cable is the mouse. On the other end is a plug, which gets inserted into the port of some other device, usually a PC.'Host' USB ports are powered. The amount of power supplied is minimal, but in many cases the power is suffient so a peripheral like a mouse, keyboard, or a USB flash/hard drive does not need batteries or its own power source. In fact, the BB is so energy efficient it can be run as a USB device powered by the USB host port of another device, like a PC.USB ports can be pretty handy, many devices like PCs and portables will advertise how many USB ports they have. Because of the size of the BB, it has only one USB port. However, USB lines can carry more than one signal. So you can always connect a 4 port or 7 port USB hub to a USB port, and then hook up 4 or 7 USB devices to the hub.You might not recognize the BB's USB port because of its small size. The USB connector everyone is familiar with, used on mice, keyboards and USB flash/hard drives, is the Series “A” size. As electronics has become more miniturized, the A plug's dimensions is sometimes too bulky. So other plug dimensions have come into use, like the "mini" size. The BB's USB port is a "mini-A" size, and it is referred to as the 'OTG port'.Here is a look at typical plug ends (from/wiki/USB)File:/wiki/USB/180px-Types-usb svg.pngAlmost all USB hubs have a mini-B port for input. Thus, you need a Mini A Male to Mini B Male cable to hook the BB to a USB hub./scripts/DkSearch/dksus.dll?Detail?name=WM17 494-NDThere is a standard for how much current a USB host port provides. And 'USB devices' need to use less than this amount of power. However, when hooking up to 4 or 7 devices to a USB, the current draw will often exceeed what the USB host can provide. So almost all USB hubs have a little power input where you can hook up a 5V wall-wart.Most USB hubs have A size ports. If the USB device you want to plug in has a smaller plug, make certain you buy a USB hub contains a port with this size, or you will be need to buy an adaptor cable, like this USB Standard-A to Mini-A Adapter:/accessories/access.html?usb-mini&template=basi c.htmlWhen you start chaining things together, it is possible to form a loop. Since the USB cables are powered, this is similiar to shorting theterminals of a battery. So discourage this, the two ends of a USB cable are different. You probably never were concerned about this, because 'the other end' of most USB devices is the device itself, not a USB plug.If you find plug designs interesting, see/wiki/USB#Types_of_USB_connector.The USB port on the BB is actually a OTG port, so depending on the situation, the port can act as a host or a device. from/wiki/USB#Compatibility Two-way communicationis also possible. In general, cables have only plugs, and hosts and devices have only receptacles: hosts having type-A receptacles and devices type-B. Type-A plugs only mate with type-A receptacles, and type-B with type-B. However, an extension to USB called USB On-The-Go allows a single port to act as either a host or a device — chosen by which end of the cable plugs into the socket on the unit. Even after the cable is hooked up and the units are talking, the two units may "swap" ends under program control. This facility targets units such as PDAs where the USB link might connect to a PC's host port as a device in one instance, yet connect as a host itself to a keyboard and mouse device in another instancefrom /BeagleBoard#OTG :The HS USB OTG (OnTheGo) controller on OMAP3 on the BeagleBoard does have support for all the USB 2.0 speeds (LS/FS/HS) and can act as either a host or a gadget/device. The HS USB OTG port is used as the default power input for the BeagleBoard. It is possible to boot the BeagleBoard using this USB port. When using the OTG port in host mode, you must power the BeagleBoard using the +5V power jack. If you connect a USB hub, you'll probably also need external power for the USB hub as well, because according to the Hardware Reference manual the BeagleBoard OTG port only sources 100 mA. This is enough to drive a single low-power device, but probably won't work with multiple devices.also see /wiki/USB_On-The-Gokeyboard/mouse/monitorWe have two basic choices for how to hook a BB up to akeyboard/mouse/monitor. Here I will call these 'native' and 'remote' (those are my words).The native set up uses a monitor or TV which accepts DVI digital input using a HDMI connector. You need a HDMI to DVI-D cable, which is available from Digi-Key (amongst others):/scripts/DkSearch/dksus.dll?Detail?name=WM19 082-NDYour keyboard and mouse are connected to the USB hub, which is in turn connected to the OTG port of the BB.The remote set up uses the keyboard/mouse/monitor of another computer. The BB will communicate with the other computer through either a serial cable or a ethernet connection. These physical connections will be discussed shortly. The communication over this physical connection involves a lot of layers of software. Most of this need not concern you. You do need to know a bit about X-Windows. X-Windows is software that handles IO for the keyboard/mouse/monitor of computers. It is a standard part of most Unix/Linus/BSD systems. Normally you turn on a computer and the display, keyboard, and mouse 'just work'; you could be running on a computer that uses X-Windows and you would not even realize it.But X-Windows is much more flexible. You do not need to hardwire a PC/computer to any particular keyboard/mouse/monitor. The events/IO can be set up to go to another computer's keyboard/mouse/monitor.Your PC needs to have X-Window software installed, like mini-com. The BB will not take over your whole monitor on your PC. You start the X-Window software, which opens up an application window that becomes a virtual monitor. Issuing the proper commands, you connect PC's virtual monitor to the BB. Then the PC's X-Window application's virtual monitor window has focus, mouse and keyboard events are sent to the BB.serial cable and ethernet connectionsCommunciation between the BB and PC can take place via some form of wireless, or cable (ethernet or serial). The X-Window system was designed with ethernet in mind; I am not certain how well it would work over a serial cables.Serial cables are covered at/BeagleBoard#RS232The popularity and availability of faster information exchange systems such as Ethernet made the use of null-modem cables less common. Nowadays, such a cable can still be useful to kernel hackers though, since it allows the user to remotely debug a kernel with a minimum of device drivers and code (a serial driver mainly consists of two FIFO buffers and an interrupt service routine).For Ethernet, you can buy something like a TRENDnet TU-ET100C 10/100Mbps USB to Ethernet Adapter ($10 at Fyrs). The Ethernet Adapter is a USB device by my earlier definition. You hook the USB plug into your USB hub. Then connect a standard Ethernet cable between this Adapter and your PC. ??? if the Ethernet cable is connected to a router, then what?about webcamsYou will need to picking a webcam to be used with the BB Most webcams are/can_be used for video-chat. USB Video Class (UVC for short) is a new compatibility standard for USB 2.0 video-chat cameras. So it is imperative that whatever you buy supports UVC, or you won't find a Linux driver for the camera.Windows Vista and Mac OSX (10.4.9 and up) natively support UVC class video cameras, so ANY UVC based USB cam will (should) Just Work when plugged in, without finding and installing a webcam driver.With Linux your may have to install a UVC driver yourself. Logitech provides a Linux driver [[4]]. I presume installing luvcview does not restrict you to using a Logitech camera. (please confirm!)Logitech had a nice SDK (pre 2006) But they migrated to using a Windows COM object wrapped around their Logitech SDK. Which was bad news for the non-Windows developers. Using the old Logitech SDK, robix produced an API that would serve the needs of people doing robot vision. But they had to give up [[5]]Hopefully, since the UVC is OS agnostic, there should be few(er) problems to put some form of Linux on the BB and start accessing webcam data.Logitech has has forums for drivers, including a separate forum for the GSPCA/SPCA5xx Linux webcam driver series [[6]]. Logitech seems to be on top of these forums, and their engineers often provide tips.The Logitech QuickCam Pro 9000 takes great images and video. But their 'Right Light 2' function may cause low frame-rates in low-lighting conditions, and the camera does native motion blur when there are low frame-rates. 'Right Light 2' can be disabled and we need to find the way to turn off motion blur.Logitech's Autofocus functions are not supported on the Mac for the QuickCam Logitech Pro 9000 [[7]]. We need to see if Autofocus is part of the UVC. However, various drivers are supporting autofocus: 'guvcview has software support for autofocus since SVN revision 194' [[8]] (aug 2008)[[9]] has good information on Linux UVC drivers and tools. Logitech QuickCam Pro 9000 is marked as having questionable support! Logitech has detailed the problems, and workarounds [[10]]. Logitech also has a list of UVC webcams [[11]] that notes which hardware version of the Pro 9000 might have problems. See page 9 of [[12]]. Unfortunately, it the camera does not have a SN on it, and the packaging does not provide a PID.1) TUTORIAL: What to buyBeagleBoard, $150, from Digikey /Logitech QuickCam 9000 Pro, $70Or buy the Quickcam Pro for Notebooks; however, There is also a Quickcam for Notebooks Pro (seriously), that is junk. To avoid confusion and disappointment just buy the Quickcam 9000 Pro, it has the same internals but a different case.A USB 2.0 MINI A TO MINI B cable for connecting to a USB hub (the BB is in "host mode" when you do this: >/scripts/DkSearch/dksus.dll?Detail?name=WM17 494-NDUSB hub, $14, from FrysPOWER choices:5V wallwart2-AA battery power supply( /hardware mentions/scripts/DkSearch/dksus.dll?Detail?name=N321 -ND )use a powered USB port on another device, like a PC, using a standard Male-A to Mini-B cable for this.(You probably have 10 of them at home already.) This is the "device mode". serial cableorTRENDnet TU-ET100C 10/100Mbps USB to Ethernet Adapter/product/4434796?site=sr:SEARCH:MAIN_RSLT_PGand a standard Ethernet cable2) TUTORIAL: Installing LinuxThe TI-designed Linux BSP (board support package) and development libraries include∙U-boot bootloader∙ 2.6.22 kernel∙peripheral drivers∙ a RFS (root filesystem) based on busyboxThe development libraries comprise∙codecs∙API to communicate "directly" with the SoCs' digital signal processor (DSP) and video accelerators.From this the open source community is hacking on the Linux kernal and drivers. We (Nathan) has selected a kernal and drivers that seem to workwell, and hopefully all you have to do it install this balck box of 0's and 1's.You need to make a SD flash card, formated in the EXT2 format, with these files:∙MLO 17KB∙u-boot 150KB∙uImage 2078 KBwhich you may download from∙/files/147824486/MLO.html[[13]]∙/files/147824487/u-boot.html[[14]]∙/files/147824488/uImage.html[[15]]These files must be in the first partion of the SD flash card, and MLO must be the first file. When the BB is powered up with the reset button pressed, the program the BB runs will look at the first file of the first partition. If this file is named 'MLO', it will execute it. MLO is a boot loader. After it is loaded, it runs and looks for 'u-boot', which is the standard boot loader everyone uses to start loading Linux. Finally, u-boot runs and it reads uImage. The file 'uImage' has a form of Linux called Angstrom and various files needed to capture images and process them with OpenCV.The EXT2 format is supported by Linux, but to write an EXT2 formatted SD flash card with Windows, you need to download software. We will use xxx.run the command promptsee [[16]] for an explaination of the command prompt∙Step 1: Click on the Start Menu∙Step 2: Click on the Run option∙Step 3: Type the appropriate command in the Open: field. XP type 'cmd.exe'∙Step 4: Click on the OK buttonNow type these commandsdircd my documentscd downloadsdd if=bb.dd of=\\.\PhysicalDrive1 bs=512k[[17]] has an explaination of the dd command. The dd command is copying bb.dd to our SD flash drive in the EXT2 format.The final steps are to connect the BB to a PC and run telnet on the PC so we can talk to the BB.The mode of connection we will use is to power the BB via a USB cable and send signals from the BB's RS232 serial port to a USB port on the PC. We hook the DB9M TO IDC10 SERIAL (AT-EVEREX) cable to the BB's RS232 serial port, witht the red strand of the ribbon cable connecting to pin 1 on the RS232 connector. A null model cable connects to the other end of the DB9M TO IDC10 SERIAL cable, and to the PC's parallel port. If your PC does not have a parallel port, you need a serial to USB conector or cable.Run HyperTerminal (this description is for a PC running XP)startall programsaccessoriescommunicationsHyperTerminal_____ DLG: Default Telnet Program?We recommend that you make HyperTerminal your default telnet program. Do you want to do this?click:[No]_____ DLG: Connection DescriptionName: type anything (hit:'bb') Icon: pick any click:[OK]_____ DLG: Connect ToConnect using: pick the menu item corresponding to port on your PC that you connected the BB to PC serial cable to; lets say this is COM4_____ DLG: COM4 PropertiesBits per second: 2400 // change to 115200 Data bits: 8 Parity: None Stop bits: 1 Flow control; Hardware // change to Noneclick:[OK]_____ finished asking for a HyperTerminal windowYou should now have a window titled 'bb - HyperTerminal'Hold down the 'User' button on the BB Connect the USB to OTG cable to the BBBy holdering down the User button while powering up, you are instructing the BB to download and run the file names 'MLO', which in turn runs a file names 'u-boot', which in turn runs the file 'uImage'. The purpose of MLO and u-boot is to install the functions necessary to load and install uImage. uImage contains Linux and the any programs and data we will use in the Linux environment.In the future, everything will exist on the BB's flash memory; so in the future you will then NOT press the 'User' button while powering up the BB. The BB has 256MB of on-board flash, so it will store MLO and u-boot. (check this with Nathan). You WILL need to have a SD card with uImage. (check this with Nathan).At this point the HyperTerminal window will start presenting diagnostics as the BB is booted from the files on the SD flash card.In this process X-Windows is loaded, so if you had connected a screen with a HTMI connector you would see X-Windows appear on the screen. And at that point you could use any keyboard and mouse connected to the BB via a USB hub.When you no longer see new boot diagnostics appearing,hit <enter> to display the standard banner shown after a power-up. you should see the 'beagle board login:' prompt,type 'root' and hit <enter>you should get 'root@beagle board:~#:'type 'ls' and hit <enter> so see what files and directories exist at the top levelYou are now running Linux on the BB, and using HyperTerminal on your PC so the mouse, keyboard and a Window on your PC's screen act as the user interface devices for the BB.Any files you add, delete, or modify will cause uImage to be changed on the SD card.3) TUTORIAL: Talking to a webcamAs per our discussions of cameras, we assume you are using a UVC compliant camera with a USB2.0 connector.linux-omap has a UVC driver built-in. But you need to use the latest kernal, and various patches to have everything work proeprly. Some additional patches may be required to make the Logitech QC9000 Pro work properly (Actually, it's a more general problem with USB OTG support, as mentioned in the cmaera hardware section.)To capture content from a webcam that complies with the UVC standard, use /software/linux/v4l2-software/uvccapture These can be used to view images:*lucview*mjpg-streamer/software/linux/v4l2-software/mjpg-streamerMJPG-streamer takes JPGs from Linux-UVC compatible webcams, filesystem or other input pluginsand streams them as M-JPEG via HTTP to webbrowsers, VLC and other software.It is the successor of uvc-streamer, a Linux-UVC streaming application with Pan/TiltUse the images listed above, which include a bunch of patches.If the result has shortcomings, then the easiest way to get a working .27 kernel with the USB patches is here (rename this to uImage and copy to your boot partition):/koen/OE/uImage-2.6.26+2.6.27-rc7+r14+gite1c49d7d22af768188e2a54c167ed79919361e55-r14-beagleboard.binAlso install these modules in /lib/modules:/koen/OE/modules-2.6.26+2.6.27-rc7+r14.1+ gite1c49d7d22af768188e2a54c167ed79919361e55-r14.1-beagleboard.tgzIf you want to try building your own kernel, you can get the linux-omap tree here: git clonegit:///pub/scm/linux/kernel/git/tmlind/linux-omap-2.6. gitYou will need to apply some of the patches here:/git/?p=openembedded.git;a=tree;f=package s/linux/linux-omap;h=e56ed500ba61ea636a2dd14ada76821320fb5eb8;hb=HEADAll the patches starting with 'musb-' are needed to make the cameras work reliably.4) TUTORIAL: Programming OpenCV on the BeagleBoard---Using the BeagleBoard's DSP for vision processingA big attraction of the BB is that the CPU chip also has a DSP core. This will allow a huge speed-up in vision processing. The following explains where the DSP will be useful.Doing convolution integrals is the basic operation behind most computer vision algorithms. This includes operations like smoothing, sharpening, edge detection, etc.For digital signal processing, a Guassian Function is convolved with an input signal. Doing these convolution integrals is computationally intensive. So special chips have been created that are optimized for this operation. These DSP chips can also be used for vision processing.The Sobel Operator [[18]] is a popular edge detection operator. It has a 3x3 kernel.Assume we want to run the Sobel Operator over a 600x800 image. As a first shot, the code to run a horizontal derivative approximation over an image looks a little like this in pigeon JavaScript:var N=600;var M=800;var n=3;var sobel_x=[ [ 1, 0,-1],[ 2, 0,-2],[ 1, 0,-1] ]; // discrete horizontal derivative approximationfunction convolve(input,N,M,kernel,n) {var sz=Math.floor(n/2);var result=new Array(N-2*sz,M-2*siz); // assume everything initialized to 0for(var I=sz; I<N-sz; I++) {for(var J=sz; J<M-sz; J++) {for(var i=0; i<n-1; i++) {for(var j=0; j<n-1; j++) {result[I-sz,J-sz]+=input[I+sz-i,J+sz-j]*kernal[i,j];}}}}return result;}var edges_x=convolve(input600x800,600,800,sobel_x,3);display(edges_x,'x-gradient of image');Deep inside a DSP chip's API there should be something equivalent to the convolve function above.But it is instructive to do some surgery on the above code. But lets move the loops over i and j outside of the convolve function.var N=600;var M=800;var n=3;var sobel_x=[ [ 1, 0,-1],[ 2, 0,-2],[ 1, 0,-1] ];function convolve1(result,input,N,M,kernel,sz,i,j) {for(var I=sz; I<N-sz; I++) {for(var J=sz; J<M-sz; J++) {result[I-sz,J-sz]+=input[I+sz-i,J+sz-j]*kernal;}}}var sz=Math.floor(n/2);var result=new Array(N-2*sz,M-2*siz); // assume everything initialized to 0convolve1(result,input600x800,600,800,sobel_x[0,0],sz,0,0); // multiplying by identity!//convolve1(result,input600x800,600,800,sobel_x[0,1],sz,0,1); // skip mult by 0convolve1(result,input600x800,600,800,sobel_x[0,2],sz,0,2); // multiplying by identity!convolve1(result,input600x800,600,800,sobel_x[1,0],sz,1,0); // a bit shift is same as mult by 2//convolve1(result,input600x800,600,800,sobel_x[1,1],sz,1,1); // skip mult by 0convolve1(result,input600x800,600,800,sobel_x[1,2],sz,1,2); // a bit shift is same as mult by 2convolve1(result,input600x800,600,800,sobel_x[2,0],sz,2,0); // multiplying by identity!//convolve1(result,input600x800,600,800,sobel_x[2,1],sz,2,1); // skip mult by 0convolve1(result,input600x800,600,800,sobel_x[2,2],sz,2,2); // multiplying by identity!display(result,'x-gradient of image');Arrays are actually stored a a vector. So a matrixa b c d ef g h i jk l m n op q r s tis stored in memory asa b c d e f g h i j k l m n o p q r s tSo if result and input are vectorized arrays, convolve1 could be rewritten:function convolve1(result,input,N,M,kernel,sz,i,j) {for(var I=sz; I<N-sz; I++) {for(var J=sz; J<M-sz; J++) {result[(I-sz-1)*(M-2*sz) + (J-sz)]+=input[(I+sz-i)*M +(J+sz-j)]*kernal;}}}The result array is slightly smaller than the input array. It will greatally simplify things if the result is padded with empty entries, so its size is the same as the input array. And we extend the bounds of our loops slightly, which will dump put some numbers into these padded entries. As a final step we will have to remember to ignor thesepadded entries.Then we havefunction convolve1(result,input,N,M,kernel,sz,i,j) {for(var I=0; I<N; I++) {for(var J=0; J<M; J++) {result[I*M + J]+=input[(I*M + J + M*(sz-i)+sz-j)]*kernal;}}}Finally, we can traversing through a matrix using a single loop:function convolve1(result,input,N,M,kernel,sz,i,j) {for(var I=0; I<N*M; I++) {result[I]+=input[I+ M*(sz-i)+sz-j)]*kernal;}}M*(sz-i)+sz-j) is just an offset. If we are using C, C++ or C#, we can add this offeset to 'input' before calling convolve1. Now convolve1 becomes:function convolve1(result,input,NxM,k) {for(var I=0; I<NxM; I++) {result[I]+=k*input[I];}}。