The C version runs in 2 seconds on a selected image, the Java version takes 20 and on top of that half the time it craps out because the jvm runs out of memory.