程序在执行时偶尔崩溃

时间:2019-03-29 06:51:36

标签: c

我正在尝试编译并运行以下程序,但是该程序偶尔崩溃,至少它必须在printf中打印语句,但它不打印任何内容。 在我的主要功能中,我有一个printf语句来打印一条小消息。但是我无法至少打印该消息,并且在执行以下程序时程序崩溃。

如果有人解释了为什么程序崩溃,我们为什么不能至少打印消息,那会很棒。

int main(int argc, char* argv[])
{
  printf("Hello is printed inside main function");
  Hhom_mat_3d     matrix = { 0.99997500037979259,   0.0062966418968722470, 0.0032172839875109580, -0.28922659101699999,
                            -0.0063063227569094167, 0.99997559146565307,   0.0030077842680089487, -0.42127175828500002,
                            -0.0031982665178855465,-0.0030279983057704637, 0.99999030111173615,    2.0524869157899999};
  double          scale = 0.00012830085103181400;
  HIMGDIM         width_in = 4384;
  HIMGDIM         height_in = 6576;
  Tcamera         campar;
  HImageCoordMap  coord_map;
  Hrlregion       region_mapped;
  HBYTE           *image_in, *image_out;

  /* preallocate memory for the map and the region contained in the map */
  region_mapped.num = 0;
  /* the resulting region is either barell or cushion shaped so two run
     lengths per line are sufficient */
  region_mapped.rl = (Hrun*)malloc(sizeof(*region_mapped.rl)*2*6602);
  region_mapped.num_max = 2*6602;
  HAllocImageCoordMap(&coord_map,&region_mapped,4387,6602);

  /* the camera parameters for the problematic case */
  /* center point */
  campar.cx = 2250.9623380799999;
  campar.cy = 3278.8358246700004;

  /* focus */
  campar.b = 87.990791599199994;

  /* pixel size */
  campar.sx = 0.0055000703663300003;
  campar.sy = 0.0054999999999999997;

  /* now, create the map */
  IPGenImageToWorldPlaneCoordMap(matrix,&campar,scale,4384,6576,&coord_map);

  /* uninitialized images are sufficient to reproduce the problem */
  image_in = (HBYTE*)malloc(sizeof(*image_in)*width_in*height_in);
  image_out = (HBYTE*)malloc(sizeof(*image_out)*coord_map.width*coord_map.height);

  IPBMapImageCoordMap(image_in,width_in,&coord_map,image_out);

  return 0;
}

0 个答案:

没有答案