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 yp = 0; yp < filter.rows; yp++)
{
const double *pfeat = (double*)feat.ptr(y + yp) + x * dimHOG;
const double *pfilter = (double*)filter.ptr(yp);
for (int xp = 0; xp < filter.cols; xp++) for (int xp = 0; xp < filter.cols; xp++)
{ {
for (int yp = 0; yp < filter.rows; yp++) val += pfeat[xp] * pfilter[xp];
val += filter.at<double>(yp, xp) }
* feat.at<double>(y + yp, x * dimHOG + 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 yp = 0; yp < filter.rows; yp++)
{
const double *pfeat = (double*)feat.ptr(y + yp) + x * dimHOG;
const double *pfilter = (double*)filter.ptr(yp);
for (int xp = 0; xp < filter.cols; xp++) for (int xp = 0; xp < filter.cols; xp++)
{ {
for (int yp = 0; yp < filter.rows; yp++) val += pfeat[xp] * pfilter[xp];
val += feat.at<double>(y + yp, x*dimHOG + xp) }
* filter.at<double>(yp, xp); } // yp
} // xp
result.at<double>(y, x) = val; presult[x] = val;
} // y
} // x } // 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