PuzzleSolver. An application of computer vision. Joe Zeimen Computer Vision Colorado School of Mines Spring 2013

Size: px
Start display at page:

Download "PuzzleSolver. An application of computer vision. Joe Zeimen Computer Vision Colorado School of Mines Spring 2013"

Transcription

1 PuzzleSolver An application of computer vision. Joe Zeimen Computer Vision Colorado School of Mines Spring 2013

2 Table of Contents Introduction... 3 Previous Work... 3 Program Implementation... 4 Assumptions... 4 Input... 4 Output... 5 PuzzleSolver Program... 5 Scanning and finding the pieces... 5 Filtering... 6 Finding Contours... 7 Finding the corners... 8 Extracting Edges Normalizing Edges Classifying edges Comparing Edges Assembly Algorithm Algorithm Implementation Creating the output image Runtime Testing Limits of the program and possible improvements Accomplishments Obtaining Source Code References Appendix Appendix A: Solved Puzzles Appendix B: Source Code main.cpp edge.cpp edge.h piece.cpp piece.h puzzle.cpp puzzle.h utils.cpp utils.h PuzzleDisjointSet.cpp PuzzleDisjointSet.h

3 Introduction This report outlines the procedure I used to solve jigsaw puzzles by way of computer vision. Essentially the goal of this project is to take a set of input images of scans of puzzle pieces, and produce one output image of an assembled puzzle. Specifically the goal of this project was to use the shapes of the pieces only, and not color information. At a very high level the algorithm for solving the puzzle works as follows: 1. Obtaining a good quality scan of the pieces. 2. Threshold images so that the pieces are white and background is black. 3. Find the boundaries of the pieces, split this up between the sides. 4. Comparing the edges 5. Using the comparison information to find a symbolic representation of the puzzle solution 6. Taking the symbolic solution and producing an output image The algorithm above was implemented in C++ using the OpenCV library and it has successfully solved several jigsaw puzzles. Previous Work In "Solving jigsaw puzzles by computer," Wolfson et al. were able to solve jigsaw puzzles using computer vision techniques relying only on the shapes of the pieces. This is called an apictorial method. For this project the authors ended up photographing the puzzle pieces individually and obtained boundary data for each piece. This boundary data was then converted to a smoothed polygonal curve. The curve is then divided among the 4 sides and these sides are used in a local matching algorithm. The assembly part of the algorithm first solves the frame of the puzzle using the known edge pieces with flat edges. They show that this problem is NP- complete and suggest a heuristic for solving the frame pieces. Once the frame has been solved correctly, the interior pieces were placed in an iterative fashion using the matching scores of two edges [1]. This paper is probably the most useful for my task since it is an attempt to solve the same problem. "Jigsaw puzzles with pieces of unknown orientation" is a bit different in that it uses square pieces and color information to try and solve the puzzle. Think of a regular image cut up into squares and then trying to piece together the original image [2]. While this method does not rely on shape information it still relies on 4 edges per piece and tries to find the correct place and orientation using a cost function. This is a much more robust algorithm and it has recently broken records in puzzle assembly. It is a greedy algorithm so it may be possible to implement using just 3

4 shapes instead of colors, especially since it appears to just rely on costs between 2 edges. Extracting the edges from a binary image is straightforward, but only choosing the correct corners from the pieces, which are very shapely, can be another challenge. There are 2 approaches to this problem, one relies on finding corners in a gray scale image, and the other relies on looking at the curvature of the contour. In [3] an algorithm is described that uses the contour to find corners. In this method it ends up using distances instead of measuring the curvature to decide if a corner exists or not. The corner finding is vital, because it allows the partitioning of the contour into each of the edges, which need to be considered independently. Once the edges are extracted the similarity between different contours must also be measured. A highly cited article called "Visual Pattern Recognition by Moment Invariants" presents Hu moments [4]. These basically are ways to characterize contours; there are 7 in all. Essentially each moment gives a score to a feature the closer the score is to 0 between two contours, the more similar they are. This is what OpenCV uses internally. Some of these moments work even when the contour is of different sizes, which is not desirable in my case, because I will know the size of the contours. Selectively choosing some of these moments with properties needed for jigsaw puzzle solving may provide reasonable results. Another much simpler method called the Hausdorff distance [5], looks for the maximum of the minimums of every point compared between the two contours. An approach like this may be simpler and should be evaluated to see if it can also provide matching scores good enough for the problem. I ended up using a comparison operation very similar to the Hausdorff distance to get good results. Program Implementation Assumptions In order to reduce the complexity of the problem, the following assumptions needed to be made. The puzzle needs to be rectangular and grid- like, meaning that the pieces are in rows and columns. The corners need to be sharp and well defined, with 4 corners meeting together unless it is on an edge. There needs to be only one tab or hole on each edge. Since the algorithm uses shape information it will not work on pieces that are purposefully made to be the same shape as other pieces. Input The input to this algorithm is a set of images where the background is black, the minimum distance between 2 corners, parameters on how much to filter the image to try and remove noise and finally a threshold value. 4

5 Output The output of the algorithm is an image of the completed puzzle. In the event that the puzzle could not be solved correctly, and the program recognizes it, it will give an error message. PuzzleSolver Program Most of the rest of this document describes from beginning to end how the puzzle solver program works starting with scanning the pieces up until the final output image is generated. Scanning and finding the pieces To get reasonable images to start with, I used a consumer flatbed scanner to scan the pieces. I did this in a dark room with the scanner lid open. This produced a very black background to aid in extracting the pieces. After this was done I could use thresholding to find a binary representation of where pieces are. I with one puzzle I attempted to use color keying. I tried to use the HSV values to isolate only puzzle pieces out of the image. I did not find this as reliable as the thresholding method. Color keying is a bit more complex and I made the decision to abandon going further with it in order to focus more time on other parts of algorithm. The thresholding approach does end up giving me workable results for several different puzzles. Color keying would necessarily need to have the background color chosen so as to be different from the colors in the puzzle. Figure 1. The result of thresholding the left image with a value of 30. 5

6 Filtering The images obtained from the scanner need to be filtered; there is a lot of dust and noise in the images. Along the edges of the pieces there are very small paper fibers that stick out, simply due to the nature of the material that the pieces are made of and how they are cut. The two properties I need to balance when filtering, is to reduce noise to make corner detection easier, while not disturbing the shape too much so that edge comparisons also give high quality results. While doing this project I have tried 3 different filtering techniques in order to produce better corner finding and edge matching. The first attempt was to use an open and close operation on the binary images of the backs of the puzzle pieces. For this I used a 3x3 disk- structuring element. This eliminated the white specks of dust in the binary image, removed all black dots inside of the pieces, and removed some of the noise generated by the thin fibers sticking out. This however did not work for all of the puzzles. For example, in the puzzle piece depicted in figure 2, using a threshold of 30, then performing the opening and closing I get the image in figure 3. This has disconnected most of the fiber poking out, but there is another tiny connected fiber at the neck of the tab at the top. I found this to be pretty unreliable in terms of how consistent it was with different puzzles. I found myself needing to adjust the size of the structuring element for every puzzle I tried to solve, with some never fully working. The next approach I used was a standard Gaussian blur. The blur was done on the original image, converted to gray scale, and then a thresholding operation was applied. This made the edges less noisy, but did not eliminate large anomalies like Figure 2. An example showing a puzzle piece; immediately after bing converted to grayscale. Notice the dust and paper fibers sticking out from the piece. (300 dpi 476x487px) Figure 3. After thresholding at 30 and opening and closing using a 3x3 disk- structuring element. the paper fiber poking out. The more blurring that was done the rounder the sharp corners got, making the corner detection harder. When blurred, as the thresholding value went up, the pieces got slightly smaller. This would mean that the holes in the 6

7 pieces would get bigger and the tabs smaller, resulting in poorer edge comparison results. Figure 4. Left, A threshold of 30, right 70. Figure 5. Gaussian blur, 15x15 square, sigma = 3. The images above depict the results of the Gaussian blur. Although it is hard to see in this picture, the puzzle piece on the right in Figure 4, is a bit smaller than the one on the left due to its higher threshold. Figure 6. Median blur, K=7 The most reliable filtering method I use is a median filter, also known as a despeckle filter. A median filter considers the KxK pixel box surrounding a pixel. The median value from all of the pixels in that box is used as the value for the pixel in question. If you have a very speckled image, say a black background with white spots, the dark background is most likely going to be the median value in the area, so all of the white spots will be replaced with the black value. Using this median filtering technique the quality of results of the edge matching made four out of five of the puzzles solvable. The one that didn t work could still be solved using the opening and closing technique. Figure 7. Median filtered image followed by a threshold of 30. Finding Contours After a quality binary image representation of the pieces is obtained, individual pieces can be found by using OpenCV s findcontours() function. A contour is 7

