site2site / shareveillance

Shareveillance team project
MIT License
0 stars 4 forks source link

Figure out tag method #1

Open troyth opened 11 years ago

troyth commented 11 years ago

You need to figure out what the tags will be. Are they QR codes? Are they distinct shapes printed on thermal paper affixed with double stick tape? Are they small, cheap circuits that blink an LED at a particular frequency?

You will have to set up a Node.js app using a computer vision module and do some tests. You can do this on your laptops by making different tags, taking a picture with a digital camera, uploading and then trying to parse the image. I will help you with this.

For now, I need a lead: who wants to be the point person on this part?

warshawshaw commented 11 years ago

I can start working on this.

troyth commented 11 years ago

excellent!

troyth commented 11 years ago

Because you're starting from a different direction than the week 3 class demo, I'm going to go ahead and set up a few things for you. This is what I'm going to do:

  1. create your package.json file at the top level of your directory
  2. create a lib folder where your main code will go
  3. create a server.js file and set up the general framework for testing an image using the OpenCV computer vision library
troyth commented 11 years ago

@warshawshaw take a look at https://github.com/peterbraden/node-opencv to try to understand the principles of computer vision at a high level. Also do some research to see what kind of static objects computer vision is good at capturing (are there particular colors or shapes or scales and sizes of articulation that computer vision is good at plucking out of an image?). You will want to use this to inform your ideas for the tag design. For now, focus on a tag that can be printed with a thermal printer - if we can't get that to work, we will look at the blinking light version.

Let me know what you find in the thread below and I'll do the same.

More soon.

troyth commented 11 years ago

oops, put the wrong opencv library. be sure to check out the node one: https://github.com/peterbraden/node-opencv

troyth commented 11 years ago

hey @warshawshaw check out:

also, note: you'll have to install Open CV before you can use the Node bindings for it. If you're using a Mac, you'll have to install homebrew. You'll also have to tap brew/science before trying to install it. We can discuss this on Monday - make sure to bring your computer when you come.

warshawshaw commented 11 years ago

@troyth I thought I basically understood app.js -- I tried to repeat the test with a 10-sided star and the script doesn't generate an output. What obvious step am I missing?

troyth commented 11 years ago

@warshawshaw you have a typo on line 58: drawCountour.

also, you want to put the default option in a switch statement at the very end (it's basically saying, "if none of the above cases are met, then do this", so you want all of your explicit cases above). You also want to end every case with a break so it doesn't execute the code below in the off chance multiple conditions are met.

You should change your code starting at line 47 to:

// chooses a drawing color based on number of contours
switch(contours.cornerCount(i)) {
  case 3:
    out.drawContour(contours, i, GREEN);
    break;
  case 4:
    out.drawContour(contours, i, RED);
    break;
  case 10:
    out.drawContour(contours, i, PINK);
    break;
  default:
    out.drawContour(contours, i, WHITE);
  }
}
warshawshaw commented 10 years ago

@troyth so the shape recognition works moderately well, but seems to depend on lighting and other random factors. Of the photos I tested, it sometimes failed to read a square up close and then succeeded from farther away, for instance. It seemed to do better with multiple different shapes in the frame, if that's possible.

I've been looking for help with color tracking -- this seems like a pretty good guide for python, although I don't know how applicable that is: https://github.com/abidrahmank/OpenCV-Python/blob/master/Other_Examples/multi_color_multiple_points_track.py

Could I come in for office hours between 1:30 and 2 or so tomorrow for some help with this?

warshawshaw commented 10 years ago

hey @troyth - so it looks like 'channel' (http://www.graphicsmagick.org/GraphicsMagick.html#details-channel) will extract a pure RGB or CMYK color from an image (which is an issue for thermal printing because 2.25 inch rolls tend only to come in pastels when they come in color at all, but is still exciting). The syntax seems simple (http://aheckmann.github.io/gm/docs.html#channel) but could you help me disentangle how to deploy it separately from the contours app? 'app2.js' is the current version. There's also a 'label' method (http://www.graphicsmagick.org/GraphicsMagick.html#details-label) that could be handy for activating the next step of what the shape actually translates to -- it could work basically like a homemade QR based on color and contours.

troyth commented 10 years ago

thanks @warshawshaw . I've been a bit hung up lately preparing for tomorrow's class, let's discussing during class or office hours. I'll be available as of 4pm and will stay around late tomorrow night.