put_point.c -特徴点の描画プログラム


#include 
#include  
#include 

/* 抽出した点に関する情報を格納するための構造体 */
struct point
 {
  int rsize;       /* 赤色の球の面積 */
  int gsize;       /* 緑色の球の面積 */
  int row_r;       /* 赤色の球の重心のy座標 */
  int col_r;       /* 赤色の球の重心のx座標 */
  int row_g;       /* 緑色の球の重心のy座標 */       
  int col_g;       /* 緑色の球の重心のx座標 */
  int left_r;      /* 赤色の球の直径の左端の点のx座標 */
  int right_r;     /* 赤色の球の直径の右端の点のx座標 */  
  int up_r;        /* 赤色の球の直径の上端の点のy座標 */
  int down_r;      /* 赤色の球の直径の下端の点のy座標 */
  int left_g;      /* 緑色の球の直径の左端の点のx座標 */  
  int right_g;     /* 緑色の球の直径の右端の点のx座標 */   
  int up_g;        /* 緑色の球の直径の上端の点のy座標 */ 
  int down_g;      /* 緑色の球の直径の下端の点のy座標 */ 
};

/* 特徴点の描画 */
void put_point(struct point newpoint)
{
    glColor3f(1.0, 0.0, 0.0);
    /* 赤色の球の位置を描画 */
    glBegin(GL_LINE_LOOP);
        glVertex2s(newpoint.left_r,-newpoint.up_r);
        glVertex2s(newpoint.left_r,-newpoint.down_r);
        glVertex2s(newpoint.right_r,-newpoint.down_r);
        glVertex2s(newpoint.right_r,-newpoint.up_r);
    glEnd();   
    glColor3f(0.0, 1.0, 0.0);
    /* 緑色の球の位置を描画 */
    glBegin(GL_LINE_LOOP);
        glVertex2s(newpoint.left_g,-newpoint.up_g);
        glVertex2s(newpoint.left_g,-newpoint.down_g);
        glVertex2s(newpoint.right_g,-newpoint.down_g);
        glVertex2s(newpoint.right_g,-newpoint.up_g);
    glEnd();
}


programのページへ戻る