Coder Social home page Coder Social logo

kwon1998 / oneposedatasetcollector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from siatheindochinese/oneposedatasetcollector

0.0 0.0 0.0 3.53 MB

Rudimentary custom dataset collector for OnePose

License: Apache License 2.0

Python 100.00%

oneposedatasetcollector's Introduction

OnePoseDatasetCollector

Rudimentary custom dataset collector for OnePose.

This dataset collector uses a diamond-shaped aruco board to obtain poses. There are two implementations:

  1. detect_arucoboard_realsense.py if you are using an Intel Realsense camera. Install the Realsense SDK and its Python wrapper (which can be pip-installed with pip3 install pyrealsense2).
  2. detect_arucoboard_opencv.py if you are using any other camera that can be picked up by cv2.VideoCapture. You will need to calibrate your camera and provide the intrinsic matrix as a 3x3 NumPy array, stored as a .txt file (with np.savetxt), under configs/intrin/

Addendum: OpenCV camera calibration guide here.

Requirements

Only OpenCV and NumPy are required. Install them using pip.

1. Configuring the aruco board

The board provided is a diamond-shaped aruco board generated by OpenCV. You may choose to modify the square length (sl) and marker length (ml), and the aruco markers themselves of the board by adding your own .json config, stored in configs/aruco. I have provided a sample config (sl200_ml120.json).

Run arucoboard.py to generate the board as a .png file. The file can be found in out/aruco/. Example:

python3 arucoboard.py --config sl200_ml120

Print the .png file and lay it flat on a surface.

2. Recording your data

Place your desired object in the middle of the board. If the object is too big (covers all 4 aruco markers), you may wish to generate a board with smaller aruco markers by changing the ml parameter in the config file.

2.1 Intel Realsense Cameras

Simply run detect_arucoboard_realsense.py, specifying the aruco board config file you used to generate your board with --config and the name of the dataset you wish to save it as with --name. Example:

python3 detect_arucoboard_realsense.py --config sl200_ml120 --name empty

Save the image, the corresponding intrinsic matrix and the pose by pressing spacebar. Press q to quit the program.

Your dataset is saved in out/datasets/.

2.2 Other Cameras

You will need to place your camera intrinsic file in configs/intrin.

Run detect_arucoboard_opencv.py. You will need to specify your camera parameters as flags. Example:

python3 detect_arucoboard_opencv.py --intrin intrin_ps3 --width 640 --height 480 --camidx 0 --config sl200_ml120 --name empty

Change --camidx to choose your desired camera if you have multiple cameras.

Save the image, the corresponding intrinsic matrix and the pose by pressing spacebar. Press q to quit the program.

Your dataset is saved in out/datasets/.

2.3 Controls

  1. 'w' and 's': change the height of your pose from the board
  2. 'e' and 'd': change the x-width of your bounding box.
  3. 'r' and 'f': change the y-width of your bounding box.
  4. 't' and 'g': change the height of your bounding box.
  5. 'spacebar': record your data (RGB, poses, intrinsics, bounding box).
  6. 'q': exit the program.

Acknowledgement

Most of the functions in utils.py used for cropping and obtaining post-crop intrinsics are taken from the original OnePose repository.

oneposedatasetcollector's People

Contributors

siatheindochinese avatar

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.