Giter VIP home page Giter VIP logo

pixano / pixano-elements Goto Github PK

View Code? Open in Web Editor NEW
38.0 5.0 16.0 10.98 MB

Pixano Elements - Re-usable web components dedicated to data annotation tasks.

License: Other

TypeScript 99.42% JavaScript 0.58%
computer-vision annotation-tool deep-learning web-components instance-segmentation semantic-segmentation panoptic-segmentation bounding-box detection polygon cuboid image-annotation annotation annotations video-annotation point-cloud keypoints image-labeling video-labeling point-cloud-labeling

pixano-elements's Issues

Draw text proposal

/**

  • Draw the text tag on the top left of the shape
    */
    public drawText() {
this.clearText();
const content = this.data['text'] || null;

if (!content) {
  return;
}

let highestVertice = this.topLeftVertice(this.data.geometry.vertices);

let textPositionX = highestVertice[0] * this.scaleX;
let textPositionY = highestVertice[1] * this.scaleY;

const textSize = 10;

const style = new PIXITextStyle({
  fontFamily: 'Arial',
  fontSize: textSize,
  fill: 0x444444
});

let textMetrics = PIXITextMetrics.measureText(content, style)

const boxWidth = Math.round(textMetrics.width + 5);
const boxHeight = Math.round(textMetrics.height + 3);

this.textGraphic.beginFill(0xFFFFFF, 0.80);
this.textGraphic.lineStyle(1, this.hex, 1, 0.5, true);
this.textGraphic.drawRect(
  0, 0,
  boxWidth,
  boxHeight
);


const parent = this.getHigherParent();
if (parent) {
  this.textGraphic.scale.x = 1.5 / parent.scale.x;
  this.textGraphic.scale.y = 1.5 / parent.scale.y;
}

let textNode = new PIXIText(content, style);
textNode.roundPixels = true;
textNode.resolution = 3;
textNode.anchor.x = 0.5;
textNode.anchor.y = 0.6;
textNode.x = Math.round(boxWidth / 2);
textNode.y = Math.round(boxHeight / 2);

this.textGraphic.addChild(textNode);
this.textGraphic.pivot.set(boxWidth, boxHeight);
this.textGraphic.x = textPositionX;
this.textGraphic.y = textPositionY;
this.textGraphic.endFill();

}

pxn-rectangle component : Unwanted creation of box while moving the image

Quick image moving create unwanted box.

The bug can be reproduced in the bouding-box demo on the pixano website : http://pixano.cea.fr/bounding-box/ with Chrome Version 83.0.4103.61 (Build officiel) (64 bits).
I think this bug affects all pixano elements.
Steps to reproduce : Enable the mode creation by clicking the "Add rectangle" button and then move the image (with the right click) quicky. It creates a small rectangle.

I attach a video of the bug.

bug-pixano-rectangle.zip

Canvas elements

Hi guys, I'm working with elements for annotations and have few questions:

How do you select a polygon, for instance I want to reference a polygon by id?
How do you remove a polygon on click base?

Ability to extend Shapes

You provide a way to extend components or to change controllers behavior but there is no way to extend Shape (RectangleShape, PolygonShape etc..) since we can't override the dataToShape function used in the ShapeManager.

I fixed it by adding
public shapeFactory: { dataToShape : ((s: ShapeData) => Shape) } = { dataToShape : dataToShape };
as a property in the ShapeManager class
and then, by changing the two
const obj = dataToShape(s);
to
const obj = this.shapeFactory.dataToShape(s);
in the constructor of ShapeManager (line 530 and 553 of /packages/graphics-2d/src/shapes-manager.ts)

These 3 changes make me able to set my own dataToShape method when I extend pixano webcomponents.
this.shManager.shapeFactory.dataToShape = myOwnDataToShape;

Do you think you can make this kind of changes so we will be able to extend Shapes ?

Thank you for your help.

goTo proposal (in ViewControls)

/**
 * 
 * Center the view on the point [targetX, targetY]. Apply a zoom if provided
 * 
 * @param targetX 
 * @param targetY 
 * @param zoom 
 * @param normalized 
 */
goTo(targetX: number, targetY: number, zoom : number, normalized = true) {
    if (!normalized)
      var { x, y } = this.viewer.normalize({ x, y });
    else {
      var { x, y } = { x: targetX, y: targetY };
    }

    if(zoom){
      this.viewer.s = zoom;
      this.viewer.stage.scale.set(this.viewer.s * this.viewer.rw / this.viewer.imageWidth,
        this.viewer.s * this.viewer.rh / this.viewer.imageHeight);
    }

    let centerXOffset = (this.viewer.canvasWidth) / 2 / this.viewer.s;
    let centerYOffset = (this.viewer.canvasHeight) / 2 / this.viewer.s;


    this.viewer.rx = centerXOffset + (((x * this.viewer.rw * this.viewer.s) + this.viewer.sx) / this.viewer.s * (-1));
    this.viewer.ry = centerYOffset + (((y * this.viewer.rh * this.viewer.s) + this.viewer.sy) / this.viewer.s * (-1));

    this.viewer.stage.position.set(this.viewer.rx * this.viewer.s + this.viewer.sx, this.viewer.ry * this.viewer.s + this.viewer.sy);

    this.triggerOnZoom();
    this.computeHitArea();
  }

Unexpected identifier error with npx serve demo

I am installing pixano-elements on Windows10. Node version 10.19, npm 6.13.4. And I receive the following error

PS C:\Users\m\Work\pixano-elements> npx serve demo
npx : 91 installé(s) en 9.123s
Unexpected identifier```

onTabulation selection does not reset previously selected shapes display

onTabulation (pxn-canvas-2d.ts) do a this.targetShapes.set([nextShape]).

In the ShapesEditController, we observe the targetShapes but the "set" does not "clear" the shapes.

The case "set" should do the action that is in the case "clear" and then, the action in the case "add". We can also (the lazy way) just call this.targetShapes.clear() in onTabulation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.