ImageNet_Utils icon indicating copy to clipboard operation
ImageNet_Utils copied to clipboard

Extension - BBox Angle (not an issue)

Open arasharchor opened this issue 8 years ago • 5 comments

Hi,

I am trying to annotate the images with bboxes with different rotations, but this tool doesn't support it as far as I have seen. Is there any way to add this feature to the future version? that is really useful. Also in Pacal VOC, there are a few more options in annotations e.g. orientations (left,right...), truncated,.. How to add these options to the tool? I would like to contribute, but I don't know from where I should start.

Best, Majid

arasharchor avatar Nov 27 '16 12:11 arasharchor

@smajida , The original source code is from https://github.com/tzutalin/labelImg

It's cool to add more features to the tool !!! We can add more features or options as you mentioned, it must be helpful to other people. If you would like to contribute, you can try to clone labbelImg and add the feature and send a PR to that repository.

tzutalin avatar Nov 27 '16 13:11 tzutalin

@tzutalin It seems both GUI tools are doing roughly the same thing. Could you tell me what the differences are between "labelImg" and "ImageNet_Utils"? Is "ImagNet_Utils" the older version of LabelImg which you suggest me to contribute to "labellmg"?

arasharchor avatar Nov 27 '16 14:11 arasharchor

@smajida , labellmg is a git submodule of ImageNet_Utils. ImageNet_Utils provides other command lines to download images from ImageNet or convert format utils. labelImg is the source code of GUI tools. Usually, there are some changes in LablelImg, I will sync the changes to ImageNet_Utils. If you have any changes about labellmg, you should change it directly.

tzutalin avatar Nov 28 '16 01:11 tzutalin

@tzutalin There are two ways of creating rotated bounding boxes:

1- the user creates a bounding box with no rotation with his/her mouse, then using "wheel" in the mouse he/she will rotate bounding box to fit object which for this case I am writing a code, but I am stuck.

2-To annotate fast, just user selects diagonal of object, by clicking first the top left corner of the object, then the bottom right corner which is done in https://github.com/smajida/FastAnnotationTool

for the first case:

 void paintEvent(QPaintEvent* event){
    QPainter painter(this);

    // xc and yc are the center of the widget's rect.
    qreal xc = width() * 0.5;
    qreal yc = height() * 0.5;

    painter.setPen(Qt::black);

    // draw the cross lines.
    painter.drawLine(xc, rect().top(), xc, rect().bottom());
    painter.drawLine(rect().left(), yc, rect().right(), yc);

    painter.setBrush(Qt::white);
    painter.setPen(Qt::blue);

    // Draw a 13x17 rectangle rotated to 45 degrees around its center-point
    // in the center of the canvas.

    // translates the coordinate system by xc and yc
    painter.translate(xc, yc);

    // then rotate the coordinate system by 45 degrees
    painter.rotate(45);

    // we need to move the rectangle that we draw by rx and ry so it's in the center.
    qreal rx = -(13 * 0.5);
    qreal ry = -(17 * 0.5);
    painter.drawRect(QRect(rx, ry, 13, 17));

arasharchor avatar Mar 09 '17 15:03 arasharchor

Is this now implemented?

jamesthesken avatar May 31 '18 00:05 jamesthesken