Download the PHP package bywulf/jigsawlutioner without Composer

On this page you can find all versions of the php package bywulf/jigsawlutioner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jigsawlutioner

Build status Code coverage Latest release License GitHub top language

Donate Donate

About

Jigsawlutioner is an algorithm designed to solve a jigsaw puzzle based on images taken by each puzzle piece.

See also

Why

Solving jigsaw puzzles by hand should be a relaxing leisure activity. But when it comes to a point, when you have a table full of black pieces, and all you can do it brutforcing them by trying each side to each other sides resolving in 4 solved connections within 2 hours, that is no fun anymore. This algorithm doesn't care about colors and only looks at the individual formed piece borders so it is able to attack exactly this problem case.

How it works

It parses the border of a piece image and finds the four corners. Now you have four sides. These sides are then compared to all other sides of all other pieces and ranked by a matching probability. With this information, the solver tries to connect all pieces together as best as they fit. It is forgivable, meaning inperfect borders don't prevent a correct solution, because there can always be some shred from the cutting knifes. We are not in a perfect world with perfect borders, but that's not a problem.

Solvable jigsaw puzzle manufacturers/forms

Currently only standard rectangle puzzles are supported by the algorithm. Although it is design to be able to solve all kind of rectangle puzzles, only Ravensburger puzzles are currently solved correctly. This is because of the very good and individual forms each side gets by Ravensburger. Other manufacturers use too similar or even identical side forms and therefore this algorithm is not suitable for them.

Features

  1. BorderFinder: Parses an image, extracts the border of the piece and returns an array of points describing the border
  2. SideFinder: Analyzes the border points and determines, where each of the 4 corners is. Returns 4 arrays containing the border points of each side.
  3. PieceAnalyzer: Normalizes the side points (rotate them horizontal, flatten them and divides them in 100 evently distributed points), generates classifiers of each side (is the nop inside or outside, is the nop more left or right, etc.) and returns a piece object.
  4. SideMatcher: Returns the probability between two sides, how good they can fit together.
  5. PuzzleSolver: Solves the jigsaw puzzle and returns a matrix of where every piece should be placed with correct rotation.

Usage

PieceAnalyzer

You need a high definition image of your puzzle piece. It should be 1000px wide and its borders should be distinct. Best practice: use a backlight when taking the images, so it becomes black/white and the borders really stand out.

If you want to get an image returned where the background got transparent (f.e. to display it somewhere connected to other pieces), specify it also. Best practice: take two images of the piece in the same position. First with backlight for better border detection, and one with normal light for the colored piece becoming transparent. You can request multiple images to become transparent and the size of these image doesn't have to be the same as the original (10 times smaller transparent images are good for displaying the solution to the user instead of the original high definition sized images).

On success a Piece object is returned. On failure a JigsawlutionerException is thrown.

The most important data in the $piece are the $piece->getBorderPoints() (which specify the points of the border on the image) and the four $piece->getSides() objects.

Each Side object has the following data:

We currently have the following classifiers (SideClassifierInterface):

ByWulfSolver

When you parsed all your pieces, you can start solving the puzzle. First generate a matching map of all probabilities between all sides. Then the solver will search for the solution:

On success a Solution is returned. On failure a JigsawlutionerException is thrown.

The solution will contain multiple $solution->getGroups(). One for every connected area of the piece. Ideally you get exactly one group containing all pieces.

Each Group has a list of $group->getPlacements(). One placement for each piece.

Each Placement has the following information:

PieceRecognizer

If you want to find a newly scanned piece within a list of already scanned pieces, you can use the PieceRecognizer service.

The returned $piece is the cloned $newlyScannedPiece with the correctly set index and its sides reordered so the first side of the newly scanned pieces matches the first side of the existing piece.


All versions of jigsawlutioner with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-gd Version *
psr/log Version ^1 || ^2 || ^3
rubix/ml Version ^1.3.2
symfony/validator Version ^6.0
amphp/parallel Version ^1.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bywulf/jigsawlutioner contains the following files

Loading the files please wait ....