91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 66KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-08
  • 語言: C/C++
  • 標簽: gco??CRF??GraphCut??

資源簡介

用于求解CRF,GraphCut的源代碼,包含C++和matlab,內附程序說明

資源截圖

代碼片段和文件信息

//////////////////////////////////////////////////////////////////////////////
//?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?//????????????:?D(pixellabel)?=?10?if?pixel?//????????????:?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? for?(int?l?=?0;?l? if?(i? 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? for?(int?l2?=?0;?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? result[i]?=?gc->whatLabel(i);

delete?gc;
}
catch?(GCExcep

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????13232??2012-11-15?17:28??example.cpp
?????文件???????21133??2012-11-15?17:28??GCO_README.TXT
?????文件???????61540??2012-11-15?17:28??GCoptimization.cpp
?????文件???????27089??2012-11-15?17:28??GCoptimization.h
?????文件????????3005??2012-11-15?17:28??graph.cpp
?????文件???????17790??2012-11-15?17:28??graph.h
?????文件????????1453??2012-11-15?17:28??linkedBlockList.cpp
?????文件????????1765??2012-11-15?17:28??linkedBlockList.h
?????文件???????17631??2012-11-15?17:28??maxflow.cpp
?????文件????????2553??2012-11-15?17:28??matlab\GCO_BuildLib.m
?????文件?????????387??2012-11-15?17:28??matlab\GCO_ComputeEnergy.m
?????文件?????????526??2012-11-15?17:28??matlab\GCO_Create.m
?????文件?????????223??2012-11-15?17:28??matlab\GCO_Delete.m
?????文件?????????303??2012-11-15?17:28??matlab\GCO_ExpandOnAlpha.m
?????文件????????1091??2012-11-15?17:28??matlab\GCO_Expansion.m
?????文件?????????670??2012-11-15?17:28??matlab\GCO_GetLabeling.m
?????文件?????????370??2012-11-15?17:28??matlab\GCO_ListHandles.m
?????文件?????????507??2012-11-15?17:28??matlab\GCO_LoadLib.m
?????文件???????18497??2012-11-15?17:28??matlab\gco_matlab.cpp
?????文件????????2068??2012-11-15?17:28??matlab\GCO_SetDataCost.m
?????文件????????1695??2012-11-15?17:28??matlab\GCO_SetLabelCost.m
?????文件?????????787??2012-11-15?17:28??matlab\GCO_SetLabeling.m
?????文件?????????607??2012-11-15?17:28??matlab\GCO_SetLabelOrder.m
?????文件????????1198??2012-11-15?17:28??matlab\GCO_SetNeighbors.m
?????文件????????1380??2012-11-15?17:28??matlab\GCO_SetSmoothCost.m
?????文件????????1155??2012-11-15?17:28??matlab\GCO_SetVerbosity.m
?????文件?????????702??2012-11-15?17:28??matlab\GCO_Swap.m
?????文件???????16858??2012-11-15?17:28??matlab\GCO_UnitTest.m
?????文件????????7154??2012-11-15?17:28??matlab\README.TXT
?????文件????????7466??2012-11-15?17:28??block.h
?????文件???????10348??2012-11-15?17:28??energy.h
............此處省略0個文件信息

評論

共有 條評論