about cube detection algorithm

Published: : Last Updated:2014/05/04 FLARToolKit

In previous entry, I made cube marker demo.
This time, I explain the detection procedure of the cube marker, step by step.


To detect cube marker, I use 3 marker files.

top32.pat: Marker to detect the top of cube.
cube-basic32.pat: Marker to detect side of cube.
sideQ.pat: Marker to detect which side of cube it is.

Detection Algorithm

cube markers
The algorithm to detect the cube marker is composed of 3 steps.

  1. Compare the marker candidate with top32.pat.

    If candidate is corresponding to top32.pat, Detector consider the square is top of cube and detection is finish.

  2. To detect side of cube.
    1. Compare the marker candidates except upper right 1/4 with cube-basic32.pat.

      4 cube side markers are same ,excluding upper right 1/4.
      Then, Detector compares marker candidate excluding upper right 1/4 with cube-basic32.pat.
      If candidate is corresponding to cube-basic32.pat, Detector consider the square is side of cube.
      (Figure: side)

    2. Compare a corresponding marker candidate to cube-basic32.pat with sideQ.pat.

      If candidate is side of cube, Detector compares candidate’s upper right 1/4 with sideQ.pat to get direction.
      If direction is 0, square is BACK of cube.
      Else if direction is 1, square is RIGHT of cube.
      Else if direction is 2, square is FRONT of cube.
      Else if direction is 3, square is LEFT of cube.


Related Article


FLARToolKit demo “Saito-San” released!

I made a FLARToolKit demo. In this demo,

Read Article.


ARToolKit Marker Generator Online released!

UPDATED:new Marker Generator Online Released.

Read Article.


FLARToolKit NyIDMarker Detector

Hi. I committed the detector for the FLARTo

Read Article.


Cube type Marker in FLAR

Hi. Do you know Japanese AR product "Cyber Fi

Read Article.


Marker”s” Generator Online Released!

Hi. I released new ARToolKit Marker Gener

Read Article.


FLARToolKit Panorama Photo Viewer

FLARToolKit Panorama Photo Viewer is demo for

Read Article.


FLARToolKit and Papervision3D:coordinate axis

I made FLARToolKit demo that researchs coo

Read Article.

generate pattern

How to make Rectangle Marker

Hi. I released new FLAR contents. This is

Read Article.


FLAR Torch

Read Article.

FLARCodeImage using

FLARCodeImage:Utility for FLARToolKit

I made a utility class for FLARToolKit. FLARC

Read Article.



  1. Chrysto says:


    Bulgaria flash comunity says “Hi” to you! Really nice effects man, amazing augumented reallity. Is it possible to write some more advanced tutorials about augumented reality –> for example simple animating sprites, worm that mooves or something like this? I started to learn FLARToolkit and PPV3D about a week ago, got 2 years of as3 oop expirience , but just can’t find enough tutorials and source codes to go on :)

    the flash community from Japan are the best in augumenter reality :)

  2. tarotarorg says:

    Hi, Chrysto.

    Please check this site.
    This is very good tutorial.



Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Intel umbrella
My umbrella bought in Intel Museum has broken

I bought an umbrella at Intel museu

I got Lytro

It's fun! I'm enjoying Lytro!

no image

I'm very busy now. Sadly it can no

FLAR Torch

FLARToolKit NyIDMarker Detector

Hi. I committed the detector