当前位置: 首页>>代码示例>>C++>>正文


C++ Image::normalize方法代码示例

本文整理汇总了C++中magick::Image::normalize方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::normalize方法的具体用法?C++ Image::normalize怎么用?C++ Image::normalize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在magick::Image的用法示例。


在下文中一共展示了Image::normalize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv)
{
  MSG_native native;

  if (argc < 2) return 1;
  if (! native.open(argv[1])) return 1;

  native.read( );

  std::cout << native.header;

  // native.pgmdump(1, "image.pgm");

  unsigned short *pixels = native.data(native.IR_10_8_CHANNEL);

  Magick::Image *image = new Magick::Image(
                         native.pixels(native.IR_10_8_CHANNEL),
                         native.lines(native.IR_10_8_CHANNEL),
                         "I", Magick::ShortPixel, pixels);

  image->normalize( );
  image->rotate(180.0);
  image->write("image.jpg");

  native.close( );
  return 0;
}
开发者ID:ARPA-SIMC,项目名称:meteosatlib,代码行数:27,代码来源:MSG_native.cpp

示例2: main

int main(int argc, char **argv)
{
  MSG_native native;
  char *format;
  float gfactor;

  if (argc > 1)
  {
    if (!strcmp(argv[1], "-V"))
    {
      std::cout << argv[0] << " " << PACKAGE_STRING << std::endl;
      return 0;
    }
  }

  if (argc < 5)
  {
    std::cerr << "Usage: " << argv[0] << " file channel format scale"
              << std::endl;
    std::cerr << "Example: " << argv[0]
              << " MSG1-SEVI-MSG15-0100-NA-20040809131237.412000000Z-5766.nat"
              << " 8 gif 0.1"
              << std::endl;
    return -1;
  }

  int ichn = atoi(argv[2]);
  format = strdup(argv[3]);
  gfactor = atof(argv[4]);

  if (! native.open(argv[1]))
  {
    std::cerr << "Exit: Data Open Error." << std::endl;
    return -1;
  }

  native.read( );

  Magick::Image *image = new Magick::Image(native.pixels(ichn),
                         native.lines(ichn), "I", Magick::ShortPixel,
                         native.data(ichn)); 
  char outname[PATH_MAX];
  snprintf(outname, PATH_MAX, "%s.%s", "MSG1", format);

  image->normalize( );
  image->rotate(180.0);
  image->write(outname);

  Magick::Geometry geom((int) ((float) native.pixels(ichn)*gfactor),
                        (int) ((float) native.lines(ichn) *gfactor));
  image->scale(geom);

  native.close( );
  return 0;
}
开发者ID:ARPA-SIMC,项目名称:meteosatlib,代码行数:55,代码来源:native2Image.cpp

示例3: masked

// returns a masked version of given image where every pixel
// above / below a given value ( in quantum range ) gets transparent
Magick::Image masked( bool below, double value, Magick::Image img )
{
    Magick::Image mask = img;
    mask.type( Magick::GrayscaleMatteType );
    mask.normalize();
    double v = below ? value : 1-value;
    mask.threshold( v*MaxRGB );
    if( below )
        mask.negate();
    mask.type( Magick::TrueColorMatteType );
    mask.transparent( "black" );

    Magick::Image masked = img;
    masked.composite( mask, Magick::CenterGravity, Magick::CopyOpacityCompositeOp );
    return masked;
}
开发者ID:manuel-koch,项目名称:rawstack,代码行数:18,代码来源:ufrawworker.cpp

示例4: main

