janpaul123 / paperprograms

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

Cannot Calibrate #59

Open andrewgleave opened 6 years ago

andrewgleave commented 6 years ago

When I follow the docs and attempt to calibrate a color by clicking on the indicator in the side panel and then clicking on the appropriate dot picked up from the calibration page, nothing happens.

I can see by looking at LocalStorage that nothing is being set and keyPoints here is always zero-length.

Others seem to be having no problem but this has me stumped. Is there anything obvious I could be missing?

paulsonnentag commented 6 years ago

I tried to replicate your problem but it worked for me. Could you share what's stored in localStorage.paperProgramsConfig?

andrewgleave commented 6 years ago

Sure.

{
  "colorsRGB": [
    [
      119,
      43,
      24,
      255
    ],
    [
      94,
      104,
      48,
      255
    ],
    [
      65,
      80,
      84,
      255
    ],
    [
      0,
      0,
      0,
      255
    ]
  ],
  "paperDotSizes": [
    8,
    8,
    8,
    8
  ],
  "knobPoints": [
    {
      "x": 0.1287037037037037,
      "y": 0.20123456790123456
    },
    {
      "x": 0.9259259259259259,
      "y": 0.2
    },
    {
      "x": 0.9259259259259259,
      "y": 0.7283950617283951
    },
    {
      "x": 0.12962962962962962,
      "y": 0.7308641975308642
    }
  ],
  "zoomTransform": {
    "x": -1233,
    "y": -1188,
    "k": 4
  },
  "showOverlayKeyPointCircles": true,
  "showOverlayKeyPointText": true,
  "showOverlayComponentLines": true,
  "showOverlayShapeId": true,
  "showOverlayProgram": true,
  "spaceUrl": "https://paperprograms.org/api/spaces/55d454e0",
  "autoPrintEnabled": false,
  "freezeDetection": false,
  "showPrintedInQueue": false
}
andrewgleave commented 6 years ago

I managed to get it to calibrate by moving the camera much further away. Maybe I could have changed config.paperDotSizes to reduce the relative size of the dot for detection purposes?

janpaul123 commented 6 years ago

Ah, the config.paperDotSizes seem tricky. We should allow calibration of pages that are close up to the screen.

paulsonnentag commented 6 years ago

I think the problem is that if the paper dots are significantly bigger than the default size of 8 they are removed from the list of potential paper dots and instead recognized as markers. A quick fix would be to set the default marker size to something unrealistically high like 9999.