MCPcopy Create free account
hub / github.com/cdcseacave/openMVS / AddEdge

Method AddEdge

libs/MVS/SceneTexture.cpp:257–270  ·  view source on GitHub ↗

sample the edge with linear weights

Source from the content-addressed store, hash-verified

255 inline SampleImage(const Image8U3& _image) : image(_image), sampler() {}
256 // sample the edge with linear weights
257 void AddEdge(const TexCoord& p0, const TexCoord& p1) {
258 const TexCoord p01(p1 - p0);
259 const float length(norm(p01));
260 ASSERT(length > 0.f);
261 const int nSamples(ROUND2INT(MAXF(length, 1.f) * 2.f)-1);
262 AccumColor edgeAccumColor;
263 for (int s=0; s<nSamples; ++s) {
264 const float len(static_cast<float>(s) / nSamples);
265 const TexCoord samplePos(p0 + p01 * len);
266 const Color color(image.sample<Sampler,Color>(sampler, samplePos));
267 edgeAccumColor.Add(RGB2YCBCR(color), 1.f-len);
268 }
269 accumColor.Add(edgeAccumColor.Normalized(), length);
270 }
271 // returns accumulated color
272 Color GetColor() const {
273 return accumColor.Normalized();

Callers 1

FOREACHFunction · 0.45

Calls 2

NormalizedMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected