Merge pull request #23204 from whuaegeanse:fix-sift

pull/23214/head
Alexander Alekhin 2 years ago
commit cb2052dbfe
  1. 23
      modules/features2d/src/sift.simd.hpp

@ -850,7 +850,6 @@ else // CV_8U
#endif #endif
} }
#else #else
float* dst = dstMat.ptr<float>(row);
float nrm1 = 0; float nrm1 = 0;
for( k = 0; k < len; k++ ) for( k = 0; k < len; k++ )
{ {
@ -858,20 +857,22 @@ else // CV_8U
nrm1 += rawDst[k]; nrm1 += rawDst[k];
} }
nrm1 = 1.f/std::max(nrm1, FLT_EPSILON); nrm1 = 1.f/std::max(nrm1, FLT_EPSILON);
if( dstMat.type() == CV_32F ) if( dstMat.type() == CV_32F )
{
for( k = 0; k < len; k++ )
{ {
dst[k] = std::sqrt(rawDst[k] * nrm1); float *dst = dstMat.ptr<float>(row);
for( k = 0; k < len; k++ )
{
dst[k] = std::sqrt(rawDst[k] * nrm1);
}
} }
} else // CV_8U
else // CV_8U
{
for( k = 0; k < len; k++ )
{ {
dst[k] = saturate_cast<uchar>(std::sqrt(rawDst[k] * nrm1)*SIFT_INT_DESCR_FCTR); uint8_t *dst = dstMat.ptr<uint8_t>(row);
for( k = 0; k < len; k++ )
{
dst[k] = saturate_cast<uchar>(std::sqrt(rawDst[k] * nrm1)*SIFT_INT_DESCR_FCTR);
}
} }
}
#endif #endif
} }

Loading…
Cancel
Save