-
大小: 68KB文件类型: .zip金币: 1下载: 0 次发布日期: 2021-05-12
- 语言: 其他
- 标签: multi-label graph cut,image segmentation
资源简介
multi-label graph cut,image segmentation 。
代码片段和文件信息
//////////////////////////////////////////////////////////////////////////////
// Example illustrating the use of GCoptimization.cpp
//
/////////////////////////////////////////////////////////////////////////////
//
// Optimization problem:
// is a set of sites (pixels) of width 10 and hight 5. Thus number of pixels is 50
// grid neighborhood: each pixel has its left right up and bottom pixels as neighbors
// 7 labels
// Data costs: D(pixellabel) = 0 if pixel < 25 and label = 0
// : D(pixellabel) = 10 if pixel < 25 and label is not 0
// : D(pixellabel) = 0 if pixel >= 25 and label = 5
// : D(pixellabel) = 10 if pixel >= 25 and label is not 5
// Smoothness costs: V(p1p2l1l2) = min( (l1-l2)*(l1-l2) 4 )
// Below in the main program we illustrate different ways of setting data and smoothness costs
// that our interface allow and solve this optimizaiton problem
// For most of the examples we use no spatially varying pixel dependent terms.
// For some examples to demonstrate spatially varying terms we use
// V(p1p2l1l2) = w_{p1p2}*[min((l1-l2)*(l1-l2)4)] with
// w_{p1p2} = p1+p2 if |p1-p2| == 1 and w_{p1p2} = p1*p2 if |p1-p2| is not 1
#include
#include
#include
#include
#include
#include “GCoptimization.h“
struct ForDataFn{
int numLab;
int *data;
};
int smoothFn(int p1 int p2 int l1 int l2)
{
if ( (l1-l2)*(l1-l2) <= 4 ) return((l1-l2)*(l1-l2));
else return(4);
}
int dataFn(int p int l void *data)
{
ForDataFn *myData = (ForDataFn *) data;
int numLab = myData->numLab;
return( myData->data[p*numLab+l] );
}
////////////////////////////////////////////////////////////////////////////////
// smoothness and data costs are set up one by one individually
// grid neighborhood structure is assumed
//
void GridGraph_Individually(int widthint heightint num_pixelsint num_labels)
{
int *result = new int[num_pixels]; // stores result of optimization
try{
GCoptimizationGridGraph *gc = new GCoptimizationGridGraph(widthheightnum_labels);
// first set up data costs individually
for ( int i = 0; i < num_pixels; i++ )
for (int l = 0; l < num_labels; l++ )
if (i < 25 ){
if( l == 0 ) gc->setDataCost(il0);
else gc->setDataCost(il10);
}
else {
if( l == 5 ) gc->setDataCost(il0);
else gc->setDataCost(il10);
}
// next set up smoothness costs individually
for ( int l1 = 0; l1 < num_labels; l1++ )
for (int l2 = 0; l2 < num_labels; l2++ ){
int cost = (l1-l2)*(l1-l2) <= 4 ? (l1-l2)*(l1-l2):4;
gc->setSmoothCost(l1l2cost);
}
printf(“\nBefore optimization energy is %d“gc->compute_energy());
gc->expansion(2);// run expansion for 2 iterations. For swap use gc->swap(num_iterations);
printf(“\nAfter optimization energy is %d“gc->compute_energy());
for ( int i = 0; i < num_pixels; i++ )
result[i] = gc->whatLabel(i);
delete gc;
}
catch (GCExcep
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3013 2014-10-14 17:05 matlab\GCO_BuildLib.m
文件 387 2014-10-10 11:33 matlab\GCO_ComputeEnergy.m
文件 526 2014-10-10 11:33 matlab\GCO_Create.m
文件 223 2014-10-10 11:33 matlab\GCO_Delete.m
文件 303 2014-10-10 11:33 matlab\GCO_ExpandOnAlpha.m
文件 1091 2014-10-10 11:33 matlab\GCO_Expansion.m
文件 670 2014-10-10 11:33 matlab\GCO_GetLabeling.m
文件 370 2014-10-10 11:33 matlab\GCO_ListHandles.m
文件 507 2014-10-10 11:33 matlab\GCO_LoadLib.m
文件 20981 2014-10-14 13:38 matlab\gco_matlab.cpp
文件 2316 2014-10-14 16:46 matlab\GCO_SetDataCost.m
文件 1887 2014-10-14 16:46 matlab\GCO_SetLabelCost.m
文件 787 2014-10-10 11:33 matlab\GCO_SetLabeling.m
文件 607 2014-10-10 11:33 matlab\GCO_SetLabelOrder.m
文件 1198 2014-10-10 11:33 matlab\GCO_SetNeighbors.m
文件 1577 2014-10-14 16:46 matlab\GCO_SetSmoothCost.m
文件 1155 2014-10-10 11:33 matlab\GCO_SetVerbosity.m
文件 702 2014-10-10 11:33 matlab\GCO_Swap.m
文件 16858 2014-10-14 12:56 matlab\GCO_UnitTest.m
文件 7784 2014-10-14 17:01 matlab\README.TXT
文件 7490 2014-10-10 11:33 block.h
文件 10432 2014-10-10 11:33 energy.h
文件 13232 2014-10-10 11:33 example.cpp
文件 21421 2014-10-14 16:55 GCO_README.TXT
文件 61518 2014-10-10 11:33 GCoptimization.cpp
文件 27467 2014-10-14 12:38 GCoptimization.h
文件 3011 2014-10-10 11:33 graph.cpp
文件 17802 2014-10-10 11:33 graph.h
文件 1453 2014-10-10 11:33 li
文件 1765 2014-10-10 11:33 li
文件 17631 2014-10-10 11:33 maxflow.cpp
............此处省略0个文件信息
- 上一篇:HostTest.exe
- 下一篇:字体 HZTXT
相关资源
- GraphOn GO-Global4.6安裝包以及45用户授權
- New Directions of Cryptograph《密码学新方向
- diagramscene.rar
- QGraphicsScene 绘制刻度图
- QPainter 与QML SceneGraph绘制效率对比测试
- mxgraph中右键和toolbar工具条的实现
- QGraphicsPixmapItem与QGraphicsScene的编程 图
- NAO机器人高尔夫球Choregraphe程序
- The GraphSLAM algorithm
- zedgraph最新源码
- graphics.h和graphics.lib
- 页岩气产业国际专利情报分析
- OpenSceneGraph入门教程合集及
- VS非常好用的绘图插件zedgraph及使用教
- Facile Preparation of Magnetic Graphene Double
- networkMap V1.0.rar
- Quaternions For Computer Graphics
- CorelDRAW Graphics Suite X6二次开发文档
- Unity功能强大的图表插件Graph Maker V
- FakePCIID_Intel_HD_Graphics.kext.zip
- Qt QGraphicsItem尺寸调整,缩放
- 现在EFA破解工具是11.4.1版本 Mentor.Gr
- ray tracing in one weekend
- 实现qt QGraphicsView放大缩小功能的类
- cryptography network security 7th pdf
- Fluid Simulation for Computer Graphics.pdf
- OpenSceneGraph 3 Cookbook 源代码
- OpenSceneGraph.3.Cookbook.pdf
- 英文原版-R in Action Data Analysis and Gra
- ISP_graph_tool_in_depth_tutorial.rar
评论
共有 条评论