int main (int argc, char *argv[])
{
  MSG_db1_data db1;
  char *format;
  char *image_overlay = 0;
  float gfactor;

  if (argc > 1)
  {
    if (!strcmp(argv[1], "-V"))
    {
      std::cout << argv[0] << " " << PACKAGE_STRING << std::endl;
      return 0;
    }
  }

  if (argc < 5)
  {
    std::cerr << "Usage: " << argv[0] << " directory channel format"
              << " scale [overlay image]" << std::endl;
    std::cerr << "Example: " << argv[0]
              << " dati IR_120 gif 0.1 SEVIRI_OVERLAY.pgm" << std::endl;
    return -1;
  }

  format = strdup(argv[3]);
  gfactor = atof(argv[4]);

  if (argc > 5)
    image_overlay = strdup(argv[5]);
  
  db1.open(argv[1]);
  if (! db1.has_channel(argv[2]))
  {
    std::cerr << "Exit: this channel is not present." << std::endl;
    return -1;
  }

  db1.set_channel(argv[2]);

  if (! db1.is_data_ok( ))
  {
    std::cerr << "Exit: Data Open Error." << std::endl;
    return -1;
  }

  char outname[PATH_MAX];
  snprintf(outname, PATH_MAX, "%s_%s_%s.%s", db1.get_INFO_satellite_name( ),
           db1.get_channel_INFO_name( ),
           db1.get_INFO_schedule_start( ), format);
  for (int i = 0; i < (int) strlen(outname); i ++)
  {
    if (outname[i] == '/') outname[i] = '-';
    if (outname[i] == ' ') outname[i] = '_';
    if (outname[i] == ':') outname[i] = '-';
  }

  Magick::Image *image = new Magick::Image(db1.get_INFO_image_pixels( ),
                                           db1.get_INFO_image_lines( ),
                                           "I", Magick::ShortPixel,
                                           db1.get_RAW_data( ));
  image->normalize( );

  if (! db1.get_INFO_schedule_northsouth( )) image->rotate(180.0);

  if (image_overlay)
  {
    Magick::Image overlay;
    overlay.read("SEVIRI_OVERLAY.pgm");
    image->composite(overlay, 0, 0, Magick::PlusCompositeOp);
  }

  Magick::Geometry geom((int) ((float) db1.get_INFO_image_pixels( )*gfactor),
                        (int) ((float) db1.get_INFO_image_lines( )*gfactor));
  image->scale(geom);

  image->write(outname);

  db1.close( );
  return 0;
}
开发者ID:ARPA-SIMC,项目名称:meteosatlib,代码行数:81,代码来源:db1_to_image.cpp

示例5:

void Magick::normalizeImage::operator()( Magick::Image &image_ ) const
{
  image_.normalize( );
}
开发者ID:0xPr0xy,项目名称:ImageMagick,代码行数:4,代码来源:STL.cpp

示例6: main

int main(int argc, char *argv[ ])
{
    char *directory = NULL;
    char *overlay_image = NULL;
    char *resolution = NULL;
    char *productid1 = NULL;
    char *productid2 = NULL;
    char *timing = NULL;
    char *format = NULL;

    char *pname = strdup(argv[0]);

    float geometry = 1.0;
    bool normalize = false;
    bool do_overlay = false;

    while (1) {
        int option_index = 0;
        int c;

        static struct option long_options[] = {
            {"directory", 1, 0, 'd'},
            {"resolution", 1, 0, 'r'},
            {"productid1", 1, 0, 's'},
            {"productid2", 1, 0, 'c'},
            {"outformat", 1, 0, 'f'},
            {"outscale", 1, 0, 'g'},
            {"overlay", 1, 0, 'o'},
            {"time", 1, 0, 't'},
            {"normalize", 0, 0, 'n'},
            {"version", 0, 0, 'V'},
            {"help", 0, 0, 'h'},
            {0, 0, 0, 0}
        };

        c = getopt_long (argc, argv, "d:r:s:c:f:g:o:t:nVh?",
                         long_options, &option_index);
        if (c == -1)
            break;

        switch (c)
        {
        case 'd':
            directory = strdup(optarg);
            break;
        case 'r':
            resolution = strdup(optarg);
            break;
        case 's':
            productid1 = strdup(optarg);
            break;
        case 'c':
            productid2 = strdup(optarg);
            break;
        case 'f':
            format = strdup(optarg);
            break;
        case 'g':
            geometry = strtod(optarg, (char **)NULL);
            break;
        case 'o':
            do_overlay = true;
            overlay_image = strdup(optarg);
            break;
        case 't':
            timing = strdup(optarg);
            break;
        case 'n':
            normalize = true;
            break;
        case 'V':
            std::cout << pname << " " << PACKAGE_STRING << std::endl;
            return 0;
        case '?':
        case 'h':
            usage(pname);
            return(0);
            break;
        default:
            std::cerr << "?? getopt returned character code"
                      << std::oct << c << "??" << std::endl;
            usage(pname);
            return(1);
        }
    }

    if (resolution == NULL || productid1 == NULL ||
            productid2 == NULL || timing == NULL)
    {
        usage(pname);
        return(1);
    }

    std::string filename;
    if (directory) filename = directory;
    else filename = ".";

    filename = filename + PATH_SEPARATOR + resolution;
    filename = filename + "-\?\?\?-\?\?\?\?\?\?-";
    filename = filename + underscoreit(productid1, 12) + "-";
//.........这里部分代码省略.........
开发者ID:ARPA-SIMC,项目名称:meteosatlib,代码行数:101,代码来源:XRIT2Image.cpp


注:本文中的magick::Image::normalize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。