fun extract( maxFeatureValue: Int, distanceSet: IntArray, img: Array<IntArray> ): Array<FloatArray>? { val histogram = IntArray(maxFeatureValue) val W = img.size val H: Int = img[0].length for (x in 0 until W) { for (y in 0 until H) { histogram[img[x][y]]++ } } val correlogram = Array(maxFeatureValue) { FloatArray( distanceSet.size ) } val tmpCorrelogram = IntArray(distanceSet.size) for (x in 0 until W) { for (y in 0 until H) { val color = img[x][y] getNumPixelsInNeighbourhood(x, y, img, tmpCorrelogram, maxFeatureValue, distanceSet) for (i in distanceSet.indices) { correlogram[color][i] += tmpCorrelogram[i] } } } val max = FloatArray(distanceSet.size) for (c in 0 until maxFeatureValue) { for (i in distanceSet.indices) { max[i] = Math.max(correlogram[c][i], max[i]) } } for (c in 0 until maxFeatureValue) { for (i in distanceSet.indices) { correlogram[c][i] = correlogram[c][i] / max[i] } } return correlogram }
extract extracts an auto-correlogram from an Image . This method create a cummulated auto-correlogram over different distances instead of standard method . Also , uses a different normalization method