Photoshop中的“磁性套索”背后算法的OpenCV实现

20 篇文章 2 订阅
2 篇文章 0 订阅

本文由Markdown语法编辑器编辑完成。

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

未完待续……

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

inter_peng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值