Ignore:
Timestamp:
Jul 29, 2008, 1:01:29 AM (12 years ago)
Author:
Sam Hocevar
Message:
  • Big API reorganisation. Now libpipi can transparently convert between colour spaces for a given image. For instance, if pipi_gaussian_blur is applied to a 32-bpp image, it is automatically converted to gamma-corrected 32-bit floats beforehands, then converted back to normal.
  • TODO: clipping, regions of interest, more formats, getpixel macros...
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpipi/trunk/pipi/codec/opencv.c

    r2261 r2605  
    3939
    4040    img = (pipi_image_t *)malloc(sizeof(pipi_image_t));
    41     img->width = priv->width;
    42     img->height = priv->height;
    43     img->pitch = priv->widthStep;
    44     img->channels = priv->nChannels;
    45     img->pixels = priv->imageData;
    46     img->priv = (void *)priv;
     41    memset(img, 0, sizeof(pipi_image_t));
     42
     43    img->w = priv->width;
     44    img->h = priv->height;
     45
     46    img->p[PIPI_PIXELS_RGBA32].pixels = priv->imageData;
     47    img->p[PIPI_PIXELS_RGBA32].w = priv->width;
     48    img->p[PIPI_PIXELS_RGBA32].h = priv->height;
     49    img->p[PIPI_PIXELS_RGBA32].pitch = priv->widthStep;
     50    img->last_modified = PIPI_PIXELS_RGBA32;
     51
     52    img->codec_priv = (void *)priv;
     53    img->codec_format = PIPI_PIXELS_RGBA32;
    4754
    4855    return img;
     
    5865
    5966    img = (pipi_image_t *)malloc(sizeof(pipi_image_t));
    60     img->width = priv->width;
    61     img->height = priv->height;
    62     img->pitch = priv->widthStep;
    63     img->channels = priv->nChannels;
    64     img->pixels = priv->imageData;
    65     img->priv = (void *)priv;
     67    memset(img, 0, sizeof(pipi_image_t));
     68
     69    img->w = priv->width;
     70    img->h = priv->height;
     71
     72    img->p[PIPI_PIXELS_RGBA32].pixels = priv->imageData;
     73    img->p[PIPI_PIXELS_RGBA32].w = priv->width;
     74    img->p[PIPI_PIXELS_RGBA32].h = priv->height;
     75    img->p[PIPI_PIXELS_RGBA32].pitch = priv->widthStep;
     76    img->last_modified = PIPI_PIXELS_RGBA32;
     77
     78    img->codec_priv = (void *)priv;
     79    img->codec_format = PIPI_PIXELS_RGBA32;
    6680
    6781    return img;
     
    7185{
    7286    IplImage *iplimg;
    73     iplimg = (IplImage *)img->priv;
     87    iplimg = (IplImage *)img->codec_priv;
    7488    cvReleaseImage(&iplimg);
    7589
     
    7993void pipi_save_opencv(pipi_image_t *img, const char *name)
    8094{
    81     cvSaveImage(name, img->priv);
     95    pipi_getpixels(img, img->codec_format);
     96    cvSaveImage(name, img->codec_priv);
    8297}
    8398
Note: See TracChangeset for help on using the changeset viewer.