1 2 3 4 5 <!DOCTYPE html> 6 <html lang="en"> 7 <head> 8 <meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> 9 <title>ImageMagick: MagickCore, C API for ImageMagick: Image Features</title> 10 <meta http-equiv="content-type" content="text/html; charset=utf-8"/> 11 <meta name="application-name" content="ImageMagick"/> 12 <meta name="description" content="ImageMagick is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 200) including PNG, JPEG, JPEG-2000, GIF, WebP, Postscript, PDF, and SVG. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bzier curves."/> 13 <meta name="application-url" content="http://www.imagemagick.org"/> 14 <meta name="generator" content="PHP"/> 15 <meta name="keywords" content="magickcore, c, api, for, imagemagick:, 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-2016 ImageMagick Studio LLC"/> 23 <meta name="distribution" content="Global"/> 24 <meta name="magick-serial" content="P131-S030410-R485315270133-P82224-A6668-G1245-1"/> 25 <link rel="icon" href="../image/wand.png"/> 26 <link rel="shortcut icon" href="../image/wand.ico"/> 27 <link rel="stylesheet" href="../css/magick.php"/> 28 </head> 29 <body> 30 <div class="main"> 31 <div class="magick-masthead"> 32 <div class="container"> 33 <script async="async" src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" 34 style="display:block" 35 data-ad-client="ca-pub-3129977114552745" 36 data-ad-slot="6345125851" 37 data-ad-format="auto"></ins> 38 <script> 39 (adsbygoogle = window.adsbygoogle || []).push({}); 40 </script> 41 <nav class="magick-nav"> 42 <a class="magick-nav-item " href="../index.php">Home</a> 43 <a class="magick-nav-item " href="../script/binary-releases.php">Download</a> 44 <a class="magick-nav-item " href="../script/command-line-tools.php">Tools</a> 45 <a class="magick-nav-item " href="../script/command-line-options.php">Options</a> 46 <a class="magick-nav-item " href="../script/resources.php">Resources</a> 47 <a class="magick-nav-item " href="../script/api.php">Develop</a> 48 <a class="magick-nav-item " href="../script/search.php">Search</a> 49 <a class="magick-nav-item pull-right" href="http://www.imagemagick.org/discourse-server/">Community</a> 50 </nav> 51 </div> 52 </div> 53 <div class="container"> 54 <div class="magick-header"> 55 <p class="text-center"><a href="feature.php#CannyEdgeImage">CannyEdgeImage</a> • <a href="feature.php#GetImageFeatures">GetImageFeatures</a> • <a href="feature.php#Use HoughLineImage">Use HoughLineImage</a> • <a href="feature.php#MeanShiftImage">MeanShiftImage</a></p> 56 57 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/feature_8c.html" id="CannyEdgeImage">CannyEdgeImage</a></h2> 58 59 <p>CannyEdgeImage() uses a multi-stage algorithm to detect a wide range of edges in images.</p> 60 61 <p>The format of the CannyEdgeImage method is:</p> 62 63 <pre class="text"> 64 Image *CannyEdgeImage(const Image *image,const double radius, 65 const double sigma,const double lower_percent, 66 const double upper_percent,ExceptionInfo *exception) 67 </pre> 68 69 <p>A description of each parameter follows:</p> 70 71 <dd> 72 </dd> 73 74 <dd> </dd> 75 <dl class="dl-horizontal"> 76 <dt>image</dt> 77 <dd>the image. </dd> 78 79 <dd> </dd> 80 <dt>radius</dt> 81 <dd>the radius of the gaussian smoothing filter. </dd> 82 83 <dd> </dd> 84 <dt>sigma</dt> 85 <dd>the sigma of the gaussian smoothing filter. </dd> 86 87 <dd> </dd> 88 <dt>lower_precent</dt> 89 <dd>percentage of edge pixels in the lower threshold. </dd> 90 91 <dd> </dd> 92 <dt>upper_percent</dt> 93 <dd>percentage of edge pixels in the upper threshold. </dd> 94 95 <dd> </dd> 96 <dt>exception</dt> 97 <dd>return any errors or warnings in this structure. </dd> 98 99 <dd> </dd> 100 </dl> 101 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/feature_8c.html" id="GetImageFeatures">GetImageFeatures</a></h2> 102 103 <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> 104 105 <pre class="text"> 106 channel_features=GetImageFeatures(image,1,exception); 107 contrast=channel_features[RedPixelChannel].contrast[0]; 108 </pre> 109 110 <p>Use MagickRelinquishMemory() to free the features buffer.</p> 111 112 <p>The format of the GetImageFeatures method is:</p> 113 114 <pre class="text"> 115 ChannelFeatures *GetImageFeatures(const Image *image, 116 const size_t distance,ExceptionInfo *exception) 117 </pre> 118 119 <p>A description of each parameter follows:</p> 120 121 <dd> 122 </dd> 123 124 <dd> </dd> 125 <dl class="dl-horizontal"> 126 <dt>image</dt> 127 <dd>the image. </dd> 128 129 <dd> </dd> 130 <dt>distance</dt> 131 <dd>the distance. </dd> 132 133 <dd> </dd> 134 <dt>exception</dt> 135 <dd>return any errors or warnings in this structure. </dd> 136 137 <dd> </dd> 138 </dl> 139 <h2><a href="http://nextgen.imagemagick.org/api/MagickCore/feature_8c.html" id="Use_HoughLineImage">Use HoughLineImage</a></h2> 140 141 <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> 142 143 <p>The format of the HoughLineImage method is:</p> 144 145 <pre class="text"> 146 Image *HoughLineImage(const Image *image,const size_t width, 147 const size_t height,const size_t threshold,ExceptionInfo *exception) 148 </pre> 149 150 <p>A description of each parameter follows:</p> 151 152 <dd> 153 </dd> 154 155 <dd> </dd> 156 <dl class="dl-horizontal"> 157 <dt>image</dt> 158 <dd>the image. </dd> 159 160 <dd> </dd> 161 <dt>width, height</dt> 162 <dd>find line pairs as local maxima in this neighborhood. </dd> 163 164 <dd> </dd> 165 <dt>threshold</dt> 166 <dd>the line count threshold. </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="http://nextgen.imagemagick.org/api/MagickCore/feature_8c.html" id="MeanShiftImage">MeanShiftImage</a></h2> 175 176 <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> 177 178 <p>The format of the MeanShiftImage method is:</p> 179 180 <pre class="text"> 181 Image *MeanShiftImage(const Image *image,const size_t width, 182 const size_t height,const double color_distance, 183 ExceptionInfo *exception) 184 </pre> 185 186 <p>A description of each parameter follows:</p> 187 188 <dd> 189 </dd> 190 191 <dd> </dd> 192 <dl class="dl-horizontal"> 193 <dt>image</dt> 194 <dd>the image. </dd> 195 196 <dd> </dd> 197 <dt>width, height</dt> 198 <dd>find pixels in this neighborhood. </dd> 199 200 <dd> </dd> 201 <dt>color_distance</dt> 202 <dd>the color distance. </dd> 203 204 <dd> </dd> 205 <dt>exception</dt> 206 <dd>return any errors or warnings in this structure. </dd> 207 208 <dd> </dd> 209 </dl> 210 </div> 211 <footer class="magick-footer"> 212 <p><a href="../script/support.php">Donate</a> 213 <a href="../script/sitemap.php">Sitemap</a> 214 <a href="../script/links.php">Related</a> 215 <a href="../script/architecture.php">Architecture</a> 216 </p> 217 <p><a href="feature.php#">Back to top</a> 218 <a href="http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> 219 <a href="../script/contact.php">Contact Us</a></p> 220 <p><small> 1999-2016 ImageMagick Studio LLC</small></p> 221 </footer> 222 </div><!-- /.container --> 223 224 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 225 <script src="http://nextgen.imagemagick.org/js/magick.php"></script> 226 </div> 227 </body> 228 </html> 229