core algorithm to generate the String Art from a portrait.
This artwork is created by crossing one single string around fixed number of nails which form a shape like a circle, square etc.
L2ASolver solver = L2ASolverFactory.getSolver(L2ASolverMethods.GREEDY_LAZY_DEPTH);
/**
* if the image is not a square, then it will take the center square part to process
* @param image image to be processed, make sure the image size is at least 500*500
* @param nailNum the total nail number to form the portrait
* @return Solution
*/
L2ASolution solution = solver.solve(image, 300);
/**
* the path that forms the portrait, each item represents the nail index(starts from 0)
*/
List<Integer> path = solution.getPath();
/**
* the net that forms the portrait, each key-value represents the connected nail indexs of the key nail
*/
Map<Integer, Set<Integer>> net = solution.getNet();
/**
* get all nails information
*/
Nail[] nails = solution.getAllNails();
- initial version of linetoart-core