Finding the 20th percentile pixel of an image using a histogram instead of std::sort
Well, index=std::floor(0.2*(srcSor.size())/100 is equivalent to the much simpler index = srcSor.size() / 500, ignoring some inaccuracy in representing 0.2.
Lose the fixed-size std::vectors. You don't depend on any of the benefits of using dynamic memory, so a simple array is sufficient and far more efficient.
Next, you really don't need the cumulative counts in sumHH at all. Just test whether you have reached the target immediately.
Don't cast unless you have to. Casting means overriding the type-system, and is thus error-prone.
Don't use obscure abbreviations.


Resulting code:

unsigned histogram[256] = {};
for (auto j = src.rows; j--;)
    for (auto i = src.cols; i--;)
        ++histogram[src.at&lt;uchar&gt;(j,i)];
int A = 255;
for (auto index = src.rows * src.cols / 500; index &gt; histogram[A]; --A)
    index -= histogram[A];