Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm trying to implement the paper titled An Image Signature for any Kind of Image, but I'm having trouble understanding what they mean in this paragraph:

For each column of the image, we compute the sum of absolute values of differences between adjacent pixels in that column. We compute the total of all columns, and crop the image at the 5% and 95% columns, that is, the columns such that 5% of the total sum of differences lies on either side of the cropped image. We crop the rows of the image the same way (using the sums of original uncropped rows).

First, what do they mean by "sum of absolute values of differences between adjacent pixels in that column"? If start at the top-left pixel and work downwards (down the column), we can compute the difference between (0,0) and (0,1), but what about the next pixel? Am I supposed to compute the difference with just the pixel below, or the pixels on either side, or perhaps even the 4 or 8 neighbours?

And then, as I understand it, we sum these differences for each column such that each column is reduced to a single number?

Then we use this information to crop the left and right edges of the photo, right?

share|improve this question
I've finished the basic implementation... I noticed a couple weird things about the algo. Their signature seems to have some redundant information in it yet and they omit sections of the image and I'm not sure why... will be fiddling with this some more yet. –  Mark May 21 '13 at 22:13

1 Answer 1

up vote 4 down vote accepted

I didn't read your link, but from your question...

"Sum of absolute values of differences between adjacent pixels in that column":

sum = abs(pix1 - pix2) + abs(pix2 - pix3) + ...

You perform this computation for pixels 1 and 2 in the column, then 2 and 3, and so on. Do this for every column. Then sum all of the column sums together.

Start a new sum, adding column sums from the left. Once that new sum gets over 0.05 * sum_of_all_columns, you've passed the 5% threshold and know which column to crop at on the left side. Do the same thing on the right side going the other direction.

Basically they're looking to automatically crop out edges of the image that have no interesting features.

share|improve this answer
Thank you. I wasn't sure of their definition of "adjacent", that could mean 1, 2, 4 or 8 pixels. I'll try with just 1 neighbour as you suggest. –  Mark May 21 '13 at 3:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.