Commit 4f6e5767 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #838 from MambaWong:master

parents 9ea4ad91 e320d7dd
...@@ -49,11 +49,15 @@ double ConvolutionEngine::convolve(const Mat &feat, const Mat &filter, ...@@ -49,11 +49,15 @@ double ConvolutionEngine::convolve(const Mat &feat, const Mat &filter,
int dimHOG, int x, int y) int dimHOG, int x, int y)
{ {
double val = 0; double val = 0;
for (int xp = 0; xp < filter.cols; xp++) for (int yp = 0; yp < filter.rows; yp++)
{ {
for (int yp = 0; yp < filter.rows; yp++) const double *pfeat = (double*)feat.ptr(y + yp) + x * dimHOG;
val += filter.at<double>(yp, xp) const double *pfilter = (double*)filter.ptr(yp);
* feat.at<double>(y + yp, x * dimHOG + xp);
for (int xp = 0; xp < filter.cols; xp++)
{
val += pfeat[xp] * pfilter[xp];
}
} }
return val; return val;
...@@ -62,20 +66,26 @@ double ConvolutionEngine::convolve(const Mat &feat, const Mat &filter, ...@@ -62,20 +66,26 @@ double ConvolutionEngine::convolve(const Mat &feat, const Mat &filter,
void ConvolutionEngine::convolve(const Mat &feat, const Mat &filter, void ConvolutionEngine::convolve(const Mat &feat, const Mat &filter,
int dimHOG, Mat &result) int dimHOG, Mat &result)
{ {
for (int x = 0; x < result.cols; x++) for (int y = 0; y < result.rows; y++)
{ {
for (int y = 0; y < result.rows; y++) double *presult = (double*)result.ptr(y);
for (int x = 0; x < result.cols; x++)
{ {
double val = 0; double val = 0;
for (int xp = 0; xp < filter.cols; xp++) for (int yp = 0; yp < filter.rows; yp++)
{ {
for (int yp = 0; yp < filter.rows; yp++) const double *pfeat = (double*)feat.ptr(y + yp) + x * dimHOG;
val += feat.at<double>(y + yp, x*dimHOG + xp) const double *pfilter = (double*)filter.ptr(yp);
* filter.at<double>(yp, xp);
} // xp for (int xp = 0; xp < filter.cols; xp++)
result.at<double>(y, x) = val; {
} // y val += pfeat[xp] * pfilter[xp];
} // x }
} // yp
presult[x] = val;
} // x
} // y
} }
} // namespace cv } // namespace cv
} // namespace dpm } // namespace dpm
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment