Answers.Body: <p>As you have probably guessed by now, there is no easy solution to your question.  It all comes down to computer vision.</p>
  
  <p>In <a href="http://www.ubergizmo.com/2011/04/lego-machine-sort/" rel="nofollow noreferrer">this solution</a>, Akiyuki built a massive machine out of LEGO bricks, a camera, a scale, 2 Mindstorm NXT and, which he fails to mention in is parts list, a computer and some electronics.</p>
  
  <p><img src="https://i.sstatic.net/u6msv.jpg" alt="enter image description here"></p>
  
  <p>Computer vision is complex, and making a working prototype is still an impressive task. Even though the software component of this project is most probably the reuse of an existing solution like <a href="http://opencv.org/" rel="nofollow noreferrer">OpenCV</a>, there are many other problems to overcome. For example; Mechanically bringing the parts to the camera one by one in a controlled fashion. Also if the part is not laying down from a recognisable angle, you would probably have to flip it or take pictures with multiple cameras in order to get a good look at it.</p>
  
  <p>Still, being a software developer myself, this is not the part that worries me.  Even if you manage to build the whole machine, you still need to compare the pictures with a library of all the known LEGO bricks. Even more, they need to be imaged from all possible sides (when laying down).  Building this knowledge base is a big endeavour on its own.</p>
  
  <p><img src="https://i.sstatic.net/P881X.png" alt="enter image description here"></p>
  
  <p>Here is <a href="https://www.youtube.com/watch?v=6lZ9rSZwDzE" rel="nofollow noreferrer">a video of the working machine</a>.</p>
  
  <hr>
  
  <p>If you can reduce the complexity of parts to sort it can really help. Akiyuki has also made sorters for Technic <a href="https://www.youtube.com/watch?v=nlCSlJuD65A" rel="nofollow noreferrer">beams</a> and <a href="https://www.youtube.com/watch?v=nlCSlJuD65A" rel="nofollow noreferrer">axles</a> (both of which work on the same very simple principles). </p>
  
  <p>If you do decide to build a brick sorter you probably would be better off designing one for the parts you use the most/have the most of and hand sorting the rest.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-12T13:56:35.330Z
Answers.Text: Thanks! I happen to follow Akiyuki on YouTube, but I had completely forgotten about this video of his. I'll look into making it...sometime...
Answers.UserDisplayName: rivermont
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-12T18:45:28.133Z
Answers.Text: Hmm - if you're willing to take the time though surely this is a prime candidate for machine learning as well: you train it with some known bricks first and let it build its understanding of different bricks from there ;)
Answers.UserDisplayName: Zhaph - Ben Duguid
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-12T21:58:50.637Z
Answers.Text: @Zhaph-BenDuguid that would be my first choice too.  I would also cross that with a web brick database like BrickLink to automate linking new found shapes with existing brick names.
Answers.UserDisplayName: pcantin
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-08T16:09:17.987Z
Answers.Text: One could use parts files from the common brick CAD systems as models to fit to the camera images - that could help learn the brick shapes and make the task of creating the parts database easier.
Answers.UserDisplayName: Exilyth
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-12T02:32:28.437Z
Answers.LastActivityDate: 2017-12-13T16:13:11.253Z
Answers.LastEditDate: 2017-12-13T16:13:11.253Z
Answers.UserDisplayName: pcantin
Body: <p>I have a rather large collection of LEGO elements that are not sorted in any way, and I'd like to keep track of them. There are a few other posts about ways to keep track of elements, and I've looked at them. I've downloaded about three different programs that are for LEGO inventory keeping, but I'm kind of picky.</p>
  
  <p>I'd want something that I can input bricks into rather quickly, and though these programs are cool, I don't need to look up current prices or keep track of sets or whatever, as I have loads of loose pieces. Does anyone know anything that would meet those conditions? Even some sort of scanner build would be great.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-18T22:22:28.767Z
