Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
jobs:
build:
docker:
- image: louisgcr/point_cloud_annotation_tool:latest
working_directory: /home

steps:
- run:
shell: /bin/bash
name: Set-up repo and compile
command: |
git clone https://github.com/Louisgcr/point-cloud-annotation-tool.git
cd point-cloud-annotation-tool
mkdir build
cd build
cmake ..
make
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
docker/
build/
*.pcd
*.user
Expand Down
39 changes: 26 additions & 13 deletions Annotaion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <vtkAnnotationBoxSource.h>
#include <vtkBoxWidgetRestricted.h>
#include <vtkBoxWidgetCallback.h>
#include <stdio.h>

using namespace std;

Expand Down Expand Up @@ -41,7 +42,6 @@ Annotation::Annotation(const PointCloudTPtr cloud, vector<int> &slice, string ty
vtkSmartPointer<vtkTransform> cubeTransform = vtkSmartPointer<vtkTransform>::New();
cubeTransform->PostMultiply();
cubeTransform->Scale(label.detail.length,label.detail.width,label.detail.height);
// cubeTransform->RotateZ(label.detail.yaw);
cubeTransform->RotateZ(label.detail.yaw*180/vtkMath::Pi());
cubeTransform->Translate(label.detail.center_x,label.detail.center_y,label.detail.center_z);

Expand Down Expand Up @@ -85,18 +85,12 @@ void Annotation::picked(vtkRenderWindowInteractor *interactor){
boxWidget = vtkSmartPointer<vtkBoxWidgetRestricted>::New();
boxWidgetCallback0 = vtkSmartPointer<vtkBoxWidgetCallback0>::New();
boxWidgetCallback0->setAnno(this);
boxWidgetCallback1 = vtkSmartPointer<vtkBoxWidgetCallback1>::New();
boxWidgetCallback1->setAnno(this);
//boxWidgetCallback1 = vtkSmartPointer<vtkBoxWidgetCallback1>::New();
//boxWidgetCallback1->setAnno(this);

boxWidget->SetInteractor(interactor);
// boxWidget->SetProp3D( cubeActor );
// boxWidget->SetPlaceFactor( 1.25 ); // Make the box 1.25x larger than the actor
// boxWidget->PlaceWidget();

// default is [-0.5, 0.5], NOTE
// [-1,1] makes boxwidget fit to annotion,
// but [-0.5, 0.5] should be in the correct way, may be some bug
double bounds[6]={-1,1,-1,1,-1,1};

double bounds[6]={-1,1,-1,1,-1,1};
boxWidget->PlaceWidget(bounds);

vtkSmartPointer<vtkTransform> t=vtkSmartPointer<vtkTransform>::New();
Expand All @@ -106,8 +100,21 @@ void Annotation::picked(vtkRenderWindowInteractor *interactor){
boxWidget->GetOutlineProperty()->SetAmbientColor(1.0,0.0,0.0);

boxWidget->AddObserver( vtkCommand::InteractionEvent, boxWidgetCallback0 );
boxWidget->AddObserver( vtkCommand::EndInteractionEvent, boxWidgetCallback1 );
//boxWidget->AddObserver( vtkCommand::EndInteractionEvent, boxWidgetCallback1 );
boxWidget->On();

}

double* Annotation::getBoxPose(void){

return transform->GetPosition();

}

double* Annotation::getBoxOri(void){

return transform->GetOrientation();

}

void Annotation::unpicked(){
Expand Down Expand Up @@ -217,7 +224,7 @@ void Annotation::colorAnnotation(int color_index){

actor->GetProperty()->SetLineWidth(2);
actor->GetProperty ()->SetLighting (false);

actor->GetProperty()->SetOpacity(0.5);
mapper->SetLookupTable(lut);
}

Expand Down Expand Up @@ -348,9 +355,15 @@ void Annotaions::loadAnnotations(string filename)
void Annotaions::saveAnnotations(string filename)
{
if (annotations.empty()) return;

if(std::remove(filename.c_str()) == 0){
std::cout<<"Removed old files"<<std::endl;
}

std::ofstream output(filename.c_str(), std::ios_base::out);
for (auto anno:annotations){
output<<anno->getBoxLabel().toString()<<std::endl;
//std::cout<<anno->getBoxLabel().toString()<<std::endl;
}
output.close();
}
Expand Down
10 changes: 10 additions & 0 deletions Annotaion.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ class Annotation
*/
void picked(vtkRenderWindowInteractor* interactor);

/* @brief: Get the box pose
* @return ptr that contains box position
*/
double* getBoxPose(void);

/* @brief: Get the box orientation(You never know, it may be gay)
* @return: ptr that contains orientation
*/
double* getBoxOri(void);

/**
* @brief disable boxWidget
*/
Expand Down
Empty file modified CMakeLists.txt
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
MIT License

Copyright (c) 2019 Louis Goh
Copyright (c) 2018 Fancy Zhang

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down
44 changes: 42 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,40 @@
# [Point Cloud Annotation Tool](https://github.com/Louisgcr/point-cloud-annotation-tool)

Branch | Status
------------ | -------------
Master |[![CircleCI](https://circleci.com/gh/Louisgcr/point-cloud-annotation-tool/tree/master.svg?style=svg)](https://circleci.com/gh/Louisgcr/point-cloud-annotation-tool/tree/master)

## point cloud annotation tool
It is a tool used to annotate 3D box in point cloud. Point cloud in KITTI-bin format is supported. Annotation format is the same as Applo 3D format. Data examples can be found at [here](http://data.apollo.auto/help?name=data_intro_3d&data_key=lidar_obstacle_label&data_type=0&locale=en-us&lang=en).

![example1 image](example_new.png)

![Demo](pcl_demo.gif)

### supported functions
- load, save, visiualize
- point cloud selection
- 3d box generation and adaption
- 3d box generation
- ground remove using threhold or plane detect

### New Features
- 3 Additional camera view (top, front, side) that snaps to object
- Ability to move box object in any render window
- Added a full screen feature to toggle current render window and normal view
- Real time update of box details in message box below
- Points in boxs are highlighted green
- Box Opacity reduce to see through box
- Lowered point intensity to see clearer

### usage
- if *cloud.bin* is open, then *cloud.bin.txt* will be the annotation file to be loaded if exist.
- click to select an annotaion, then edit it, rotate it or just press 'Del' to delete.
- 'x' to toggle selection mode,then left click with ctrl or shift to help select.
- click label button to annotate a 3D box.

### additional usage
- ctrl + z to toggle full screen and selected render window


### dependency
Tested with pcl 1.8, vtk 8.1, Qt5 under both ubuntu 16.04 and windows 10.
Expand All @@ -21,4 +43,22 @@ to build:
mkdir build && cd build && cmake .. && make
```

![example1 image](example1.png) ![example2 image](example2.png)
## Authors
1. Louis Goh
2. springzfx- Initial Work

## Acknowledgement
1. Fancy Zhang

(Meow!!)
.....\
........_
.....<(o )___
......( .__> /
........`-----'

## License
[MIT](https://github.com/nishanths/license/blob/master/LICENSE)



Empty file modified common.h
100755 → 100644
Empty file.
Binary file removed example1.png
Binary file not shown.
Binary file removed example2.png
Binary file not shown.
Binary file added example_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified main.cpp
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion mainwindow.ui
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>15</height>
<height>60</height>
</size>
</property>
<property name="text">
Expand Down
6 changes: 3 additions & 3 deletions pcl/visualization/MyCloudLUT.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
/// Lookup table
static const unsigned char CloudLUT[] =
{
255 , 255, 255 , // default
125 , 125, 125 , // default
255, 0, 0 , // highted
0 , 0, 255 // ground

0 , 0, 255 , // ground
0 , 255, 0
};

/// Number of colors in Glasbey lookup table
Expand Down
Empty file modified pcl/visualization/MyCloudLUT.h
100755 → 100644
Empty file.
Empty file modified pcl/visualization/PointCloudColorHandlerLUT.h
100755 → 100644
Empty file.
Empty file modified pcl/visualization/pcl_visualizer_extented.h
100755 → 100644
Empty file.
Binary file added pcl_demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading