Skip to content

Commit f24a6b6

Browse files
authored
Added the global structure into cpp file
1 parent 405aa9b commit f24a6b6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

modules/ximgproc/src/globalmatting.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,27 @@ namespace cv
88
{
99
namespace ximgproc
1010
{
11+
12+
struct IntensityComp
13+
{
14+
IntensityComp(const cv::Mat_<cv::Vec3b> &image) : image(image)
15+
{
16+
17+
}
18+
19+
bool operator()(const cv::Point &p0, const cv::Point &p1) const
20+
{
21+
const cv::Vec3b &c0 = image(p0.y, p0.x);
22+
const cv::Vec3b &c1 = image(p1.y, p1.x);
23+
24+
return ((int)c0[0] + (int)c0[1] + (int)c0[2]) < ((int)c1[0] + (int)c1[1] + (int)c1[2]);
25+
}
26+
27+
const cv::Mat_<cv::Vec3b> &image;
28+
};
29+
30+
31+
1132
std::vector<cv::Point> GlobalMatting::findBoundaryPixels(const cv::Mat_<uchar> &trimap, int a, int b)
1233
{
1334
std::vector<cv::Point> result;

0 commit comments

Comments
 (0)