MCPcopy Create free account
hub / github.com/ImageEngine/cortex / energy

Function energy

src/IECoreImage/MedianCutSampler.cpp:158–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156/// operates on data passed to it.
157typedef boost::multi_array_ref<float, 2> Array2D;
158static inline float energy( const Array2D &summedLuminance, const Box2i &area )
159{
160 V2i min = area.min - V2i( 1 ); // box is inclusive so we need to step outside
161
162 float a = summedLuminance[area.max.x][area.max.y];
163 float b = min.y >= 0 ? summedLuminance[area.max.x][min.y] : 0.0f;
164 float c = min.x >= 0 ? summedLuminance[min.x][area.max.y] : 0.0f;
165 float d = min.x >= 0 && min.y >= 0 ? summedLuminance[min.x][min.y] : 0.0f;
166
167 return a - b - c + d;
168}
169
170static void medianCut( const Array2D &luminance, const Array2D &summedLuminance, MedianCutSampler::Projection projection, const Box2i &area, vector<Box2i> &areas, vector<V2f> &centroids, int depth, int maxDepth )
171{

Callers 1

medianCutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected