Changeset 4078


Ignore:
Timestamp:
03/28/11 20:51:23 (2 years ago)
Author:
cristy
Message:
 
Location:
ImageMagick/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ImageMagick/trunk/ChangeLog

    r4077 r4078  
     12011-03-29  6.6.9-1 Cristy  <quetzlzacatenango@image...> 
     2  * Support -statistic standard-deviation option. 
     3 
    142011-03-28  6.6.9-0 Cristy  <quetzlzacatenango@image...> 
    25  * New version 6.6.9-0. 
  • ImageMagick/trunk/magick/effect.c

    r4012 r4078  
    47864786  size_t 
    47874787    color, 
    4788     mean; 
     4788    sum; 
    47894789 
    47904790  ssize_t 
     
    48024802    color=65536L; 
    48034803    count=0; 
    4804     mean=0; 
     4804    sum=0; 
    48054805    do 
    48064806    { 
    48074807      color=list->nodes[color].next[0]; 
    4808       mean+=list->nodes[color].count*color; 
     4808      sum+=list->nodes[color].count*color; 
    48094809      count+=list->nodes[color].count; 
    48104810    } while (count < (ssize_t) pixel_list->length); 
    4811     channels[channel]=(unsigned short) (mean/pixel_list->length); 
     4811    channels[channel]=(unsigned short) (sum/pixel_list->length); 
    48124812  } 
    48134813  GetMagickPixelPacket((const Image *) NULL,&pixel); 
     
    50095009        color=previous; 
    50105010    channels[channel]=(unsigned short) color; 
     5011  } 
     5012  GetMagickPixelPacket((const Image *) NULL,&pixel); 
     5013  pixel.red=(MagickRealType) ScaleShortToQuantum(channels[0]); 
     5014  pixel.green=(MagickRealType) ScaleShortToQuantum(channels[1]); 
     5015  pixel.blue=(MagickRealType) ScaleShortToQuantum(channels[2]); 
     5016  pixel.opacity=(MagickRealType) ScaleShortToQuantum(channels[3]); 
     5017  pixel.index=(MagickRealType) ScaleShortToQuantum(channels[4]); 
     5018  return(pixel); 
     5019} 
     5020 
     5021static MagickPixelPacket GetStandardDeviationPixelList(PixelList *pixel_list) 
     5022{ 
     5023  MagickPixelPacket 
     5024    pixel; 
     5025 
     5026  register SkipList 
     5027    *list; 
     5028 
     5029  register ssize_t 
     5030    channel; 
     5031 
     5032  size_t 
     5033    color, 
     5034    sum, 
     5035    sum_squared; 
     5036 
     5037  ssize_t 
     5038    count; 
     5039 
     5040  unsigned short 
     5041    channels[ListChannels]; 
     5042 
     5043  /* 
     5044    Find the mean value for each of the color. 
     5045  */ 
     5046  for (channel=0; channel < 5; channel++) 
     5047  { 
     5048    list=pixel_list->lists+channel; 
     5049    color=65536L; 
     5050    count=0; 
     5051    sum=0; 
     5052    do 
     5053    { 
     5054      color=list->nodes[color].next[0]; 
     5055      sum+=list->nodes[color].count*color; 
     5056      sum_squared+=(list->nodes[color].count*color)* 
     5057        (list->nodes[color].count*color); 
     5058      count+=list->nodes[color].count; 
     5059    } while (count < (ssize_t) pixel_list->length); 
     5060    channels[channel]=(unsigned short) sqrt((sum_squared/pixel_list->length)- 
     5061      ((sum/pixel_list->length)*(sum/pixel_list->length))); 
    50115062  } 
    50125063  GetMagickPixelPacket((const Image *) NULL,&pixel); 
     
    52535304        { 
    52545305          pixel=GetNonpeakPixelList(pixel_list[id]); 
     5306          break; 
     5307        } 
     5308        case StandardDeviationStatistic: 
     5309        { 
     5310          pixel=GetStandardDeviationPixelList(pixel_list[id]); 
    52555311          break; 
    52565312        } 
  • ImageMagick/trunk/magick/effect.h

    r3900 r4078  
    6767  MinimumStatistic, 
    6868  ModeStatistic, 
    69   NonpeakStatistic 
     69  NonpeakStatistic, 
     70  StandardDeviationStatistic 
    7071} StatisticType; 
    7172 
  • ImageMagick/trunk/magick/option.c

    r4036 r4078  
    14571457    { "Mode", (ssize_t) ModeStatistic, MagickFalse }, 
    14581458    { "Nonpeak", (ssize_t) NonpeakStatistic, MagickFalse }, 
     1459    { "StandardDeviation", (ssize_t) StandardDeviationStatistic, MagickFalse }, 
    14591460    { (char *) NULL, (ssize_t) UndefinedMethod, MagickFalse } 
    14601461  }, 
Note: See TracChangeset for help on using the changeset viewer.