void PerturbSeeds(
            double[] kseedsl,
            double[] kseedsa,
            double[] kseedsb,
            double[] kseedsx,
            double[] kseedsy,
            double[] edges) {
        int[] dx8 = {-1, -1, 0, 1, 1, 1, 0, -1};
        int[] dy8 = {0, -1, -1, -1, 0, 1, 1, 1};

        int numseeds = kseedsl.length;

        for (int n=0; n<numseeds; n++) {
            int ox = (int) kseedsx[n];//original x
            int oy = (int) kseedsy[n];//original y
            int oind = oy*m_width + ox;

            int storeind = oind;
            for (int i=0; i<8; i++) {
                int nx = ox+dx8[i];//new x
                int ny = oy+dy8[i];//new y

                if (nx >= 0 && nx < m_width && ny >= 0 && ny < m_height) {
                    int nind = ny * m_width + nx;
                    if (edges[nind] < edges[storeind]) {
                        storeind = nind;
                    }
                }
            }
            if (storeind != oind) {
                kseedsx[n] = storeind%m_width;
                kseedsy[n] = storeind/m_width;
                kseedsl[n] = m_lvec[storeind];
                kseedsa[n] = m_avec[storeind];
                kseedsb[n] = m_bvec[storeind];
            }
        }
    }