37 quint8 maxPixel = std::numeric_limits<quint8>::min();
38 quint8 minPixel = std::numeric_limits<quint8>::max();
40 [&minPixel, &maxPixel](quint8 pixel) {
41 if (pixel > maxPixel) {
44 if (pixel < minPixel) {
49 const qreal scale = 255.0 / (maxPixel - minPixel);
51 [minPixel, scale](quint8 pixel) {
52 return pow2(255 - quint8((pixel - minPixel) * scale)) / 255;
58 quint8 maxPixel = std::numeric_limits<quint8>::min();
59 quint8 minPixel = std::numeric_limits<quint8>::max();
61 [&minPixel, &maxPixel](quint8 pixel) {
62 if (pixel > maxPixel) {
65 if (pixel < minPixel) {
70 const qreal scale = 255.0 / (maxPixel - minPixel);
72 [minPixel, scale](quint8 pixel) {
73 return (quint8((pixel - minPixel) * scale));
83 const QRect &boundingRect)
85 using namespace boost;
96 std::vector<default_color_type> groups(num_vertices(graph));
97 std::vector<int> residual_capacity(num_edges(graph), 0);
99 std::vector<typename graph_traits<KisLazyFillGraph>::vertices_size_type> distance_vec(num_vertices(graph), 0);
100 std::vector<typename graph_traits<KisLazyFillGraph>::edge_descriptor> predecessor_vec(num_vertices(graph));
102 auto vertexIndexMap =
get(boost::vertex_index, graph);
106 Vertex s(Vertex::LABEL_A);
107 Vertex t(Vertex::LABEL_B);
112 make_iterator_property_map(&residual_capacity[0],
get(boost::edge_index, graph)),
113 get(boost::edge_reverse, graph),
114 make_iterator_property_map(&predecessor_vec[0], vertexIndexMap),
115 make_iterator_property_map(&groups[0], vertexIndexMap),
116 make_iterator_property_map(&distance_vec[0], vertexIndexMap),
125 const int pixelSize = resultDevice->
pixelSize();
129 long vertex_idx =
get(boost::vertex_index, graph,
v);
130 default_color_type label = groups[vertex_idx];
132 if (label == black_color) {
134 *mskIt.
rawData() = 10 + (int(label) << 4);
189 : useEdgeDetection(_useEdgeDetection),
190 edgeDetectionSize(_edgeDetectionSize),
191 fuzzyRadius(_fuzzyRadius),
192 cleanUpAmount(_cleanUpAmount)
property_traits< CapacityEdgeMap >::value_type boykov_kolmogorov_max_flow(Graph &g, CapacityEdgeMap cap, ResidualCapacityEdgeMap res_cap, ReverseEdgeMap rev_map, PredecessorMap pre_map, ColorMap color, DistanceMap dist, IndexMap idx, typename graph_traits< Graph >::vertex_descriptor src, typename graph_traits< Graph >::vertex_descriptor sink)