8 simply a representation of a curve. The findcontours() method takes in a binary image and using a border following technique returns a vector of contours. The algorithm used for OpenCV s implementation is described in [6]. The contours returned are represented as lists of points going in counter- clockwise order around the connected regions. I stayed with this convention throughout the project so everything that has to do with rotations or outer edges is expressed in a counter clockwise fashion. This means that if you were walking along the contour, the puzzle piece would be on your left the entire time. Some extra noise is also eliminated in this step. The size of the contour is an easy way to determine if it is close to the expected size of a puzzle piece. If it is a lot smaller than the expected size, we can safely ignore the contour, because it clearly does not represent a piece. If it is that small it is probably just some dust from the scanner. The contour will help define a bounding box surrounding the piece, using the min and max of the x and y values of all of the points. A 15- pixel border is added to these values and a cropped version of the original color image is obtained. Using the contour I can then draw a new version of the piece with a filled in contour. This will act as the mask that I use when generating the output image of the solution. It will also be used to find the corners of the piece. This image has the advantage of containing exactly one piece and not pieces of others that are possibly partially inside the bounding rectangle of the contour. This mask has the same dimensions as the cropped color image. All of this information is stored in the piece class in my C++ code. These images are passed into the constructor of the piece class, which will then process the images and contours further. Finding the corners Finding the corners of the puzzle pieces is essential in providing places to split up the contour representing the piece into the 4 edges that make up the piece. It also provides known points that will match with other puzzle pieces making it easy to create a transformation matrix to place each piece in the final output image. To find these corners I relied on OpenCV s goodfeaturestotrack() function. I specifically opted for the Harris corner detector. Described in the OpencCV documentation, for each pixel (x,y) it calculates a 2x2 gradient covariance matrix M (x,y) over a blocksize by blocksize neighborhood. Then it computes the following characteristic: dst x, y = detm (!,!) k trm!,!! [7]. The good features to track can extract the local maxima from this matrix and return a list of points of all of the found corners. To find the correct corners using the properties of puzzle pieces will help. The corners are very roughly around the same 8

9 distance from each other. Given that we can estimate the closest two corners can be together we can pass this value in as the parameter mindistance to the function. With this restriction this function will only return the best corners that are at least mindistance away from each other. goodfeaturestotrack() can also take in a quality parameter, qualitylevel. This parameter is a value between 0 and would only allow the best corner. A value of 0.5 would take the strongest corner, multiply its strength by 0.5 and any other corner with a value higher than that would also be included in the output. It is near impossible to pick a value for quality that will work correctly for every piece. Therefore it is necessary to perform a binary search, adjusting the qualitylevel until exactly 4 corners are found. These corners, although close to the correct locations they are not close enough. OpenCV also has a function to refine these corners to a much more precise location called cornersubpix(). As I have experimented with this algorithm, it can become very hard to find the correct corner when the pieces become small. The roundness of the corner seems to stay about the same for any size puzzle piece. So as the pieces get smaller, the corners do not get sharper and eventually some of the holes and tabs are about the same sharpness as the corners. This is the biggest issue I have found in trying to go to puzzles with more pieces. Poorly cut pieces that have anomalies also can sometimes cause a false corner to be detected so it is important to make sure those are fixed before going in the scanner. Figure 8. The left image was used to find the corners, the right image shows the corners marked on the original color image. Incorrectly finding the corners may not always result in an unsolvable puzzle but can significantly affect the quality of the output image. For example, see the figure 9. The incorrect corner affected the other anchor points used in the affine transforms to produce the final output image. 9

10 Figure 9. One misclassified corner in the left image, the resulting solution image on the right. Extracting Edges After the outer contour of the piece is obtained, and the corners are found, the 4 sides of each piece, which I call edges or sides interchangeably, can be extracted. This is important so that edges can be compared independently from each other. The contour is a vector of points, going in counter clockwise order around the piece. To split it up the closest point to each of the found corners in the previous step will be used as beginning and end points. For each corner, the closest point in the contour is found. The corners are then set to these newer even more refined values. The beginning and end of the contour is almost always between two corners. Using the std::rotate() function the contour can be rotated so that the starting point of the contour also corresponds to a corner. Next the indices of the next 3 corners are found inside of the contour. These correspond to where the contour can be cut. They also give the order the corners go in, in counter clockwise order. At this point each piece has individual edges listed in counter clockwise order as well as the corners listed in counter clockwise order. Edge 0 goes from corner 0 to corner 1, edge 1 goes from corner 1 to corner 2 and so on for each edge. Because the edges are going in counter clockwise order, if you walk from the beginning of one edge to the end, the puzzle piece is on the left. These contour pieces are passed into the edge constructor for additional processing. Normalizing Edges To aid in classifying edges, and later comparing edges, I create modified versions of the edge contour. For this I line up the endpoints along the y- axis, and the beginning point is adjusted to be at the origin. The endpoint will be on the positive y- axis down below the x- axis. To do this a rigid transform is used. If we let a be the start of the edge, and b the end of the edge. c=a- b, c is a vector pointing from a to b. The angle that the edge will need to be rotated is θ = cos!! (c. y/ c ). If c.x is less than zero, 10

11 then θ is used. To find the new point locations each point goes through the following transformation: cos θ sin θ a. x edge[i]. x normalized_edge[i] = sin θ cos θ a. y edge[i]. y Now to compare this with another edge, we will need this normalized edge flipped by 180 degrees. Since I had already written the code to normalize the edge in the way above, I just reversed the original edge vector and computed a new reversed_normalized_edge. In the reversed_normalized edge if you walk from beginning to end, the puzzle piece is actually now on the right. Classifying edges Now that we have a consistent representation for each edge, the edges can be classified as outer edges, tabs, or holes. This is needed so that upon comparison the program can immediately avoid comparisons of pieces that obviously don t go together, which would be anything other than a tab and a hole going together. To decide if the edge is an outer edge, the length of the contour representing the edge can be found using OpenCV s arclength() function. This function returns the total length of the contour; this is then compared against the distance between the beginning and end points of the edge. If the contour length is less than 1.3 times the distance between the beginning and end, it is classified as an edge point. I empirically found this to work well by changing the value and looking at its classified edges to make sure that they were correct. To classify the piece as a hole or an edge, I use the fact that the normalized edge is lined up with the y- axis. The minimum and maximum x values along the entire contour can be compared. If the absolute value of the max value is greater than the absolute value of the minimum value, then the piece is classified as a tab, otherwise it is classified as a hole. These types are specified in as an enumerated type. Figure 10. Three edges and the classifications assigned to them, the puzzle piece would be to the right of each one. 11

12 Comparing Edges The purpose of edge comparison is to give a numerical value to describe how well 2 edges fit together. This can also be thought of as a cost; incorrectly matched edges should cost more than correctly matched edges. In that scenario the total cost of the assembled puzzle should be the minimum. OpenCV has an implementation of finding Hu moments in its compare_shapes() function. I found this to produce unsatisfactory results, my best guess as to why this is, is because some of the Hu moments are size and orientation invariant and at a high level the pieces look very similar so not taking size into account could make two incorrectly matched pieces more similar than they actually are. There are quite a few restrictions I have put onto the puzzle to make this edge comparison task easier. The biggest being that each piece needs 4 edges, and that 4 corners meet together unless they are part of the frame. This means that the beginning and ending of one edge would correspond to the ending and beginning of another edge. The pieces are also scanned in at the exact same resolution; so a pair of correctly matched edges would have the same length. Figure 11. The 2 edges compared are mapped onto each other. The cost of the left image is and the cost of the right is Both are correct matches origin. I constructed my own comparison between the edges that works well enough to solve puzzles. To compare 2 edges the program takes the normalized edge of edge a and takes the reversed normalized edge of edge b. Remember that the normalized edge s endpoints are on the y- axis and the beginning is at the origin. For the reversed normalized edge the edge is essentially flipped 180 degrees and its endpoint is now at the The program goes through each point in one contour and finds the closest point in the other contour. All of these distances are added up, and the sum is divided by the length of the edge. This is essentially the average distance between the two edges. A perfect match would be zero. As the edges deviate in shape the value grows. Comparing 2 frame edges from the outside edge of the puzzle will always result in very small costs, to avoid matching to edges together, the program returns a very high number as the cost of merging those two edges. This number needs to just be larger than any other real match could be. The same is done when two holes or tabs are compared. This improves the speed of the algorithm later because it will eliminate some work that would other wise be done. 12

