Home | History | Annotate | Download | only in api
      1 
      2 
      3 
      4 
      5 <!DOCTYPE html>
      6 <html lang="en">
      7 <head>
      8   <meta charset="utf-8"  />
      9   <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no"  />
     10   <title>MagickCore, C API: Image Features @ ImageMagick</title>
     11   <meta name="application-name" content="ImageMagick" />
     12   <meta name="description" content="Use ImageMagick to create, edit, compose, or convert bitmap images. You can resize your image, crop it, change its shades and colors, add captions, among other operations." />
     13   <meta name="application-url" content="https://imagemagick.org" />
     14   <meta name="generator" content="PHP" />
     15   <meta name="keywords" content="magickcore, c, api:, image, features, ImageMagick, PerlMagick, image processing, image, photo, software, Magick++, OpenMP, convert" />
     16   <meta name="rating" content="GENERAL" />
     17   <meta name="robots" content="INDEX, FOLLOW" />
     18   <meta name="generator" content="ImageMagick Studio LLC" />
     19   <meta name="author" content="ImageMagick Studio LLC" />
     20   <meta name="revisit-after" content="2 DAYS" />
     21   <meta name="resource-type" content="document" />
     22   <meta name="copyright" content="Copyright (c) 1999-2019 ImageMagick Studio LLC" />
     23   <meta name="distribution" content="Global" />
     24   <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" />
     25   <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" />
     26   <link href="feature.html" rel="canonical" />
     27   <link href="../../images/wand.png" rel="icon" />
     28   <link href="../../images/wand.ico" rel="shortcut icon" />
     29   <link href="../assets/magick.css" rel="stylesheet" />
     30 </head>
     31 <body>
     32   <header>
     33   <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
     34     <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../images/wand.ico"/></a>
     35     <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation">
     36       <span class="navbar-toggler-icon"></span>
     37     </button>
     38 
     39     <div class="navbar-collapse collapse" id="navbarsMagick" style="">
     40     <ul class="navbar-nav mr-auto">
     41       <li class="nav-item ">
     42         <a class="nav-link" href="quantize.html">Home <span class="sr-only">(current)</span></a>
     43       </li>
     44       <li class="nav-item ">
     45         <a class="nav-link" href="../../www/download.html">Download</a>
     46       </li>
     47       <li class="nav-item ">
     48         <a class="nav-link" href="../../www/command-line-tools.html">Tools</a>
     49       </li>
     50       <li class="nav-item ">
     51         <a class="nav-link" href="../../www/command-line-processing.html">Command-line</a>
     52       </li>
     53       <li class="nav-item ">
     54         <a class="nav-link" href="../../www/resources.html">Resources</a>
     55       </li>
     56       <li class="nav-item ">
     57         <a class="nav-link" href="../../www/develop.html">Develop</a>
     58       </li>
     59       <li class="nav-item">
     60         <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a>
     61       </li>
     62     </ul>
     63     <form class="form-inline my-2 my-lg-0" action="https://imagemagick.org/script/search.php">
     64       <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search">
     65       <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button>
     66     </form>
     67     </div>
     68   </nav>
     69   <div class="container">
     70    <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script>    <ins class="adsbygoogle"
     71          style="display:block"
     72          data-ad-client="ca-pub-3129977114552745"
     73          data-ad-slot="6345125851"
     74          data-ad-format="auto"></ins>
     75     <script>
     76       (adsbygoogle = window.adsbygoogle || []).push({});
     77     </script>
     78 
     79   </div>
     80   </header>
     81   <main class="container">
     82     <div class="magick-template">
     83 <div class="magick-header">
     84 <p class="text-center"><a href="feature.html#CannyEdgeImage">CannyEdgeImage</a> &#8226; <a href="feature.html#GetImageFeatures">GetImageFeatures</a> &#8226; <a href="feature.html#Use HoughLineImage">Use HoughLineImage</a> &#8226; <a href="feature.html#MeanShiftImage">MeanShiftImage</a></p>
     85 
     86 <h2><a href="../../api/MagickCore/feature_8c.html" id="CannyEdgeImage">CannyEdgeImage</a></h2>
     87 
     88 <p>CannyEdgeImage() uses a multi-stage algorithm to detect a wide range of edges in images.</p>
     89 
     90 <p>The format of the CannyEdgeImage method is:</p>
     91 
     92 <pre class="text">
     93 Image *CannyEdgeImage(const Image *image,const double radius,
     94   const double sigma,const double lower_percent,
     95   const double upper_percent,ExceptionInfo *exception)
     96 </pre>
     97 
     98 <p>A description of each parameter follows:</p>
     99 
    100 <dd>
    101 </dd>
    102 
    103 <dd> </dd>
    104 <dl class="dl-horizontal">
    105 <dt>image</dt>
    106 <dd>the image. </dd>
    107 
    108 <dd> </dd>
    109 <dt>radius</dt>
    110 <dd>the radius of the gaussian smoothing filter. </dd>
    111 
    112 <dd> </dd>
    113 <dt>sigma</dt>
    114 <dd>the sigma of the gaussian smoothing filter. </dd>
    115 
    116 <dd> </dd>
    117 <dt>lower_percent</dt>
    118 <dd>percentage of edge pixels in the lower threshold. </dd>
    119 
    120 <dd> </dd>
    121 <dt>upper_percent</dt>
    122 <dd>percentage of edge pixels in the upper threshold. </dd>
    123 
    124 <dd> </dd>
    125 <dt>exception</dt>
    126 <dd>return any errors or warnings in this structure. </dd>
    127 
    128 <dd>  </dd>
    129 </dl>
    130 <h2><a href="../../api/MagickCore/feature_8c.html" id="GetImageFeatures">GetImageFeatures</a></h2>
    131 
    132 <p>GetImageFeatures() returns features for each channel in the image in each of four directions (horizontal, vertical, left and right diagonals) for the specified distance.  The features include the angular second moment, contrast, correlation, sum of squares: variance, inverse difference moment, sum average, sum varience, sum entropy, entropy, difference variance,  difference entropy, information measures of correlation 1, information measures of correlation 2, and maximum correlation coefficient.  You can access the red channel contrast, for example, like this:</p>
    133 
    134 <pre class="text">
    135 channel_features=GetImageFeatures(image,1,exception);
    136 contrast=channel_features[RedPixelChannel].contrast[0];
    137 </pre>
    138 
    139 <p>Use MagickRelinquishMemory() to free the features buffer.</p>
    140 
    141 <p>The format of the GetImageFeatures method is:</p>
    142 
    143 <pre class="text">
    144 ChannelFeatures *GetImageFeatures(const Image *image,
    145   const size_t distance,ExceptionInfo *exception)
    146 </pre>
    147 
    148 <p>A description of each parameter follows:</p>
    149 
    150 <dd>
    151 </dd>
    152 
    153 <dd> </dd>
    154 <dl class="dl-horizontal">
    155 <dt>image</dt>
    156 <dd>the image. </dd>
    157 
    158 <dd> </dd>
    159 <dt>distance</dt>
    160 <dd>the distance. </dd>
    161 
    162 <dd> </dd>
    163 <dt>exception</dt>
    164 <dd>return any errors or warnings in this structure. </dd>
    165 
    166 <dd>  </dd>
    167 </dl>
    168 <h2><a href="../../api/MagickCore/feature_8c.html" id="Use_HoughLineImage">Use HoughLineImage</a></h2>
    169 
    170 <p>Use HoughLineImage() in conjunction with any binary edge extracted image (we recommand Canny) to identify lines in the image.  The algorithm accumulates counts for every white pixel for every possible orientation (for angles from 0 to 179 in 1 degree increments) and distance from the center of the image to the corner (in 1 px increments) and stores the counts in an accumulator matrix of angle vs distance. The size of the accumulator is 180x(diagonal/2). Next it searches this space for peaks in counts and converts the locations of the peaks to slope and intercept in the normal x,y input image space. Use the slope/intercepts to find the endpoints clipped to the bounds of the image. The lines are then drawn. The counts are a measure of the length of the lines</p>
    171 
    172 <p>The format of the HoughLineImage method is:</p>
    173 
    174 <pre class="text">
    175 Image *HoughLineImage(const Image *image,const size_t width,
    176   const size_t height,const size_t threshold,ExceptionInfo *exception)
    177 </pre>
    178 
    179 <p>A description of each parameter follows:</p>
    180 
    181 <dd>
    182 </dd>
    183 
    184 <dd> </dd>
    185 <dl class="dl-horizontal">
    186 <dt>image</dt>
    187 <dd>the image. </dd>
    188 
    189 <dd> </dd>
    190 <dt>width, height</dt>
    191 <dd>find line pairs as local maxima in this neighborhood. </dd>
    192 
    193 <dd> </dd>
    194 <dt>threshold</dt>
    195 <dd>the line count threshold. </dd>
    196 
    197 <dd> </dd>
    198 <dt>exception</dt>
    199 <dd>return any errors or warnings in this structure. </dd>
    200 
    201 <dd>  </dd>
    202 </dl>
    203 <h2><a href="../../api/MagickCore/feature_8c.html" id="MeanShiftImage">MeanShiftImage</a></h2>
    204 
    205 <p>MeanShiftImage() delineate arbitrarily shaped clusters in the image. For each pixel, it visits all the pixels in the neighborhood specified by the window centered at the pixel and excludes those that are outside the radius=(window-1)/2 surrounding the pixel. From those pixels, it finds those that are within the specified color distance from the current mean, and computes a new x,y centroid from those coordinates and a new mean. This new x,y centroid is used as the center for a new window. This process iterates until it converges and the final mean is replaces the (original window center) pixel value. It repeats this process for the next pixel, etc., until it processes all pixels in the image. Results are typically better with colorspaces other than sRGB. We recommend YIQ, YUV or YCbCr.</p>
    206 
    207 <p>The format of the MeanShiftImage method is:</p>
    208 
    209 <pre class="text">
    210 Image *MeanShiftImage(const Image *image,const size_t width,
    211   const size_t height,const double color_distance,
    212   ExceptionInfo *exception)
    213 </pre>
    214 
    215 <p>A description of each parameter follows:</p>
    216 
    217 <dd>
    218 </dd>
    219 
    220 <dd> </dd>
    221 <dl class="dl-horizontal">
    222 <dt>image</dt>
    223 <dd>the image. </dd>
    224 
    225 <dd> </dd>
    226 <dt>width, height</dt>
    227 <dd>find pixels in this neighborhood. </dd>
    228 
    229 <dd> </dd>
    230 <dt>color_distance</dt>
    231 <dd>the color distance. </dd>
    232 
    233 <dd> </dd>
    234 <dt>exception</dt>
    235 <dd>return any errors or warnings in this structure. </dd>
    236 
    237 <dd>  </dd>
    238 </dl>
    239 </div>
    240     </div>
    241   </main><!-- /.container -->
    242   <footer class="magick-footer">
    243     <p><a href="../../www/security-policy.html">Security</a> 
    244     <a href="../../www/architecture.html">Architecture</a> 
    245     <a href="../../www/links.html">Related</a> 
    246      <a href="../../www/sitemap.html">Sitemap</a>
    247        
    248     <a href="feature.html#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../../images/wand.ico"/></a>
    249        
    250     <a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 
    251     <a href="../../www/support.html">Donate</a> 
    252     <a href="../../www/contact.html">Contact Us</a>
    253     <br/>
    254     <small> 1999-2019 ImageMagick Studio LLC</small></p>
    255   </footer>
    256 
    257   <!-- Javascript assets -->
    258   <script src="../assets/magick.js" crossorigin="anonymous"></script>
    259   <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.3.1/jquery.min.js"><\/script>')</script>
    260 </body>
    261 </html>
    262 <!-- Magick Cache 4th January 2019 05:48 -->