# Current Source Code

• hfalg.c version 1.20 of 2010-10-07

# The Algorithms

## Error Level Analsis (ela)

This finds entropy in a jpeg file by recompressing a jpeg and finding the differences between pixels caused by the JPEG compression algorithm. I learned this from Dr. Krawetz.

## Average Distance (avgdist)

This poorly named algorithm turns each pixels color channel in the difference between itself and the averages of it's cross-shaped neighbors (up, down, left, right) and scales the difference by 4.

## Min Max 1 (minmax1)

For each pixel's rgb values, the highest color value (or values if there is a tie) is set to 255, and any pixel values below the highest are set to 0.

## Min Max 2 (minmax2)

For each pixel's rgb values, the colors value is 255 if it is higher than all four of its cross-neighbors (up, down, let, right), 0 otherwise. Additionally, only the highest color in the pixel value is displayed, as in minmax1.

## Min Max 3 (minmax3)

If the vector length of the current pixel is larger than all of the vector lengths of the four cross-neighbors (up, down, left, right) then this pixel is set red=255, green=255. If the vector length of current pixel is smaller than all of teh vector lengths of the four cross-neighbors then this pixel is set green=255, blue=255. If this pixel is neither a high nor a low, then it is black.

## Min Max 4 (minmax4)

Each color value of the current pixel is compared against all the color values of itself and all of its cross-neighbors (up, down, left, right). If it is the highest, then it is set to 255, otherwise to 0.

## Min Max 5 (minmax5)

Just like minmax1, but the highest value is set to its current value, not 255.

## Max Color (maxcolor)

If the R, G, or B value a pixel is higher than the other two RGB values then it is set to itself, otherwise it is set to 0.

## Min Color (mincolor)

If the R, G, or B value a pixel is lower than the other two RGB values then it is set to itself, otherwise it is set to 0.

## Mid Color (midcolor)

If the R, G, or B value a pixel is between than the other two RGB values then it is set to itself, otherwise it is set to 0.

# Examples

Comments and questions to: schlake+ela@nmt.edu Schlake's Top Level Page