13 When doing a puzzle by hand it feels like a very binary yes or no answer the question: do the pieces fit?. I was hoping for there to be a big jump in cost when comparing pieces that should not go together. The graph below shows the cost for the best 500 edge matches in order from lowest in cost to highest. The 48 piece puzzle is 6 by 8 pieces, so there are only 82 correct matches in total. There is not an obvious jump that can be used to separate the correct matches from the incorrect matches. For this 48 piece puzzle the lowest cost, matches are correct matches. In a 104 piece puzzle, which has 187 possible correct matches, I found within the first 150 lowest cost matches 3 were incorrect. 2.5 Costs for 500 lowest cost matches in 48 pc. puzzle 2 Cost The imperfect results from the comparison algorithm can still usually be used, because the assembly algorithm is robust enough to throw out some logical inconsistencies and produce a correct representation of the puzzle. Assembly Algorithm My assembly algorithm comes pretty much directly from [2]. In that paper the author is concerned with assembling a puzzle of square pieces from a digital image using color information to compare edges. Like the problem described in this paper the pieces go together in a similar fashion, each piece has 4 sides and are arranged in a rectangular grid. I am also able to compare each edge against other edges and associate a cost. To understand how the algorithm works, imagine that you have a disassembled puzzle in front of you. Looking at all of the available ways to put 2 pieces together 13

14 you would select what you think is the best match. Let one of the pieces be A and the other B. Now rotate A so that the edge that will be joined with B is facing the right, and then rotate B so that the edge that will be joined with A will be on the left. Now join the pieces together. Now look again at all of the available ways to put two pieces together and find the best match only looking at 2 pieces at a time. Then join those pieces in the same manner as A and B were joined above. This is done until the puzzle is assembled. When joining the groups of pieces together, if 2 pieces completely overlap, that match is rejected and ignored. The same goes for if 2 pieces are found to be already in the same group, the match is ignored. The basic outline of the assembly algorithm is as follows: 1. Compare all edges against every other edge store the results as a list of matches and associated cost. 2. Sort the results from step 1 based on cost. 3. Use the next unused lowest- cost edge match and try to put the pieces together. If pieces overlap each other, or the pieces are already joined ignore this match. The algorithm borrows ideas from Kruskal s algorithm for finding the minimum spanning tree. In this algorithm, edges of a graph are added in order from the minimum cost to the maximum cost until every node has been added. It also only adds an edge to the MST if it does not create a cycle in the graph. One could think of a puzzle piece as a node in a graph, and a match between the edges of pieces as an edge in the graph. The algorithm also uses a more advanced disjoint set data structure to keep track of which pieces are in the same group. A disjoint set data structure supports 3 operations, make_set(), find(), and merge(). Make set adds an object to the disjoint set structure and makes it its own set with a pointer to itself as its representative. Merge takes 2 objects, finds each of their representatives, and sets one as the new representative of the other. Find returns the representative of an object, it does this by recursively following pointers of representatives until a representative points to itself. If two objects have the same representative, they are said to be in the same set. In the puzzle assembly algorithm the pieces each start out as their own set, and their representative set to themselves. Then when two pieces, say A and B, need to be merged into one set, B s representative might be set to A. Now when you ask B who it s representative is it will return A, and when you ask A the same question, it will also return A. This means they are in the same set. The actual merging is much more complicated, because it will not allow two sets to be merged if it would cause overlap. Overlap being a piece being placed completely on top of another piece. It also keeps track of every set and rotations of the pieces. The premise behind ignoring possible matches because of overlap is that this algorithm assumes that since it is using lower cost matches in the beginning, those 14

15 matches have a much higher chance to be correct than the later, higher cost, matches. So if a match later on in the algorithm causes overlap, it is assuming that that match is incorrect, because pieces merged before fit together even better. A merge rarely fails because of overlapping pieces. It never happens in my 24 piece puzzle, and happens 3 times in my 104 and 48 piece puzzles. Algorithm Implementation To store each match and its score, I have created a struct that holds the index of both edges and the score. I then compare all of the edges against each other and store all of these structs in a vector. I then sort the vector based on the cost. This allows the algorithm to use the best matching pieces first. This part of the assembly algorithm is the most time intensive. If there are N edges then there are N 2 /2 comparisons. It is over 2 because if piece A is compared against piece B, comparing piece B against piece A is not needed. The comparison algorithm internally is N 2 where N is the number of points in the contour. This is also a trivially parallel; using OpenMP this part can become multithreaded with just 3 extra lines of code and a compiler flag. The implementation of this can be found in puzzle.cpp. Next, the algorithm iterates over the vector of matches and costs, merging pieces until the puzzle is solved. If there are N pieces in the puzzle there needs to be N successful merges. The merging is all handled in a data structure I wrote called PuzzleDisjointSet. This data structure supports the same operations as a disjoint set, but it is specialized for this specific puzzle domain. Inside of the loop the merge operation is called on the puzzle disjoint set. It is telling it with what pieces to merge, and what edges to merge the pieces with. If successful it will return true, false otherwise. Unsuccessful merges could happen when two pieces would overlap, or two pieces are already in the same set. The puzzle disjoint set needs to keep track of the relative locations of each piece within a set, and how each piece is rotated so the correct edges line up. To aid in this I have come up with a convention for how sides are numbered, and how rotations are expressed. Starting from the left, each side is numbered in counter clockwise order starting with 0. So left, down, right and up, are 0, 1, 2, and 3 respectively. Because the problem is restricted to puzzles that go together in a grid like fashion, with 4 edges each, the pieces can be rotated in one of four ways. The rotations are expressed in the number of quarter turns counter clockwise the piece has been rotated. I always mod this number by 4 so that the rotation is always between 0 and 3. So when the piece has a rotation of 1, side 0 is now at the bottom, and side 1 is now at the right. To store the relative locations and rotations of each of the pieces, I simply store the integers in an OpenCV integer matrix. Each set has 2 matrices, one for locations and one for rotations. The location matrix has the index number of the piece in its location relative to the other pieces in the set. If a piece does not occupy a grid 15

16 location, - 1 is used as the sentinel value for empty. The rotation matrix has the same dimensions as locations matrix. Each entry in the rotation matrix corresponds to a piece in the same location in the location matrix. The rotation matrix stores values 0 to 4 representing how many quarter turns that piece has been turned relative to its initial starting position. When the puzzle disjoint set is initialized each piece is represented as its own set. Each set will have a 1 by 1 location matrix with its id as the value of its only element. Each set will also have a 1 by 1 rotation matrix that is set to 0. Each set will also be its own representative, by assigning its representative to itself. The representative is simply an integer corresponding to the id of who its representative is. To illustrate how pieces are merged, I will use a simple example. Lets imagine that you have found that piece 5 and 12 need to be merged. Side 0 on piece 5 needs to be joined with side 3 on piece 12. Initially the sets for those two pieces would look like this: Locations matrix Rotations matrix Representative The convention is to always join pieces vertically in the middle. Piece five side 0 is the left side, this means it will need to be rotated 2 quarter turns so that side 0 is on the right. To be able to join side 3 on piece 12, it needs to be rotated 1 quarter turn so that side 3 is facing the right. The updated data structure would look like this: Locations matrix Rotations matrix Representative Next I calculate the size of the matrix needed to store both pieces. In this example it is obvious that it will need 1 row, 2 columns. I also know that piece 12 will go in the second column, so I create 4 new 1x2 matrices 2 of these are to store the locations, and 2 are to store the rotations. The location matrices are initialized to - 1, and the rotations matrix is initialized to 0. I then copy the contents of the location matrix for piece 5 into one of the location matrices with an offset of 0. Followed by copying the 16

17 contents of the location matrix for piece 12 into the other location matrix with an offset of (0,1). I do the same for the rotation matrixes. I now have the following: New location matrices New Rotations matrices I do not copy them into one new matrix, because if there is overlap I would not be able to tell. When combining them now I iterate over all of the positions in the matrices, if both matrices don t have a - 1 as a value in one of the positions then there is overlap and the merge stops and fails here. Otherwise, both of the pieces are joined by combining the matrices. The first piece that was combined will become the new representative for the second piece. The actual representative will hold the new location and rotations matrix. So after a successful merge the disjoint set data structure will have the following data: Locations matrix Rotations matrix Representative Although a set has a member called representative, this does not mean that that id is the true representative. It is simply a pointer to its parent in the tree. To find the actual representative, you need to recursively follow the pointers to representatives until a representative points to itself. That is representative == this.id. This highest representative will contain the locations and rotations of all of the sets below it. If piece 12 above needs to be merged with another piece, the disjoint set data structure will see that it has a representative of 5 and will use the location and rotation matrices listed under 5. After all of the pieces have been placed, you could use any piece id in the disjoint set, find its representative, and you would get the final solution grid. 17

