jsbroks / coco-annotator

:pencil2: Web-based image segmentation tool for object detection, localization, and keypoints
MIT License
2.12k stars 462 forks source link

How to draw different keypoints with different symbols? #302

Open mgarbade opened 4 years ago

mgarbade commented 4 years ago

While annotating person keypoints, I often get confused or make annotation mistakes. It would be really helpful to make individual keypoints optically differentiable. Where in the code can I select the symbol type for a keypoint?

mgarbade commented 4 years ago

Ok, a quick fix to visually differentiate between keypoints is to modify the setFillColor function:

  setFillColor() {
    if (this.path == null) return;
    console.log("setFillColor(" + this.indexLabel + ")")
    switch (this.visibility) {
      case VisibilityType.NOT_LABELED:
        this.path.fillColor = "black";
        break;
      case VisibilityType.LABELED_NOT_VISIBLE:
        this.path.fillColor = "white";
        break;
      default:
          switch (this.indexLabel) {
            case 1:
              this.path.fillColor = '#ff0055'
              break
            case 2:
                this.path.fillColor = '#ff0000'
                break
            case 3:
                this.path.fillColor = '#ff5500'
                break
            case 4:
                this.path.fillColor = '#ffaa00'
                break
            case 5:
                this.path.fillColor = '#ffff00'
                break
            case 6:
                this.path.fillColor = '#aaff00'
                break
            case 7:
                this.path.fillColor = '#55ff00'
                break
            case 8:
                this.path.fillColor = '#00ff00'
                break
            case 9:
                this.path.fillColor = '#00ff55'
                break
            case 10:
                this.path.fillColor = '#00ffaa'
                break
            case 11:
                this.path.fillColor = '#00ffff'
                break
            case 12:
                this.path.fillColor = '#0055ff'
                break
            case 13:
                this.path.fillColor = '#0000ff'
                break
            case 14:
                this.path.fillColor = '#ff00aa'
                break
            case 15:
                this.path.fillColor = '#aa00ff'
                break
            case 16:
                this.path.fillColor = '#ff00ff'
                break
            case 17:
                this.path.fillColor = '#5500ff'
                break
            default:
                this.path.fillColor = this.color;
          }
    }

Here the points get filled with the corresponding coco-colors used by "openpose"

matt-deboer commented 4 years ago

@mgarbade is this still an issue with the new keypoints update? You should now have ability to configure all of the colors as you want from the Category update UI...

mgarbade commented 4 years ago

Yes, that is true. Thanks for that functionality, very useful!