Skip to main content

tools for using Blender for cv

Project description

Blender for cv

This repo provides tutorials and a library to help CV researchers to generate data using blender.

Introduction

Blender is good for single image rendering; it provides complete python interface and good support for shapenet models.

Game engine based software (Unreal, Unity) provides a virtual world for simulation, which is better for agents to interact with the environment; a lot of VR assets to buy in the market.

Blender tutorial

panel

The whole interface is divided into several panels, each panel has type and the type can be changed (3D view, Timeline, etc).

pic1

split new panel

To create more panels, drag the triangle on the right top of the main panel, and pull towards left or down, a new panel will appear.

pic2

merge panels

To merge two panels, drag the triangle and pull towards top or right to merge the corresponding panel.

pic3

Navigate

left click - pivot point

right click - select

wheel - zoom in / out

Import object

File -> import -> .obj

Press F12 to render the image (see the objects from camera point)

Press F11 to go back

Change the camera location in the interface

Directly move the camera and point light in the 3D viewpoint scene. Use the options below to change the location, rotation and scale.

pic4

Select the object panel and change the number of these objects.

pic5

Use the view menu to toggle to other views. (The example below shows the top view)

pic6

Add more object to the scene

From the left panel Create to find objects to put into the scene.

All the objects in the scene are shown in the Outliner panel.

pic7

Use python to control the scene

Switch the bottom panel to python console

Try to print hello world

pic8

But how to control objects in the scene by python?

Use the bpy module provided by Blender to access the scene.

Hover over text field to get the object's python value and change it in python console using python grammar.

pic9

Build the automation pipeline

Switch the panel type to text editor, new or open a file and write python script in it.

pic10

Finish your script then click Run script to see the difference.

Be aware that while writing in the file, you need to import bpy first, or there may be error.

pic11

Best way to run the script

In the last section, we introduce the way of running script within Blender, but usually we would like to run it in the command line.

This section tells how to write scripts to achieve generating images automatically.

To start Blender in the command line, we can use blender --script xxx.py to run xxx.py in Blender

Two types of python scripts

  • Outside to call Blender
  • Inside Blender to control Blender

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blcv-0.0.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

blcv-0.0.2-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file blcv-0.0.2.tar.gz.

File metadata

  • Download URL: blcv-0.0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.4

File hashes

Hashes for blcv-0.0.2.tar.gz
Algorithm Hash digest
SHA256 37e33f25d23cd4295019b30ef7789c3c19cf8cc6791afa152c78e9805b535ff0
MD5 5f669d2a42888515b016c3c9d549d3f4
BLAKE2b-256 65ba9fd104152b28e389e256eb67a6fcdc33fcc1770b18f861380b139a25c80f

See more details on using hashes here.

File details

Details for the file blcv-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: blcv-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.4

File hashes

Hashes for blcv-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8ab26628c802b1df3a7b767053a0b86f94abb0f5f47fa5ed84ec59d675ea246e
MD5 a57649171344c9590bd2e46ef35916e7
BLAKE2b-256 e0603b834c484f7ce80cf2d0632ebc37aef0e7076de33b55ab86c1c0cfac62bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page