18 The merging operation must handle much more complicated matrices. I encourage anyone interested to look at the join_sets() function in the PuzzleDisjointSet.cpp file. It has many comments and you can follow the procedure that will work when merging any complicated pair of sets. After the assembly algorithm is complete, a location matrix and rotation matrix is obtained that describes how each piece fits with the other pieces. In Matlab notation this is what the matrices look like for a solved 104 piece puzzle. Locations: [37, 59, 92, 85, 79, 24, 4, 96, 71, 73, 10, 2, 25; 30, 81, 34, 18, 42, 86, 89, 103, 70, 38, 20, 74, 94; 87, 23, 1, 32, 22, 65, 99, 82, 7, 14, 72, 57, 97; 29, 12, 16, 44, 21, 98, 17, 6, 53, 90, 66, 26, 19; 31, 8, 39, 95, 91, 88, 69, 102, 11, 101, 49, 13, 55; 27, 60, 68, 33, 64, 61, 51, 78, 54, 52, 35, 83, 93; 75, 28, 46, 77, 5, 67, 62, 80, 41, 47, 40, 50, 100; 76, 15, 43, 84, 0, 36, 63, 58, 9, 45, 56, 48, 3] Rotations: [0, 3, 2, 0, 1, 1, 1, 2, 1, 3, 3, 2, 0; 0, 2, 0, 2, 1, 2, 0, 1, 3, 0, 2, 3, 2; 1, 2, 0, 0, 0, 0, 2, 1, 1, 3, 1, 1, 1; 0, 1, 0, 3, 0, 0, 2, 0, 2, 3, 2, 1, 2; 0, 0, 2, 2, 0, 3, 3, 1, 1, 0, 1, 2, 1; 0, 0, 2, 2, 0, 0, 2, 0, 2, 0, 1, 1, 3; 3, 0, 2, 2, 2, 1, 0, 0, 1, 2, 1, 0, 2; 1, 2, 2, 0, 2, 3, 2, 0, 1, 0, 3, 0, 2] Creating the output image Given the relative locations and rotations, the pieces can be placed into an output image using affine transforms. I have tried using rigid transforms, but the resulting image is not as aesthetically pleasing, and generally the pieces are not distorted too much when using an affine transform. To do this I start with the upper left hand corner (0,0) of the location and rotation matrix. Looking at the rotation matrix, I can calculate which corner goes in the upper left of the image. With a rotation of 0, it will be corner 0; with a rotation of 1 it will be 3 etc. Using the above locations and rotations, corner 0 will need to be placed in at point (10,10). (10,10), because I use a 10 pixel border so it doesn t run right up to the edge of the picture. To calculate the affine transform I need 2 more mappings. I can calculate the distance between corner 0 and corner 3. If I let d be this distance, then corner 3 maps to (10+d,10). If e is the distance between corner 0 and corner 1, then corner 1 maps to (10,10+e). OpenCV has a function to calculate the affine transform matrix between the original locations and the desired locations. Then using this transformation matrix, the original color image of the piece, and the black 18

19 and white binary image as a mask, the piece can be affine transformed into place in the final output image. This is done using OpenCV s warpaffine() function. For the rest of the pieces, I use the locations of the corners of the previously placed as the anchor points for the corners of the current piece in question. Because of this dependence, sometimes the final image can be a little off. Any error is passed along to the next calculation. You can see in the final output images that this usually causes one of the outer edges of the puzzle to be at a slight angle compared to where it should be. If the puzzle was not solved successfully and there are - 1 values inside the locations matrix representing empty places. The image saving routine will stop at its first - 1 and save only the partial results. This is because I have not implemented a strategy to handle holes. Creating the output image is a very computationally intensive task, and takes the longest out of any part of the program. With a 104 piece puzzle, this takes 60% of the computation time. I think that this could be improved if the affine transforms were processed on the graphics card instead of in the CPU. Runtime The runtime will always be different depending on the computer that it is running on. So I will give the results that I see on my computer to give a realistic estimate of runtime. For reference I run this program on a mid 2011 MacBook Air, 4 GB ram, i5 1.7 GHz, 2 hyper- threaded cores. Initialization is the time to read in the images, find the pieces, edges etc. Solving the puzzle includes finding the edge costs and assembling the puzzle. Draw output is the time it takes to place each piece in the output image and save the output image. Number of Pieces Initialization (s) Solve puzzle (s) Draw output (s) Total time (s) Testing To test this program I heavily relied on generating output images for each of the stages. Many of the pictures in this paper came directly from those tests. For example to make sure that the classification of edges was correct I printed out each edge and its classification into an image and saved it to disk. I then could go though and see if each edge and visually tell if each edge was classified successfully. To test and the assembly algorithm I stepped through the results of each merge. While at the same time merging the same pieces of the actual physical puzzle. This 19

20 was done when initially trying to solve the 24 piece puzzle. For the larger puzzles the program produced correct results so it was assumed that the assembly algorithm was working, as it should. The program can still produce all of these debugging images. I have simply commented them out with a description of what each of the blocks of debugging code does. Limits of the program and possible improvements Aside from the restrictions that I placed on this problem, there are still some improvements that could be made to enhance the quality of results. Notably improving piece finding and corner detection. This program is still a bit unstable when it comes to solving puzzles using the front side of the puzzle. This is due to the fact that the puzzles will almost always have some black areas in them. One possible way to solve this problem is to use a different colored background, something very different from any of the colors in the puzzle. Any pixel different from that background color could then be classified as a pixel in a puzzle piece. I have tried this method, but the puzzles I have contain a wide variety of colors and it was very difficult to find a piece of paper that was not the same color as a part of the puzzle. I think that working on this problem would be a reasonable effort and could even improve the quality of the contour and help produce even better quality scores between matches of pieces. When trying to go from a 104 piece puzzle to a 300 piece puzzle, the biggest problem I had was trying to successfully find the corners. The main problem with going to puzzles with more pieces is the fact that the pieces get much smaller. As the pieces get smaller the noise of small paper fibers and the sharpness of the corners stays about the same. The smaller pieces have tighter curves for the holes and tabs, so the sharpness of the corners relative to the sharpness of the holes and tabs is even closer. To a corner- detecting algorithm, the tabs look like very good corner candidates. I would suggest a more advanced corner- detecting algorithm that uses some more domain specific features to find the correct corners might be more successful. Accomplishments This program has solved front and back scans of a 24 and 48 piece puzzles. It also has solved a 104 pc puzzle using just the backside. It can solve any of these puzzles in less than 1.5 minutes on a dual core, 1.7 GHz, i5 processor when compiled with the Intel C++ Compiler and aggressive optimizations. Appendix A shows each of the 5 puzzles it has solved, with an example of one of the input images for each puzzle. 20

21 Obtaining Source Code The source code is included in this document in Appendix B. However an easier to read and download version is stored in a Git repository online at there you can browse the source code online and read my instructions on how to compile and run. Also included in the repository are all of my input images for several puzzles. References [1] H. Wolfson et al. "Solving jigsaw puzzles by computer," Annals of Operations Research, Vol. 12 Issue 1-4, pp , Dec [2] A. C. Gallagher, "Jigsaw puzzles with pieces of unknown orientation," cvpr, pp , 2012 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2012 [3] M. Sarfraz et al. "A new approach to corner detection," in Computer Vision and Graphics, International Conference, Warsaw, Poland pp , [4] M. K. Hu, "Visual Pattern Recognition by Moment Invariants", IRE Trans. Info. Theory, vol. IT- 8, pp , 1962 [5] D. P. Huttenlocher, "Comparing images using the Hausdorff distance," IEEE Trans. Pattern Anal. Mach. Intell. Vol. 15 Issue 549, pp , Sep [6] Suzuki, S. and Abe, K., Topological Structural Analysis of Digitized Binary Images by Border Following. CVGIP 30 1, pp [7] OpenCV. (Apr. 11, 2013)OpenCV documentation. [Online] Avaliable: 21

22 Appendix Appendix A: Solved Puzzles Angry Birds Front, 24 pc 22

