忍者ブログ
  • 2025.03
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 2025.05
[PR]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

【2025/04/28 02:02 】 |
構造体で要素数が不定の配列を保持する。
複数の画像中の特徴点を保持するときに使いそう。
各画像中の点の数は不定で、プログラム中で取得する。

構造体の型宣言
struct point{
  int *x;
  int *y;
};

構造体の宣言
struct point Point[image];

pix個の特徴点があるとき
Point[i].x = Initialize_1dimInt(Point[i].x, pix);
Point[i].y = Initialize_1dimInt(Point[i].y, pix);

構造体で宣言しているポインタを配列化する
int* Initialize_1dimInt(int *array, int max){
   array = (int *)calloc(max, sizeof(int));
   return array;
}

データにアクセスするとき
x = Point[i].x[p];
y = Point[i].y[p];
PR
【2011/05/18 10:33 】 | Program
<<前ページ | ホーム | 次ページ>>