matching jigsaw puzzle pieces

后端 未结 2 1323
后悔当初
后悔当初 2021-02-03 13:39

I have nothing useful to do and was playing with jigsaw puzzle like this:

alt text http://manual.gimp.org/nl/images/filters/examples/render-taj-jigsaw.jpg

and I

2条回答
  •  余生分开走
    2021-02-03 14:28

    Data acquisition

    (This is known as Chroma Key, Blue Screen or Background Color method)

    1. Find a well-lit room, with the least lighting variation across the room.
    2. Find a color (hue) that is rarely used in the entire puzzle / picture.
    3. Get a color paper that has that exactly same color.
    4. Place as many puzzle pieces on the color paper as it'll fit.
      • You can categorize the puzzles into batches and use it as a computer hint later on.
      • Make sure the pieces do not overlap or touch each other.
      • Do not worry about orientation yet.
    5. Take picture and download to computer.
      • Color calibration may be needed because the Chroma Key background may have upset the built-in color balance of the digital camera.

    Acquisition data processing

    1. Get some computer vision software
      • OpenCV, MATLAB, C++, Java, Python Imaging Library, etc.
    2. Perform connected-component on the chroma key color on the image.
      • Ask for the contours of the holes of the connected component, which are the puzzle pieces.
    3. Fix errors in the detected list.
    4. Choose the indexing vocabulary (cf. Ira Baxter's post) and measure the pieces.
      • If the pieces are rectangular, find the corners first.
      • If the pieces are silghtly-off quadrilateral, the side lengths (measured corner to corner) is also a valuable signature.
      • Search for "Shape Context" on SO or Google or here.
      • Finally, get the color histogram of the piece, so that you can query pieces by color later.
    5. To make them searchable, put them in a database, so that you can query pieces with any combinations of indexing vocabulary.

提交回复
热议问题