23 Angry Birds back, 24 pc 23

24 Toy Story Front, 48 pc 24

25 Toy Story Back, 48 pc 25

26 104 pc puzzle back 26

27 27

28 Appendix B: Source Code main.cpp // // main.cpp // PuzzleSolver // // Created by Joe Zeimen on 4/4/13. // Copyright (c) 2013 Joe Zeimen. All rights reserved. // #include <iostream> #include <string.h> #include "puzzle.h" #include <cassert> #include "util.h" #include "PuzzleDisjointSet.h" #include <sys/time.h> //Dont forget final "/" in directory name. static const std::string input = "/Users/jzeimen/Documents/school/College/Spring2013/ComputerVision/FinalProject/PuzzleSolver/PuzzleSo lver/scans/"; static const std::string output = "/tmp/final/finaloutput.png"; int main(int argc, const char * argv[]) { std::cout << "Starting..." << std::endl; timeval time; gettimeofday(&time, NULL); long millis = (time.tv_sec * 1000) + (time.tv_usec / 1000); long inbetween_millis = millis; //Toy Story Color & breaks with median filter, needs filter() 48 pc // puzzle puzzle(input+"toy Story/", 200, 22, false); //Toy Story back works w/ median filter 48pc // puzzle puzzle(input+"toy Story back/", 200, 50); //Angry Birds color works with median, or filter 24 pc // puzzle puzzle(input+"angry Birds/color/",300,30); //Angry Birds back works with median 24 pc // puzzle puzzle(input+"angry Birds/Scanner Open/",300,30); //Horses back not numbered 104 pc // puzzle puzzle(input+"horses/", 380, 50); //Horses back numbered 104 pc puzzle puzzle(input+"horses numbered/", 380, 50); gettimeofday(&time, NULL); std::cout << std::endl << "time to initialize:" << (((time.tv_sec * 1000) + (time.tv_usec / 1000))- inbetween_millis)/ << std::endl; inbetween_millis = ((time.tv_sec * 1000) + (time.tv_usec / 1000)); puzzle.solve(); gettimeofday(&time, NULL); std::cout << std::endl << "time to solve:" << (((time.tv_sec * 1000) + (time.tv_usec / 1000))- inbetween_millis)/ << std::endl; inbetween_millis = ((time.tv_sec * 1000) + (time.tv_usec / 1000)); puzzle.save_image(output); 28

Implementation of Canny Edge Detector of color images on CELL/B.E. Architecture.

Implementation of Canny Edge Detector of color images on CELL/B.E. Architecture. Implementation of Canny Edge Detector of color images on CELL/B.E. Architecture. Chirag Gupta,Sumod Mohan K cgupta@clemson.edu, sumodm@clemson.edu Abstract In this project we propose a method to improve

More information

Solving the Rubik's Revenge (4x4x4) Home Pre-Solution Stuff Step 1 Step 2 Step 3 Solution Moves Lists

Solving the Rubik's Revenge (4x4x4) Home Pre-Solution Stuff Step 1 Step 2 Step 3 Solution Moves Lists Solving your Rubik's Revenge (4x4x4) 07/16/2007 12:59 AM Solving the Rubik's Revenge (4x4x4) Home Pre-Solution Stuff Step 1 Step 2 Step 3 Solution Moves Lists Turn this... Into THIS! To solve the Rubik's

More information

Analysis of Micromouse Maze Solving Algorithms

Analysis of Micromouse Maze Solving Algorithms 1 Analysis of Micromouse Maze Solving Algorithms David M. Willardson ECE 557: Learning from Data, Spring 2001 Abstract This project involves a simulation of a mouse that is to find its way through a maze.

More information

CALCULATIONS & STATISTICS

CALCULATIONS & STATISTICS CALCULATIONS & STATISTICS CALCULATION OF SCORES Conversion of 1-5 scale to 0-100 scores When you look at your report, you will notice that the scores are reported on a 0-100 scale, even though respondents

More information

Object Recognition and Template Matching

Object Recognition and Template Matching Object Recognition and Template Matching Template Matching A template is a small image (sub-image) The goal is to find occurrences of this template in a larger image That is, you want to find matches of

More information

More Local Structure Information for Make-Model Recognition

More Local Structure Information for Make-Model Recognition More Local Structure Information for Make-Model Recognition David Anthony Torres Dept. of Computer Science The University of California at San Diego La Jolla, CA 9093 Abstract An object classification

More information

Canny Edge Detection

Canny Edge Detection Canny Edge Detection 09gr820 March 23, 2009 1 Introduction The purpose of edge detection in general is to significantly reduce the amount of data in an image, while preserving the structural properties

More information

Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract

Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 7, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic skills.

More information

LESSON 7: IMPORTING AND VECTORIZING A BITMAP IMAGE

LESSON 7: IMPORTING AND VECTORIZING A BITMAP IMAGE LESSON 7: IMPORTING AND VECTORIZING A BITMAP IMAGE In this lesson we ll learn how to import a bitmap logo, transform it into a vector and perform some editing on the vector to clean it up. The concepts

More information

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system 1. Systems of linear equations We are interested in the solutions to systems of linear equations. A linear equation is of the form 3x 5y + 2z + w = 3. The key thing is that we don t multiply the variables

More information

Session 7 Bivariate Data and Analysis

Session 7 Bivariate Data and Analysis Session 7 Bivariate Data and Analysis Key Terms for This Session Previously Introduced mean standard deviation New in This Session association bivariate analysis contingency table co-variation least squares

More information

Using Microsoft Word. Working With Objects

Using Microsoft Word. Working With Objects Using Microsoft Word Many Word documents will require elements that were created in programs other than Word, such as the picture to the right. Nontext elements in a document are referred to as Objects

More information

Matt Cabot Rory Taca QR CODES

Matt Cabot Rory Taca QR CODES Matt Cabot Rory Taca QR CODES QR codes were designed to assist in the manufacturing plants of the automotive industry. These easy to scan codes allowed for a rapid way to identify parts and made the entire

More information

Random Map Generator v1.0 User s Guide

Random Map Generator v1.0 User s Guide Random Map Generator v1.0 User s Guide Jonathan Teutenberg 2003 1 Map Generation Overview...4 1.1 Command Line...4 1.2 Operation Flow...4 2 Map Initialisation...5 2.1 Initialisation Parameters...5 -w xxxxxxx...5

More information

Grade 7/8 Math Circles November 3/4, 2015. M.C. Escher and Tessellations

Grade 7/8 Math Circles November 3/4, 2015. M.C. Escher and Tessellations Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Tiling the Plane Grade 7/8 Math Circles November 3/4, 2015 M.C. Escher and Tessellations Do the following

More information

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92. Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

More information

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. Unit 1 Number Sense In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. BLM Three Types of Percent Problems (p L-34) is a summary BLM for the material

More information

Extend Table Lens for High-Dimensional Data Visualization and Classification Mining

Extend Table Lens for High-Dimensional Data Visualization and Classification Mining Extend Table Lens for High-Dimensional Data Visualization and Classification Mining CPSC 533c, Information Visualization Course Project, Term 2 2003 Fengdong Du fdu@cs.ubc.ca University of British Columbia

More information

How To Fix Out Of Focus And Blur Images With A Dynamic Template Matching Algorithm

How To Fix Out Of Focus And Blur Images With A Dynamic Template Matching Algorithm IJSTE - International Journal of Science Technology & Engineering Volume 1 Issue 10 April 2015 ISSN (online): 2349-784X Image Estimation Algorithm for Out of Focus and Blur Images to Retrieve the Barcode

More information

Tom wants to find two real numbers, a and b, that have a sum of 10 and have a product of 10. He makes this table.

Tom wants to find two real numbers, a and b, that have a sum of 10 and have a product of 10. He makes this table. Sum and Product This problem gives you the chance to: use arithmetic and algebra to represent and analyze a mathematical situation solve a quadratic equation by trial and improvement Tom wants to find

More information

Radius Compensation G40, G41, & G42 (cutter radius compensation for machining centers, tool nose radius compensation for turning centers)

Radius Compensation G40, G41, & G42 (cutter radius compensation for machining centers, tool nose radius compensation for turning centers) Radius Compensation G40, G41, & G42 (cutter radius compensation for machining centers, tool nose radius compensation for turning centers) These features are commonly well covered in most basic CNC courses.

More information

Scanners and How to Use Them

Scanners and How to Use Them Written by Jonathan Sachs Copyright 1996-1999 Digital Light & Color Introduction A scanner is a device that converts images to a digital file you can use with your computer. There are many different types

