title: How to implement sift algorithm in 3 dimension using opencv and c++?
body: <p>I am confused about how to implement sift algorithm in 3-dimension using opencv and c++. I understand the 3D sift algorithm principle from some papers but I don't have a clear mind on implementation. There are some open source code which is written in matlab, <strong>I want to implement the algorithm using c++ and opencv but have no idea on delcaring the data structure</strong>.</p>
  
  <p>3D sift algorithm can be simply described as following steps:</p>
  
  <p><strong>(1) Build the scale space and generate the DOG(Difference of Gaussian).</strong></p>
  
  <p>(2) Detect the extrema and filter some inappropriate keypoints.</p>
  
  <p>(3) Assign the keypoints orientation in 3D.</p>
  
  <p>(4) Generate the keypoint descriptor in 3D.</p>
  
  <p>Assume that the 3D input data is ready and can be stored in a 3D array(e.g. double*** data). </p>
  
  <p>My first try is to declare the 3D matrix(3D Volume) by the following (the data in 3D array can be copied to the Mat):</p>
  
  <pre><code>int sizes[] = {x ,y, z};
  Mat *Img = new Mat(3, sizes, CV_8U, Scalar(0));// using namespace cv
  </code></pre>
  
  <p>Then I encounter some problems in <strong>step1</strong> of the algorithm:</p>
  
  <p>(1) Is there a way to <strong>declare a 3D volume</strong> using something like <strong>typedef</strong>, since the scale space contains different sizes of the 3D volume. The size array should not be constant.</p>
  
  <p>(2) I cannot find ways to <strong>resize the 3D volume or do the Gaussian filter for 3D volume</strong>. Is it a reasonable approach to decompose the 3D volume into 2D slices and do the resize or Gaussian filter on each slices? Or is there any function can be directly applied on 3D volume?</p>
  
  <p>Constructing the appropriate data structure should be the key of the algorithm and I don't have a clear mind on how to use opencv.</p>
  
  <p>Thanks for help!</p>