Simple speed up of C++ OpenMP kernel
Vector v is not required.  Instead of adding items to it, iterate directly over your source array, and then use variance = E(v²) / E(v)² so that your inner code becomes:

        double sum = 0;
        int n = kernelSize * kernelSize;
        // Kernel Patch
        for (int kx = ...) {
            for (int ky = ...) {
                double d = (double)input[img.step * kx + ky]);
                sum += d;
            }
        }
        const double mean = sum/n;

        double sum2 = 0;
        for (int kx = ...) {
            for (int ky = ...) {
                double d = (double)input[img.step * kx + ky]);
                sum2 += (d - mean) * (d - mean);
            }
        }
        const double stddev = sqrt(sum2/n);
        if (stddev &lt; threshold) {
            ...;
        }


After that, consider that the sum of elements centred around (x+1,y) can be found from the result for (x,y) simply by subtracting all the elements in the previous left-hand column, and adding all the elements in the new right-hand column.  An analogous operation works vertically.

Also, check your compiler options - are you auto-vectorizing loops, and using SIMD instructions (if available)?