More information

Digital Imaging and Multimedia. Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

Digital Imaging and Multimedia. Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University Digital Imaging and Multimedia Filters Ahmed Elgammal Dept. of Computer Science Rutgers University Outlines What are Filters Linear Filters Convolution operation Properties of Linear Filters Application

More information

Convolution. 1D Formula: 2D Formula: Example on the web: http://www.jhu.edu/~signals/convolve/

Convolution. 1D Formula: 2D Formula: Example on the web: http://www.jhu.edu/~signals/convolve/ Basic Filters (7) Convolution/correlation/Linear filtering Gaussian filters Smoothing and noise reduction First derivatives of Gaussian Second derivative of Gaussian: Laplacian Oriented Gaussian filters

More information

G E N E R A L A P P R O A CH: LO O K I N G F O R D O M I N A N T O R I E N T A T I O N I N I M A G E P A T C H E S

G E N E R A L A P P R O A CH: LO O K I N G F O R D O M I N A N T O R I E N T A T I O N I N I M A G E P A T C H E S G E N E R A L A P P R O A CH: LO O K I N G F O R D O M I N A N T O R I E N T A T I O N I N I M A G E P A T C H E S In object categorization applications one of the main problems is that objects can appear

More information

TEACHER S GUIDE TO RUSH HOUR

TEACHER S GUIDE TO RUSH HOUR Using Puzzles to Teach Problem Solving TEACHER S GUIDE TO RUSH HOUR Includes Rush Hour 2, 3, 4, Rush Hour Jr., Railroad Rush Hour and Safari Rush Hour BENEFITS Rush Hour is a sliding piece puzzle that

More information

Environmental Remote Sensing GEOG 2021

Environmental Remote Sensing GEOG 2021 Environmental Remote Sensing GEOG 2021 Lecture 4 Image classification 2 Purpose categorising data data abstraction / simplification data interpretation mapping for land cover mapping use land cover class

More information

What Resolution Should Your Images Be?

What Resolution Should Your Images Be? What Resolution Should Your Images Be? The best way to determine the optimum resolution is to think about the final use of your images. For publication you ll need the highest resolution, for desktop printing

More information

Lesson 26: Reflection & Mirror Diagrams

Lesson 26: Reflection & Mirror Diagrams Lesson 26: Reflection & Mirror Diagrams The Law of Reflection There is nothing really mysterious about reflection, but some people try to make it more difficult than it really is. All EMR will reflect

More information

Introduction to Matrices

Introduction to Matrices Introduction to Matrices Tom Davis tomrdavis@earthlinknet 1 Definitions A matrix (plural: matrices) is simply a rectangular array of things For now, we ll assume the things are numbers, but as you go on

More information

Augmented Reality Tic-Tac-Toe

Augmented Reality Tic-Tac-Toe Augmented Reality Tic-Tac-Toe Joe Maguire, David Saltzman Department of Electrical Engineering jmaguire@stanford.edu, dsaltz@stanford.edu Abstract: This project implements an augmented reality version

More information

Using Neural Networks to Create an Adaptive Character Recognition System

Using Neural Networks to Create an Adaptive Character Recognition System Using Neural Networks to Create an Adaptive Character Recognition System Alexander J. Faaborg Cornell University, Ithaca NY (May 14, 2002) Abstract A back-propagation neural network with one hidden layer

More information

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite ALGEBRA Pupils should be taught to: Generate and describe sequences As outcomes, Year 7 pupils should, for example: Use, read and write, spelling correctly: sequence, term, nth term, consecutive, rule,

More information

A System for Capturing High Resolution Images

A System for Capturing High Resolution Images A System for Capturing High Resolution Images G.Voyatzis, G.Angelopoulos, A.Bors and I.Pitas Department of Informatics University of Thessaloniki BOX 451, 54006 Thessaloniki GREECE e-mail: pitas@zeus.csd.auth.gr

More information

Independent samples t-test. Dr. Tom Pierce Radford University

Independent samples t-test. Dr. Tom Pierce Radford University Independent samples t-test Dr. Tom Pierce Radford University The logic behind drawing causal conclusions from experiments The sampling distribution of the difference between means The standard error of

More information

5.5. Solving linear systems by the elimination method

5.5. Solving linear systems by the elimination method 55 Solving linear systems by the elimination method Equivalent systems The major technique of solving systems of equations is changing the original problem into another one which is of an easier to solve

More information

Example Chapter 08-Number 09: This example demonstrates some simple uses of common canned effects found in popular photo editors to stylize photos.

Example Chapter 08-Number 09: This example demonstrates some simple uses of common canned effects found in popular photo editors to stylize photos. 08 SPSE ch08 2/22/10 11:34 AM Page 156 156 Secrets of ProShow Experts: The Official Guide to Creating Your Best Slide Shows with ProShow Gold and Producer Figure 8.18 Using the same image washed out and

More information

1. I have 4 sides. My opposite sides are equal. I have 4 right angles. Which shape am I?

1. I have 4 sides. My opposite sides are equal. I have 4 right angles. Which shape am I? Which Shape? This problem gives you the chance to: identify and describe shapes use clues to solve riddles Use shapes A, B, or C to solve the riddles. A B C 1. I have 4 sides. My opposite sides are equal.

More information

Simplifying Logic Circuits with Karnaugh Maps

Simplifying Logic Circuits with Karnaugh Maps Simplifying Logic Circuits with Karnaugh Maps The circuit at the top right is the logic equivalent of the Boolean expression: f = abc + abc + abc Now, as we have seen, this expression can be simplified

More information

Building A Computer: A Beginners Guide

Building A Computer: A Beginners Guide Building A Computer: A Beginners Guide Mr. Marty Brandl The following was written to help an individual setup a Pentium 133 system using an ASUS P/I- P55T2P4 motherboard. The tutorial includes the installation

More information

Pigeonhole Principle Solutions

Pigeonhole Principle Solutions Pigeonhole Principle Solutions 1. Show that if we take n + 1 numbers from the set {1, 2,..., 2n}, then some pair of numbers will have no factors in common. Solution: Note that consecutive numbers (such

More information

Morphological segmentation of histology cell images

Morphological segmentation of histology cell images Morphological segmentation of histology cell images A.Nedzved, S.Ablameyko, I.Pitas Institute of Engineering Cybernetics of the National Academy of Sciences Surganova, 6, 00 Minsk, Belarus E-mail abl@newman.bas-net.by

More information

The Effects of Start Prices on the Performance of the Certainty Equivalent Pricing Policy

The Effects of Start Prices on the Performance of the Certainty Equivalent Pricing Policy BMI Paper The Effects of Start Prices on the Performance of the Certainty Equivalent Pricing Policy Faculty of Sciences VU University Amsterdam De Boelelaan 1081 1081 HV Amsterdam Netherlands Author: R.D.R.

More information

The Taxman Game. Robert K. Moniot September 5, 2003

The Taxman Game. Robert K. Moniot September 5, 2003 The Taxman Game Robert K. Moniot September 5, 2003 1 Introduction Want to know how to beat the taxman? Legally, that is? Read on, and we will explore this cute little mathematical game. The taxman game

More information

An Introduction to Point Pattern Analysis using CrimeStat

An Introduction to Point Pattern Analysis using CrimeStat Introduction An Introduction to Point Pattern Analysis using CrimeStat Luc Anselin Spatial Analysis Laboratory Department of Agricultural and Consumer Economics University of Illinois, Urbana-Champaign

More information

Protocol for Microscope Calibration

Protocol for Microscope Calibration Protocol for Microscope Calibration A properly calibrated system is essential for successful and efficient software use. The following are step by step instructions on how to calibrate the hardware using

More information

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach

More information

Machine vision systems - 2

Machine vision systems - 2 Machine vision systems Problem definition Image acquisition Image segmentation Connected component analysis Machine vision systems - 1 Problem definition Design a vision system to see a flat world Page

More information

Text Analytics Illustrated with a Simple Data Set

Text Analytics Illustrated with a Simple Data Set CSC 594 Text Mining More on SAS Enterprise Miner Text Analytics Illustrated with a Simple Data Set This demonstration illustrates some text analytic results using a simple data set that is designed to

More information

CATIA Functional Tolerancing & Annotation TABLE OF CONTENTS

CATIA Functional Tolerancing & Annotation TABLE OF CONTENTS TABLE OF CONTENTS Introduction...1 Functional Tolerancing and Annotation...2 Pull-down Menus...3 Insert...3 Functional Tolerancing and Annotation Workbench...4 Bottom Toolbar Changes...5 3D Grid Toolbar...5

More information

Lecture 2 Mathcad Basics

Lecture 2 Mathcad Basics Operators Lecture 2 Mathcad Basics + Addition, - Subtraction, * Multiplication, / Division, ^ Power ( ) Specify evaluation order Order of Operations ( ) ^ highest level, first priority * / next priority

More information

Visual Structure Analysis of Flow Charts in Patent Images

Visual Structure Analysis of Flow Charts in Patent Images Visual Structure Analysis of Flow Charts in Patent Images Roland Mörzinger, René Schuster, András Horti, and Georg Thallinger JOANNEUM RESEARCH Forschungsgesellschaft mbh DIGITAL - Institute for Information

More information

Decision Theory. 36.1 Rational prospecting

Decision Theory. 36.1 Rational prospecting 36 Decision Theory Decision theory is trivial, apart from computational details (just like playing chess!). You have a choice of various actions, a. The world may be in one of many states x; which one

More information

Reflection and Refraction

Reflection and Refraction Equipment Reflection and Refraction Acrylic block set, plane-concave-convex universal mirror, cork board, cork board stand, pins, flashlight, protractor, ruler, mirror worksheet, rectangular block worksheet,

More information

Grade 4 Unit 3: Multiplication and Division; Number Sentences and Algebra

Grade 4 Unit 3: Multiplication and Division; Number Sentences and Algebra Grade 4 Unit 3: Multiplication and Division; Number Sentences and Algebra Activity Lesson 3-1 What s My Rule? page 159) Everyday Mathematics Goal for Mathematical Practice GMP 2.2 Explain the meanings

