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>ImageMagick - MagickCore, C API: Image Features</title> 11 <meta name="application-name" content="ImageMagick" /> 12 <meta name="description" content="Use ImageMagick® to create, edit, compose, and convert bitmap images. Resize an image, crop it, change its shades and colors, add captions, and more." /> 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-2020 ImageMagick Studio LLC" /> 23 <meta name="distribution" content="Global" /> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1" /> 25 <meta property='og:url' content='../../' /> 26 <meta property='og:title' content='ImageMagick' /> 27 <meta property='og:image' content='../../images/logo.png' /> 28 <meta property='og:type' content='website' /> 29 <meta property='og:site_name' content='ImageMagick' /> 30 <meta property='og:description' content="Convert, Edit, or Compose Bitmap Images" /> 31 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 32 <link href="feature.html" rel="canonical" /> 33 <link href="../../images/wand.png" rel="icon" /> 34 <link href="../../images/wand.ico" rel="shortcut icon" /> 35 <link href="../assets/magick.css" rel="stylesheet" /> 36</head> 37<body> 38 <nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> 39 <a class="navbar-brand" href="../../"><img class="d-block" id="icon" alt="ImageMagick" width="32" height="32" src="../../images/wand.ico"/></a> 40 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsMagick" aria-controls="navbarsMagick" aria-expanded="false" aria-label="Toggle navigation"> 41 <span class="navbar-toggler-icon"></span> 42 </button> 43 44 <div class="navbar-collapse collapse" id="navbarsMagick" style=""> 45 <ul class="navbar-nav mr-auto"> 46 <li class="nav-item "> 47 <a class="nav-link" href="../../">Home <span class="sr-only">(current)</span></a> 48 </li> 49 <li class="nav-item "> 50 <a class="nav-link" href="../../www/download.html">Download</a> 51 </li> 52 <li class="nav-item "> 53 <a class="nav-link" href="../../www/command-line-tools.html">Tools</a> 54 </li> 55 <li class="nav-item "> 56 <a class="nav-link" href="../../www/command-line-processing.html">Command-line</a> 57 </li> 58 <li class="nav-item "> 59 <a class="nav-link" href="../../www/resources.html">Resources</a> 60 </li> 61 <li class="nav-item "> 62 <a class="nav-link" href="../../www/develop.html">Develop</a> 63 </li> 64 <li class="nav-item"> 65 <a class="nav-link" target="_blank" href="https://imagemagick.org/discourse-server/">Community</a> 66 </li> 67 </ul> 68 <form class="form-inline my-2 my-lg-0" action="../https://imagemagick.org/script/search.php"> 69 <input class="form-control mr-sm-2" type="text" name="q" placeholder="Search" aria-label="Search"> 70 <button class="btn btn-outline-success my-2 my-sm-0" type="submit" name="sa">Search</button> 71 </form> 72 </div> 73 </nav> 74 <div class="container"> 75 <script async="async" src="https://localhost/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 76 style="display:block" 77 data-ad-client="ca-pub-3129977114552745" 78 data-ad-slot="6345125851" 79 data-full-width-responsive="true" 80 data-ad-format="horizontal"></ins> 81 <script> 82 (adsbygoogle = window.adsbygoogle || []).push({}); 83 </script> 84 85 </div> 86 87 <main class="container"> 88 <div class="magick-template"> 89<div class="magick-header"> 90<p class="text-center"><a href="feature.html#CannyEdgeImage">CannyEdgeImage</a> • <a href="feature.html#GetImageFeatures">GetImageFeatures</a> • <a href="feature.html#Use HoughLineImage">Use HoughLineImage</a> • <a href="feature.html#MeanShiftImage">MeanShiftImage</a></p> 91 92<h2><a href="../../api/MagickCore/feature_8c.html" id="CannyEdgeImage">CannyEdgeImage</a></h2> 93 94<p>CannyEdgeImage() uses a multi-stage algorithm to detect a wide range of edges in images.</p> 95 96<p>The format of the CannyEdgeImage method is:</p> 97 98<pre class="text"> 99Image *CannyEdgeImage(const Image *image,const double radius, 100 const double sigma,const double lower_percent, 101 const double upper_percent,ExceptionInfo *exception) 102</pre> 103 104<p>A description of each parameter follows:</p> 105 106<dd> 107</dd> 108 109<dd> </dd> 110<dl class="dl-horizontal"> 111<dt>image</dt> 112<dd>the image. </dd> 113 114<dd> </dd> 115<dt>radius</dt> 116<dd>the radius of the gaussian smoothing filter. </dd> 117 118<dd> </dd> 119<dt>sigma</dt> 120<dd>the sigma of the gaussian smoothing filter. </dd> 121 122<dd> </dd> 123<dt>lower_percent</dt> 124<dd>percentage of edge pixels in the lower threshold. </dd> 125 126<dd> </dd> 127<dt>upper_percent</dt> 128<dd>percentage of edge pixels in the upper threshold. </dd> 129 130<dd> </dd> 131<dt>exception</dt> 132<dd>return any errors or warnings in this structure. </dd> 133 134<dd> </dd> 135</dl> 136<h2><a href="../../api/MagickCore/feature_8c.html" id="GetImageFeatures">GetImageFeatures</a></h2> 137 138<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> 139 140<pre class="text"> 141channel_features=GetImageFeatures(image,1,exception); 142contrast=channel_features[RedPixelChannel].contrast[0]; 143</pre> 144 145<p>Use MagickRelinquishMemory() to free the features buffer.</p> 146 147<p>The format of the GetImageFeatures method is:</p> 148 149<pre class="text"> 150ChannelFeatures *GetImageFeatures(const Image *image, 151 const size_t distance,ExceptionInfo *exception) 152</pre> 153 154<p>A description of each parameter follows:</p> 155 156<dd> 157</dd> 158 159<dd> </dd> 160<dl class="dl-horizontal"> 161<dt>image</dt> 162<dd>the image. </dd> 163 164<dd> </dd> 165<dt>distance</dt> 166<dd>the distance. </dd> 167 168<dd> </dd> 169<dt>exception</dt> 170<dd>return any errors or warnings in this structure. </dd> 171 172<dd> </dd> 173</dl> 174<h2><a href="../../api/MagickCore/feature_8c.html" id="Use_HoughLineImage">Use HoughLineImage</a></h2> 175 176<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> 177 178<p>The format of the HoughLineImage method is:</p> 179 180<pre class="text"> 181Image *HoughLineImage(const Image *image,const size_t width, 182 const size_t height,const size_t threshold,ExceptionInfo *exception) 183</pre> 184 185<p>A description of each parameter follows:</p> 186 187<dd> 188</dd> 189 190<dd> </dd> 191<dl class="dl-horizontal"> 192<dt>image</dt> 193<dd>the image. </dd> 194 195<dd> </dd> 196<dt>width, height</dt> 197<dd>find line pairs as local maxima in this neighborhood. </dd> 198 199<dd> </dd> 200<dt>threshold</dt> 201<dd>the line count threshold. </dd> 202 203<dd> </dd> 204<dt>exception</dt> 205<dd>return any errors or warnings in this structure. </dd> 206 207<dd> </dd> 208</dl> 209<h2><a href="../../api/MagickCore/feature_8c.html" id="MeanShiftImage">MeanShiftImage</a></h2> 210 211<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> 212 213<p>The format of the MeanShiftImage method is:</p> 214 215<pre class="text"> 216Image *MeanShiftImage(const Image *image,const size_t width, 217 const size_t height,const double color_distance, 218 ExceptionInfo *exception) 219</pre> 220 221<p>A description of each parameter follows:</p> 222 223<dd> 224</dd> 225 226<dd> </dd> 227<dl class="dl-horizontal"> 228<dt>image</dt> 229<dd>the image. </dd> 230 231<dd> </dd> 232<dt>width, height</dt> 233<dd>find pixels in this neighborhood. </dd> 234 235<dd> </dd> 236<dt>color_distance</dt> 237<dd>the color distance. </dd> 238 239<dd> </dd> 240<dt>exception</dt> 241<dd>return any errors or warnings in this structure. </dd> 242 243<dd> </dd> 244</dl> 245</div> 246 </div> 247 </main><!-- /.container --> 248 <footer class="magick-footer"> 249 <p><a href="../../www/security-policy.html">Security</a> • 250 <a href="../../www/architecture.html">Architecture</a> 251 252 <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> 253 254 <a href="../../www/links.html">Related</a> • 255 <a href="../../www/sitemap.html">Sitemap</a> 256 <br/> 257 <a href="../../www/support.html">Donate</a> • 258 <a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • 259 <a href="../../www/contact.html">Contact Us</a> 260 <br/> 261 <small>© 1999-2020 ImageMagick Studio LLC</small></p> 262 </footer> 263 264 <!-- Javascript assets --> 265 <script src="../assets/magick.js" crossorigin="anonymous"></script> 266 <script>window.jQuery || document.write('<script src="https://localhost/ajax/libs/jquery/3.4.1/jquery.min.js"><\/script>')</script> 267</body> 268</html> 269<!-- Magick Cache 29th December 2019 16:55 -->