janpaul123 / paperprograms

Run Javascript on pieces of paper!
https://paperprograms.org
MIT License
484 stars 55 forks source link

Expose dots which haven't been matched to a paper as markers #43

Closed paulsonnentag closed 6 years ago

paulsonnentag commented 6 years ago

I wanted to have markers which are tracked independently of the papers, similar to issue #42. I thought the fastest implementation would be to reuse the existing circle detection of the paper recognition. Any point which isn't part a corner shape is exposed as a marker on each paper object

const papers = await paper.get('papers');
const number = await paper.get('number');

// each paper has list of markers
papers[number].markers

I've build a little curling game with it:

img_20180414_204202 https://www.youtube.com/watch?v=0wXpnWLRP1Y

The only drawback I've noticed is that if a corner of a paper is partially covered the remaining dots are no longer part of a shape and will be recognized as markers. In my demo, I've dealt with this by using bigger circles for the markers and filter for the size in my paper program. The implementation isn't complete right now; I would also like to add the information which of the markers are on the paper and their relative position to the paper. I'm interested to hear your feedback.

shaunlebron commented 6 years ago

I thought the fastest implementation would be to reuse the existing circle detection of the paper recognition.

Cool idea, when ready we can look at the square detection code here

I would also like to add the information which of the markers are on the paper and their relative position to the paper.

👍

shaunlebron commented 6 years ago

Great start! We played with this, and drew circles over all the markers:

markers

Looks like the markers aren't attached to papers yet, so I'll remove that from the docs.

paulsonnentag commented 6 years ago

Yes, I've started working on that but haven't finished it yet.