More information

A HYBRID APPROACH FOR AUTOMATED AREA AGGREGATION

A HYBRID APPROACH FOR AUTOMATED AREA AGGREGATION A HYBRID APPROACH FOR AUTOMATED AREA AGGREGATION Zeshen Wang ESRI 380 NewYork Street Redlands CA 92373 Zwang@esri.com ABSTRACT Automated area aggregation, which is widely needed for mapping both natural

More information

The Role of Size Normalization on the Recognition Rate of Handwritten Numerals

The Role of Size Normalization on the Recognition Rate of Handwritten Numerals The Role of Size Normalization on the Recognition Rate of Handwritten Numerals Chun Lei He, Ping Zhang, Jianxiong Dong, Ching Y. Suen, Tien D. Bui Centre for Pattern Recognition and Machine Intelligence,

More information

MATH2210 Notebook 1 Fall Semester 2016/2017. 1 MATH2210 Notebook 1 3. 1.1 Solving Systems of Linear Equations... 3

MATH2210 Notebook 1 Fall Semester 2016/2017. 1 MATH2210 Notebook 1 3. 1.1 Solving Systems of Linear Equations... 3 MATH0 Notebook Fall Semester 06/07 prepared by Professor Jenny Baglivo c Copyright 009 07 by Jenny A. Baglivo. All Rights Reserved. Contents MATH0 Notebook 3. Solving Systems of Linear Equations........................

More information

521466S Machine Vision Assignment #7 Hough transform

521466S Machine Vision Assignment #7 Hough transform 521466S Machine Vision Assignment #7 Hough transform Spring 2014 In this assignment we use the hough transform to extract lines from images. We use the standard (r, θ) parametrization of lines, lter the

More information

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list

Scan-Line Fill. Scan-Line Algorithm. Sort by scan line Fill each span vertex order generated by vertex list Scan-Line Fill Can also fill by maintaining a data structure of all intersections of polygons with scan lines Sort by scan line Fill each span vertex order generated by vertex list desired order Scan-Line

More information

Linear Programming for Optimization. Mark A. Schulze, Ph.D. Perceptive Scientific Instruments, Inc.

Linear Programming for Optimization. Mark A. Schulze, Ph.D. Perceptive Scientific Instruments, Inc. 1. Introduction Linear Programming for Optimization Mark A. Schulze, Ph.D. Perceptive Scientific Instruments, Inc. 1.1 Definition Linear programming is the name of a branch of applied mathematics that

More information

Area and Perimeter: The Mysterious Connection TEACHER EDITION

Area and Perimeter: The Mysterious Connection TEACHER EDITION Area and Perimeter: The Mysterious Connection TEACHER EDITION (TC-0) In these problems you will be working on understanding the relationship between area and perimeter. Pay special attention to any patterns

More information

Introduction Solvability Rules Computer Solution Implementation. Connect Four. March 9, 2010. Connect Four

Introduction Solvability Rules Computer Solution Implementation. Connect Four. March 9, 2010. Connect Four March 9, 2010 is a tic-tac-toe like game in which two players drop discs into a 7x6 board. The first player to get four in a row (either vertically, horizontally, or diagonally) wins. The game was first

More information

6.4 Normal Distribution

6.4 Normal Distribution Contents 6.4 Normal Distribution....................... 381 6.4.1 Characteristics of the Normal Distribution....... 381 6.4.2 The Standardized Normal Distribution......... 385 6.4.3 Meaning of Areas under

More information

If you know exactly how you want your business forms to look and don t mind

If you know exactly how you want your business forms to look and don t mind appendix e Advanced Form Customization If you know exactly how you want your business forms to look and don t mind detail work, you can configure QuickBooks forms however you want. With QuickBooks Layout

More information

Analecta Vol. 8, No. 2 ISSN 2064-7964

Analecta Vol. 8, No. 2 ISSN 2064-7964 EXPERIMENTAL APPLICATIONS OF ARTIFICIAL NEURAL NETWORKS IN ENGINEERING PROCESSING SYSTEM S. Dadvandipour Institute of Information Engineering, University of Miskolc, Egyetemváros, 3515, Miskolc, Hungary,

More information

Elfring Fonts, Inc. PCL MICR Fonts

Elfring Fonts, Inc. PCL MICR Fonts Elfring Fonts, Inc. PCL MICR Fonts This package contains five MICR fonts (also known as E-13B), to print magnetic encoding on checks, and six Secure Number fonts, to print check amounts. These fonts come

More information

VECTORAL IMAGING THE NEW DIRECTION IN AUTOMATED OPTICAL INSPECTION

VECTORAL IMAGING THE NEW DIRECTION IN AUTOMATED OPTICAL INSPECTION VECTORAL IMAGING THE NEW DIRECTION IN AUTOMATED OPTICAL INSPECTION Mark J. Norris Vision Inspection Technology, LLC Haverhill, MA mnorris@vitechnology.com ABSTRACT Traditional methods of identifying and

More information

CHAPTER 14 NONPARAMETRIC TESTS

CHAPTER 14 NONPARAMETRIC TESTS CHAPTER 14 NONPARAMETRIC TESTS Everything that we have done up until now in statistics has relied heavily on one major fact: that our data is normally distributed. We have been able to make inferences

More information

Reading 13 : Finite State Automata and Regular Expressions

Reading 13 : Finite State Automata and Regular Expressions CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

More information

Colour Image Segmentation Technique for Screen Printing

Colour Image Segmentation Technique for Screen Printing 60 R.U. Hewage and D.U.J. Sonnadara Department of Physics, University of Colombo, Sri Lanka ABSTRACT Screen-printing is an industry with a large number of applications ranging from printing mobile phone

More information

Solutions to Math 51 First Exam January 29, 2015

Solutions to Math 51 First Exam January 29, 2015 Solutions to Math 5 First Exam January 29, 25. ( points) (a) Complete the following sentence: A set of vectors {v,..., v k } is defined to be linearly dependent if (2 points) there exist c,... c k R, not

More information

Simple Regression Theory II 2010 Samuel L. Baker

Simple Regression Theory II 2010 Samuel L. Baker SIMPLE REGRESSION THEORY II 1 Simple Regression Theory II 2010 Samuel L. Baker Assessing how good the regression equation is likely to be Assignment 1A gets into drawing inferences about how close the

More information

Using Image J to Measure the Brightness of Stars (Written by Do H. Kim)

Using Image J to Measure the Brightness of Stars (Written by Do H. Kim) Using Image J to Measure the Brightness of Stars (Written by Do H. Kim) What is Image J? Image J is Java-based image processing program developed at the National Institutes of Health. Image J runs on everywhere,

More information

Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1.

Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1. Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 1 Quiz 1 Do not open this quiz booklet until you are directed

More information

Sudoku puzzles and how to solve them

Sudoku puzzles and how to solve them Sudoku puzzles and how to solve them Andries E. Brouwer 2006-05-31 1 Sudoku Figure 1: Two puzzles the second one is difficult A Sudoku puzzle (of classical type ) consists of a 9-by-9 matrix partitioned

