前段日子重新安装了ubuntu系统,然后又花了很多时间进行了相应的环境配置,遇到了许多麻烦;为了避免这种既浪费时间又浪费心情的情况再度发生,选择将配置过程中遇到的一些方法和体会记录下来,供以后参考。
前些天学习的一些东西。主要是利用opencv中camshiftdemo算法实现物体的颜色的追踪和识别。这是前面一部分,主要包括对目标物体颜色的截取和对截取图像进行相关的文件处理。
这次学习的最大收获是在opencv中进行coding时,最好避免C接口和C++接口函数的混用;虽然最后编译会通过,但是在运行exe时就会出现异常。 详见http://stackoverflow.com/questions/13686606/can-opencv-be-developed-using-c-and-c-together#comment18806065_13686606 实现代码和注释如下。 《OpenCV 2 Computer Vision Application Programming Cookbook》
Chapter 6 Filtering the Images
《OpenCV 2 Computer Vision Application Programming Cookbook》
Chapter 5:Segmenting images using watersheds 断断续续地学习着OpenCV;书本已经看到了第五章,是关于分水岭算法(Watersheds algorithm)的;花了挺长的一段时间在这算法和代码的理解上,也查看了很多相关的资料介绍;不过还是不能很好的去理解该算法的使用原理和方法。 函数介绍: C++: void watershed(InputArray image, InputOutputArray markers) 下面内容来自:OpenCV官方文档介绍 The function implements one of the variants of watershed, non-parametric marker-based segmentation algorithm, described in [Meyer92]. Before passing the image to the function, you have to roughly outline the desired regions in the image markers with positive (>0) indices. So, every region is represented as one or more connected components with the pixel values 1, 2, 3, and so on. Such markers can be retrieved from a binary mask using findContours() and drawContours() (see the watershed.cpp demo). The markers are “seeds” of the future image regions. All the other pixels in markers , whose relation to the outlined regions is not known and should be defined by the algorithm, should be set to 0’s. In the function output, each pixel in markers is set to a value of the “seed” components or to -1 at boundaries between the regions. 大致解释一下:该算法借鉴了地理学上的一些概念,将图像看成是一幅地图,根据图像中物体梯度的大小,将高梯度的看成是山脉,低梯度的看成是盆地或者是山谷,这样有助于分割目标;通过模拟浸入的过程,山谷中水越来越多,梯度越来越高,就会流过低些的山脉,从而流到别的山谷中,那么他们就连成了一片区域。区域分割的要求是把不同的标记分割成不同的地方。所以如果一直注水,可能就会覆盖别的区域了。这时算法就采取某种方法使修大坝(-1作为分界线)使标记的不同区域不会因为注水而相连,他们会互不相干的扩张领地,直到把整个领地都扩张完为止。 下面是一个简单的应用
此提示信息表示是你所启用的端口已经被占用了,所以:
1.输入命令(找到3000的所在端口pid): netstat -tulpn | grep 3000 当然,你会看到--> tcp 0 0 127.0.0.1.3000 0.0.0.0:* LISTEN 1877/ruby 2.输入命令(杀死被占用的pid): kill -9 1877 3.重新启动ruby script/server 即可 第二种方法: 用ps命令查看当前终端中开启的所有进程,当然,你会发现一个标明是ruby的进程,我们可以看到它的PID(假定PID为6523)。所以执行下面的命令: kill -9 6532 然后重新进入rails工程里面,启动ruby script/server即可 大三 开始跟随学长做一些项目 涉及到一些网络开发和编程 因此着手开始学习ROR(Ruby on Rails)
下面是ubuntu12.04下配置ror开发环境的的过程、遇到的问题以及相应的解决方法。 --------------------------------------------------------------------------------------------------------------------------------------
解决方法:sudo apt-get install libmagickwand-dev 然后再输入:sudo gem install rmagick即可 具体可参考:http://www.cnblogs.com/ericchen/archive/2012/07/09/2583823.html
$ ruby -v 显示相应版本号即说明安装完成
$ rails new demo 下面内容为指令输入后终端的显示内容 |