Explore BrainMass

Java program for contouring images


I am trying to write a program in Java that will be able to recognise the contour of an image. An image is a two-dimentional table of boolean values (true=black, false=white), and the contour is the list of points which form the outer edge of the image.

Two files are attached. The first is my class Image, and the second is a test class which tries it out on an example. As you can see if you execute my program, I get a list of points and directions, but they are not quite correct.

I think there are only small changes to be made, and I would be very grateful if you could show me what to change so that it works properly.

Thanks for your help!

PS - In order to compile and execute the attachments, you have to change the name of the files from Image.txt to Image.java, and from Test.txt to Test.java. I had to save them as .txt, otherwise Brainmass wouldn't allow me to attach them!


Solution Preview


1. Boundaries must be checked to eliminate a possible direction (and more importantly, to prevent an error in the array numbering)
2. Will the contour lines always make right angle turns? If not, ...

Solution Summary

Java programming for contouring images are analyzed. The contour lines for Boolean value tables are determined.