MCPcopy Create free account
hub / github.com/CMU-Perceptual-Computing-Lab/openpose / extractPatch

Function extractPatch

src/openpose/tracking/pyramidalLK.cpp:193–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191 }
192
193 char extractPatch(std::vector< std::vector<float>>& patch, const int x, const int y, const int patchSize,
194 const cv::Mat& image)
195 {
196 try
197 {
198 int radix = patchSize / 2;
199
200 if ( ((x - radix) < 0) ||
201 ((x + radix) >= image.cols) ||
202 ((y - radix) < 0) ||
203 ((y + radix) >= image.rows))
204 return OUT_OF_FRAME;
205
206 for (auto i = -radix; i <= radix; i++)
207 for (auto j = -radix; j <= radix; j++)
208 patch[i+radix][j+radix] = image.at<float>(y+i,x+j);
209
210 return SUCCESS;
211 }
212 catch (const std::exception& e)
213 {
214 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
215 return UNDEFINED_ERROR;
216 }
217 }
218
219 char extractPatchIt(std::vector<std::vector<float>>& patch, const int xI, const int yI, const int xJ,
220 const int yJ, const cv::Mat& I, const cv::Mat& J, const int patchSize)

Callers 1

pyramidIterationFunction · 0.85

Calls 2

whatMethod · 0.80
errorFunction · 0.50

Tested by

no test coverage detected