Comments.Text: Why do you need to inventory the parts?  Is it for custom building purposes?  I'm also curious what programs you've downloaded, and what specifically you found undesirable in each one.
Comments.UserDisplayName: Nick2253
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-18T22:23:38.813Z
Comments.Text: May be duplicate of [Is there any application to keep an inventory of owned sets and pieces?](https://bricks.stackexchange.com/questions/635/is-there-any-application-to-keep-an-inventory-of-owned-sets-and-pieces)
Comments.UserDisplayName: Nick2253
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-02-21T15:11:49.203Z
Comments.Text: you could write a Lego&reg; database...
Comments.UserDisplayName: JMP
Tags: <piece-information><organisation><inventory>
Title: Quick way to inventory parts
UserDisplayName: rivermont
ThreadText: # Quick way to inventory parts
  
  (Asked by: username_0 on 2015-02-18)
  
  I have a rather large collection of LEGO elements that are not sorted in any way, and I'd like to keep track of them. There are a few other posts about ways to keep track of elements, and I've looked at them. I've downloaded about three different programs that are for LEGO inventory keeping, but I'm kind of picky.
  
  I'd want something that I can input bricks into rather quickly, and though these programs are cool, I don't need to look up current prices or keep track of sets or whatever, as I have loads of loose pieces. Does anyone know anything that would meet those conditions? Even some sort of scanner build would be great.
  
  **Tags:** piece-information, organisation, inventory
  > **Comments:**
  > **username_1**: Why do you need to inventory the parts?  Is it for custom building purposes?  I'm also curious what programs you've downloaded, and what specifically you found undesirable in each one.  
  > **username_1**: May be duplicate of [Is there any application to keep an inventory of owned sets and pieces?](https://bricks.stackexchange.com/questions/635/is-there-any-application-to-keep-an-inventory-of-owned-sets-and-pieces)  
  > **username_2**: you could write a Lego&reg; database...  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2015-03-12. Score: 8 | Accepted answer
  
  As you have probably guessed by now, there is no easy solution to your question. It all comes down to computer vision.
  
  In [this solution](http://www.ubergizmo.com/2011/04/lego-machine-sort/), Akiyuki built a massive machine out of LEGO bricks, a camera, a scale, 2 Mindstorm NXT and, which he fails to mention in is parts list, a computer and some electronics.
  
  ![enter image description here](https://i.sstatic.net/u6msv.jpg)
  
  Computer vision is complex, and making a working prototype is still an impressive task. Even though the software component of this project is most probably the reuse of an existing solution like [OpenCV](http://opencv.org/), there are many other problems to overcome. For example; Mechanically bringing the parts to the camera one by one in a controlled fashion. Also if the part is not laying down from a recognisable angle, you would probably have to flip it or take pictures with multiple cameras in order to get a good look at it.
  
  Still, being a software developer myself, this is not the part that worries me. Even if you manage to build the whole machine, you still need to compare the pictures with a library of all the known LEGO bricks. Even more, they need to be imaged from all possible sides (when laying down). Building this knowledge base is a big endeavour on its own.
  
  ![enter image description here](https://i.sstatic.net/P881X.png)
  
  Here is [a video of the working machine](https://www.youtube.com/watch?v=6lZ9rSZwDzE).
  
  ---
  
  If you can reduce the complexity of parts to sort it can really help. Akiyuki has also made sorters for Technic [beams](https://www.youtube.com/watch?v=nlCSlJuD65A) and [axles](https://www.youtube.com/watch?v=nlCSlJuD65A) (both of which work on the same very simple principles).
  
  If you do decide to build a brick sorter you probably would be better off designing one for the parts you use the most/have the most of and hand sorting the rest.
  
  > **Comments:**
  > **username_0**: Thanks! I happen to follow Akiyuki on YouTube, but I had completely forgotten about this video of his. I'll look into making it...sometime...  
  > **username_4**: Hmm - if you're willing to take the time though surely this is a prime candidate for machine learning as well: you train it with some known bricks first and let it build its understanding of different bricks from there ;)  
  > **username_3**: @Zhaph-BenDuguid that would be my first choice too.  I would also cross that with a web brick database like BrickLink to automate linking new found shapes with existing brick names.  
  > **username_5**: One could use parts files from the common brick CAD systems as models to fit to the camera images - that could help learn the brick shapes and make the task of creating the parts database easier.  
  
  ---
  
  