More information

The Basics of a Rotary Table with Cross Slide mounted on a Mill Table, Version 2

The Basics of a Rotary Table with Cross Slide mounted on a Mill Table, Version 2 The Basics of a Rotary Table with Cross Slide mounted on a Mill Table, Version 2 by Gerry Goldberg as told to Rick Sparber 08/21/2008 Copyleft protects this article. On 08/16/2008 the Valley Metal Club

More information

Gas Dynamics Prof. T. M. Muruganandam Department of Aerospace Engineering Indian Institute of Technology, Madras. Module No - 12 Lecture No - 25

Gas Dynamics Prof. T. M. Muruganandam Department of Aerospace Engineering Indian Institute of Technology, Madras. Module No - 12 Lecture No - 25 (Refer Slide Time: 00:22) Gas Dynamics Prof. T. M. Muruganandam Department of Aerospace Engineering Indian Institute of Technology, Madras Module No - 12 Lecture No - 25 Prandtl-Meyer Function, Numerical

More information

Fingerprint s Core Point Detection using Gradient Field Mask

Fingerprint s Core Point Detection using Gradient Field Mask Fingerprint s Core Point Detection using Gradient Field Mask Ashish Mishra Assistant Professor Dept. of Computer Science, GGCT, Jabalpur, [M.P.], Dr.Madhu Shandilya Associate Professor Dept. of Electronics.MANIT,Bhopal[M.P.]

More information

Lesson #13 Congruence, Symmetry and Transformations: Translations, Reflections, and Rotations

Lesson #13 Congruence, Symmetry and Transformations: Translations, Reflections, and Rotations Math Buddies -Grade 4 13-1 Lesson #13 Congruence, Symmetry and Transformations: Translations, Reflections, and Rotations Goal: Identify congruent and noncongruent figures Recognize the congruence of plane

More information

The 2010 British Informatics Olympiad

The 2010 British Informatics Olympiad Time allowed: 3 hours The 2010 British Informatics Olympiad Instructions You should write a program for part (a) of each question, and produce written answers to the remaining parts. Programs may be used

More information

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

WRITING PROOFS. Christopher Heil Georgia Institute of Technology WRITING PROOFS Christopher Heil Georgia Institute of Technology A theorem is just a statement of fact A proof of the theorem is a logical explanation of why the theorem is true Many theorems have this

More information

14:440:127 Introduction to Computers for Engineers. Notes for Lecture 06

14:440:127 Introduction to Computers for Engineers. Notes for Lecture 06 14:440:127 Introduction to Computers for Engineers Notes for Lecture 06 Rutgers University, Spring 2010 Instructor- Blase E. Ur 1 Loop Examples 1.1 Example- Sum Primes Let s say we wanted to sum all 1,

More information

Speed Performance Improvement of Vehicle Blob Tracking System

Speed Performance Improvement of Vehicle Blob Tracking System Speed Performance Improvement of Vehicle Blob Tracking System Sung Chun Lee and Ram Nevatia University of Southern California, Los Angeles, CA 90089, USA sungchun@usc.edu, nevatia@usc.edu Abstract. A speed

More information

New Hash Function Construction for Textual and Geometric Data Retrieval

New Hash Function Construction for Textual and Geometric Data Retrieval Latest Trends on Computers, Vol., pp.483-489, ISBN 978-96-474-3-4, ISSN 79-45, CSCC conference, Corfu, Greece, New Hash Function Construction for Textual and Geometric Data Retrieval Václav Skala, Jan

More information

Working with whole numbers

Working with whole numbers 1 CHAPTER 1 Working with whole numbers In this chapter you will revise earlier work on: addition and subtraction without a calculator multiplication and division without a calculator using positive and

More information

EPSON SCANNING TIPS AND TROUBLESHOOTING GUIDE Epson Perfection 3170 Scanner

EPSON SCANNING TIPS AND TROUBLESHOOTING GUIDE Epson Perfection 3170 Scanner EPSON SCANNING TIPS AND TROUBLESHOOTING GUIDE Epson Perfection 3170 Scanner SELECT A SUITABLE RESOLUTION The best scanning resolution depends on the purpose of the scan. When you specify a high resolution,

More information

Ultra-High Resolution Digital Mosaics

Ultra-High Resolution Digital Mosaics Ultra-High Resolution Digital Mosaics J. Brian Caldwell, Ph.D. Introduction Digital photography has become a widely accepted alternative to conventional film photography for many applications ranging from

More information

Lecture 3: Finding integer solutions to systems of linear equations

Lecture 3: Finding integer solutions to systems of linear equations Lecture 3: Finding integer solutions to systems of linear equations Algorithmic Number Theory (Fall 2014) Rutgers University Swastik Kopparty Scribe: Abhishek Bhrushundi 1 Overview The goal of this lecture

More information

Getting Started in Tinkercad

Getting Started in Tinkercad Getting Started in Tinkercad By Bonnie Roskes, 3DVinci Tinkercad is a fun, easy to use, web-based 3D design application. You don t need any design experience - Tinkercad can be used by anyone. In fact,

More information

Petrel TIPS&TRICKS from SCM

Petrel TIPS&TRICKS from SCM Petrel TIPS&TRICKS from SCM Knowledge Worth Sharing Import and Digitize from a Bitmap Using Petrel Often a map with culture lines, contours or well spots is provided in paper form and must be entered into

More information

SolidWorks Tutorial 3 MAGNETIC BLOCK

SolidWorks Tutorial 3 MAGNETIC BLOCK SolidWorks Tutorial 3 MAGNETIC BLOCK Magnetic Block In this exercise you will make a magnetic block. To do so, you will create a few parts, which you will assemble. You will learn the following new applications

More information

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89 by Joseph Collison Copyright 2000 by Joseph Collison All rights reserved Reproduction or translation of any part of this work beyond that permitted by Sections

More information

Random Fibonacci-type Sequences in Online Gambling

Random Fibonacci-type Sequences in Online Gambling Random Fibonacci-type Sequences in Online Gambling Adam Biello, CJ Cacciatore, Logan Thomas Department of Mathematics CSUMS Advisor: Alfa Heryudono Department of Mathematics University of Massachusetts

More information

Digital Photography Composition. Kent Messamore 9/8/2013

Digital Photography Composition. Kent Messamore 9/8/2013 Digital Photography Composition Kent Messamore 9/8/2013 Photography Equipment versus Art Last week we focused on our Cameras Hopefully we have mastered the buttons and dials by now If not, it will come

More information

Creating 2D Isometric Drawings

Creating 2D Isometric Drawings 1-(800) 877-2745 www.ashlar-vellum.com Creating 2D Isometric Drawings Using Graphite TM Copyright 2008 Ashlar Incorporated. All rights reserved. C62DISO0806. Ashlar-Vellum Graphite No matter how many Top,

More information

0.75 75% ! 3 40% 0.65 65% Percent Cards. This problem gives you the chance to: relate fractions, decimals and percents

0.75 75% ! 3 40% 0.65 65% Percent Cards. This problem gives you the chance to: relate fractions, decimals and percents Percent Cards This problem gives you the chance to: relate fractions, decimals and percents Mrs. Lopez makes sets of cards for her math class. All the cards in a set have the same value. Set A 3 4 0.75

More information

CATIA Drafting TABLE OF CONTENTS

CATIA Drafting TABLE OF CONTENTS TABLE OF CONTENTS Introduction...1 Drafting...2 Drawing Screen...3 Pull-down Menus...4 File...4 Edit...5 View...6 Insert...7 Tools...8 Drafting Workbench...9 Views and Sheets...9 Dimensions and Annotations...10

More information

HowTo Rhino & ICEM. 1) New file setup: choose Millimeter (automatically converts to Meters if imported to ICEM)

HowTo Rhino & ICEM. 1) New file setup: choose Millimeter (automatically converts to Meters if imported to ICEM) HowTo Rhino & ICEM Simple 2D model 1) New file setup: choose Millimeter (automatically converts to Meters if imported to ICEM) 2) Set units: File Properties Units: Model units: should already be Millimeters

More information

INTRODUCTION TO RENDERING TECHNIQUES

INTRODUCTION TO RENDERING TECHNIQUES INTRODUCTION TO RENDERING TECHNIQUES 22 Mar. 212 Yanir Kleiman What is 3D Graphics? Why 3D? Draw one frame at a time Model only once X 24 frames per second Color / texture only once 15, frames for a feature

More information