Open MK-Vision opened 3 years ago
Hello. I am glad that my algorithms are useful for you. Unfortunately I can't change existing algorithms due to compatibility. But I can add new one. It would better if you give me scalar implementation of algorithm that you want as example. It will allow to me minimize possible missunderstanding. The rest (optimizations and tests) I will make by myself.
Hello – that would be great if you were able to create a variant that does the adaptiveThresholding.
From the OpenCV documentation the implementation is defined as follows:
For the Adaptive_Thresh_Mean option for non-inverted thresholding, this would correspond to the following algorithm.
sum = 0; area = 0;
for(dy = -neighborhood; dy <= neighborhood; ++dy)
{
for(dx = -neighborhood; dx <= neighborhood; ++dx)
{
if(x + dx >= 0 && x + dx < width && y + dy >= 0 && y + dy < height)
{
area++;
sum += src[x + dx, y + dy]
}
}
}
sum /= area;
dst[x, y] = src[x, y] > (sum - C) ? positive : negative;
Where C is a threshold offset value above
From: Ihar Yermalayeu notifications@github.com Sent: Sunday, November 8, 2020 5:45 AM To: ermig1979/Simd Simd@noreply.github.com Cc: MK-Vision kelly@viionsystems.com; Author author@noreply.github.com Subject: Re: [ermig1979/Simd] Adaptive Binarization (#132)
Hello. I am glad that my algorithms are useful for you. Unfortunately I can't change existing algorithms due to compatibility. But I can add new one. It would better if you give me scalar implementation of algorithm that you want as example. It will allow to me minimize possible missunderstanding. The rest (optimizations and tests) I will make by myself.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ermig1979/Simd/issues/132#issuecomment-723579286, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARVQPTD2WSZ2GMIGBTUZ2PTSO2OFXANCNFSM4TOAR3BA .
Can I change expression from src[x, y] > (sum/area - threshold)
to (src[x, y] + threshold)*area > sum
in order to avoid division operation?
Yes – that looks fine to me.
Thank you!
Michael
From: Ihar Yermalayeu notifications@github.com Sent: Monday, November 9, 2020 1:36 AM To: ermig1979/Simd Simd@noreply.github.com Cc: MK-Vision kelly@viionsystems.com; Author author@noreply.github.com Subject: Re: [ermig1979/Simd] Adaptive Binarization (#132)
Can I change expression from src[x, y] > (sum/area - threshold) to (src[x, y] + threshold)*area > sum in order to avoid division operation?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ermig1979/Simd/issues/132#issuecomment-723891397, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARVQPTD7ICT3Y6IHYMELQE3SO6ZYFANCNFSM4TOAR3BA .
I have been using your SIMD Neon tools to speed up some common OpenCV implementations. They have been very helpful - thanks! Your AveragingBinarization method is functionally similar to the OpenCV adaptiveThreshold tool, but it is not the same. Have you considered implementing something similar to adaptiveThreshold? It may be just a simple alteration to your existing algorithm.