Photoshop中的“磁性套索”背后算法的OpenCV实现
2016-09-29 20:27
1531 查看
本文由Markdown语法编辑器编辑完成。
Livewire, also known as Intelligent Scissors, is a segmentation technique which allows a user to select regions of interst to be extracted quickly and accurately using a relatively small number of mouse clicks. There are many variation on livewire, but perhaps the best known example is the “magnetic lasso” tool in Photoshop. Even more sophisticated versions may take into account training data and/or lines drawn around images from neighboring slices or frames (in the case of 3D image data or animation). Livewire can be a huge help in quick image segmentation.
3.2 Livewire的算法原理:
Livewire typically works as two stage process:
(1) The entire image must be filtered using filters such as the Median filter, and/or edge detection algorithms such as the Sobel filter and converted to grayscale(灰阶) such that black regions represent the most desirable paths.
(2) A lowest cost path algorithm(最短路径算法), such as Dijkstra’s algorithm, is applied to the modified image to find the best path from one point, to another. In resulting “graph” each pixels is a node with edges going to the 4 (up, down, left, right) or 8 pixels around it and the edge costs are defined on a cost function based on the pixel value, and possibly other factors.
综上,磁性套索的基本原理应该是:
对读入的图像,首先进行中值滤波,然后进行边缘提取,输出为一个只有边缘的灰阶图像,然后再利用图论中的最短路径算法,去寻找两个点之间的最短路径。那么这个最短路径就是磁性套索中检测到的两个点区域内的边缘(最短路径)。
基于以上,可以采用VTK中的 高斯滤波或中值滤波 + 边缘提取 + 最短路径来实现。有机会可以试验一下。
参考链接:
1. Livewire介绍:
http://www.pudn.com/downloads212/sourcecode/graph/texture_mapping/detail998873.html
2. 源码地址:
http://en.pudn.com/downloads368/sourcecode/graph/texture_mapping/detail1593060_en.html
http://www.pudn.com/downloads212/sourcecode/graph/texture_mapping/detail998873.html
3. ITK之livewire:
http://www.insight-journal.org/browse/publication/230
未完待续……
1. PS中的磁性套索工具简介:
本示例是基于Photoshop CS4的工具栏:2. 磁性套索工具背后的算法Livewire原理:
3. Livewire Segmentation简介及其OpenCV的实现:
3.1 Livewire简介:Livewire, also known as Intelligent Scissors, is a segmentation technique which allows a user to select regions of interst to be extracted quickly and accurately using a relatively small number of mouse clicks. There are many variation on livewire, but perhaps the best known example is the “magnetic lasso” tool in Photoshop. Even more sophisticated versions may take into account training data and/or lines drawn around images from neighboring slices or frames (in the case of 3D image data or animation). Livewire can be a huge help in quick image segmentation.
3.2 Livewire的算法原理:
Livewire typically works as two stage process:
(1) The entire image must be filtered using filters such as the Median filter, and/or edge detection algorithms such as the Sobel filter and converted to grayscale(灰阶) such that black regions represent the most desirable paths.
(2) A lowest cost path algorithm(最短路径算法), such as Dijkstra’s algorithm, is applied to the modified image to find the best path from one point, to another. In resulting “graph” each pixels is a node with edges going to the 4 (up, down, left, right) or 8 pixels around it and the edge costs are defined on a cost function based on the pixel value, and possibly other factors.
综上,磁性套索的基本原理应该是:
对读入的图像,首先进行中值滤波,然后进行边缘提取,输出为一个只有边缘的灰阶图像,然后再利用图论中的最短路径算法,去寻找两个点之间的最短路径。那么这个最短路径就是磁性套索中检测到的两个点区域内的边缘(最短路径)。
基于以上,可以采用VTK中的 高斯滤波或中值滤波 + 边缘提取 + 最短路径来实现。有机会可以试验一下。
参考链接:
1. Livewire介绍:
http://www.pudn.com/downloads212/sourcecode/graph/texture_mapping/detail998873.html
2. 源码地址:
http://en.pudn.com/downloads368/sourcecode/graph/texture_mapping/detail1593060_en.html
http://www.pudn.com/downloads212/sourcecode/graph/texture_mapping/detail998873.html
3. ITK之livewire:
http://www.insight-journal.org/browse/publication/230
未完待续……
相关文章推荐
- 用OpenCV实现Photoshop算法(四): 色阶调整
- 用OpenCV实现Photoshop算法(九): 高反差保留
- 用OpenCV实现Photoshop算法(五): 亮度对比度调整
- 用OpenCV实现Photoshop算法(七): 调整色相饱和度
- 用OpenCV实现Photoshop算法(三): 曲线调整
- 用OpenCV实现Photoshop算法(二): 图像剪切
- 用OpenCV实现Photoshop算法(八): 可选颜色
- 用OpenCV实现Photoshop算法(十): 美白磨皮(未完)
- 用OpenCV实现Photoshop算法(六): 变为黑白图像
- 用OpenCV实现Photoshop算法(三): 曲线调整
- 用OpenCV实现Photoshop算法(一): 图像旋转
- OpenCV下车牌定位算法实现代码
- opencv实现二值图像细化的算法
- opencv实现二值图像细化的算法
- CamShift算法,OpenCV实现2-Mean Shift算法
- CamShift算法----OpenCV实现3 CamShift算法
- OpenCV下车牌定位算法实现代码
- 图像变形算法:实现Photoshop液化工具箱中向前变形工具
- OpenCV学习——眼部识别算法实现
- SAD立体匹配算法在opencv中的实现