/usr/share/gtk-doc/html/libvips/libvips-convolution.html is in libvips-doc 8.2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>convolution: VIPS Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="VIPS Reference Manual">
<link rel="up" href="ch03.html" title="VIPS operation API by section">
<link rel="prev" href="libvips-conversion.html" title="conversion">
<link rel="next" href="libvips-VipsForeignSave.html" title="VipsForeignSave">
<meta name="generator" content="GTK-Doc V1.24 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#libvips-convolution.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch03.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libvips-conversion.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="libvips-VipsForeignSave.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="libvips-convolution"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libvips-convolution.top_of_page"></a>convolution</span></h2>
<p>convolution — convolve and correlate images</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libvips-convolution.stability-level"></a><h2>Stability Level</h2>
<acronym title="The intention of a Stable interface is to enable arbitrary third parties to
develop applications to these interfaces, release them, and have confidence that
they will run on all minor releases of the product (after the one in which the
interface was introduced, and within the same major release). Even at a major
release, incompatible changes are expected to be rare, and to have strong
justifications.
"><span class="acronym">Stable</span></acronym>, unless otherwise indicated
</div>
<div class="refsect1">
<a name="libvips-convolution.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="libvips-convolution.html#vips-conv" title="vips_conv ()">vips_conv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="libvips-convolution.html#vips-compass" title="vips_compass ()">vips_compass</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="libvips-convolution.html#vips-convsep" title="vips_convsep ()">vips_convsep</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="libvips-convolution.html#vips-sharpen" title="vips_sharpen ()">vips_sharpen</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="libvips-convolution.html#vips-gaussblur" title="vips_gaussblur ()">vips_gaussblur</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="libvips-convolution.html#vips-spcor" title="vips_spcor ()">vips_spcor</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="libvips-convolution.html#vips-fastcor" title="vips_fastcor ()">vips_fastcor</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libvips-convolution.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="libvips-convolution.html#VipsCombine" title="enum VipsCombine">VipsCombine</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="libvips-convolution.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include <vips/vips.h>
</pre>
</div>
<div class="refsect1">
<a name="libvips-convolution.description"></a><h2>Description</h2>
<p>These operations convolve an image in some way, or are operations based on
simple convolution, or are useful with convolution.</p>
</div>
<div class="refsect1">
<a name="libvips-convolution.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="vips-conv"></a><h3>vips_conv ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_conv (<em class="parameter"><code><span class="type">VipsImage</span> *in</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> **out</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> *mask</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Optional arguments:</p>
<p><em class="parameter"><code>precision</code></em>
: calculation accuracy
<em class="parameter"><code>layers</code></em>
: number of layers for approximation
<em class="parameter"><code>cluster</code></em>
: cluster lines closer than this distance</p>
<p>Convolution. </p>
<p>Perform a convolution of <em class="parameter"><code>in</code></em>
with <em class="parameter"><code>mask</code></em>
.
Each output pixel is
calculated as sigma[i]{pixel[i] * mask[i]} / scale + offset, where scale
and offset are part of <em class="parameter"><code>mask</code></em>
. </p>
<p>If <em class="parameter"><code>precision</code></em>
is <a class="link" href="libvips-basic.html#VIPS-PRECISION-INTEGER:CAPS"><span class="type">VIPS_PRECISION_INTEGER</span></a> then the convolution is performed
with integer arithmetic and the output image
always has the same <a class="link" href="libvips-VipsImage.html#VipsBandFormat" title="enum VipsBandFormat"><span class="type">VipsBandFormat</span></a> as the input image. </p>
<p>Convolutions on unsigned 8-bit images are calculated with the
processor's vector unit, if possible. Disable this with --vips-novector or
IM_NOVECTOR.</p>
<p>If <em class="parameter"><code>precision</code></em>
is <a class="link" href="libvips-basic.html#VIPS-PRECISION-FLOAT:CAPS"><span class="type">VIPS_PRECISION_FLOAT</span></a> then the convolution is performed
with floating-point arithmetic. The output image
is always <a class="link" href="libvips-VipsImage.html#VIPS-FORMAT-FLOAT:CAPS"><code class="literal">VIPS_FORMAT_FLOAT</code></a> unless <em class="parameter"><code>in</code></em>
is <a class="link" href="libvips-VipsImage.html#VIPS-FORMAT-DOUBLE:CAPS"><code class="literal">VIPS_FORMAT_DOUBLE</code></a>, in which case
<em class="parameter"><code>out</code></em>
is also <a class="link" href="libvips-VipsImage.html#VIPS-FORMAT-DOUBLE:CAPS"><code class="literal">VIPS_FORMAT_DOUBLE</code></a>. </p>
<p>If <em class="parameter"><code>precision</code></em>
is <a class="link" href="libvips-basic.html#VIPS-PRECISION-APPROXIMATE:CAPS"><span class="type">VIPS_PRECISION_APPROXIMATE</span></a> then the output image
always has the same <a class="link" href="libvips-VipsImage.html#VipsBandFormat" title="enum VipsBandFormat"><span class="type">VipsBandFormat</span></a> as the input image. </p>
<p>Larger values for <em class="parameter"><code>layers</code></em>
give more accurate
results, but are slower. As <em class="parameter"><code>layers</code></em>
approaches the mask radius, the
accuracy will become close to exact convolution and the speed will drop to
match. For many large masks, such as Gaussian, <em class="parameter"><code>n_layers</code></em>
need be only 10% of
this value and accuracy will still be good.</p>
<p>Smaller values of <em class="parameter"><code>cluster</code></em>
will give more accurate results, but be slower
and use more memory. 10% of the mask radius is a good rule of thumb.</p>
<div class="refsect3">
<a name="id-1.4.5.8.2.14"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>in</p></td>
<td class="parameter_description"><p>input image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out</p></td>
<td class="parameter_description"><p>output image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mask</p></td>
<td class="parameter_description"><p>convolve with this mask</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p><code class="literal">NULL</code>-terminated list of optional named arguments</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.5.8.2.15"></a><h4>Returns</h4>
<p> 0 on success, -1 on error</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-compass"></a><h3>vips_compass ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_compass (<em class="parameter"><code><span class="type">VipsImage</span> *in</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> **out</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> *mask</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="vips-convsep"></a><h3>vips_convsep ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_convsep (<em class="parameter"><code><span class="type">VipsImage</span> *in</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> **out</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> *mask</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Optional arguments:</p>
<p><em class="parameter"><code>precision</code></em>
: calculation accuracy
<em class="parameter"><code>layers</code></em>
: number of layers for approximation
<em class="parameter"><code>cluster</code></em>
: cluster lines closer than this distance</p>
<p>Perform a separable convolution of <em class="parameter"><code>in</code></em>
with <em class="parameter"><code>mask</code></em>
.
See <a class="link" href="libvips-convolution.html#vips-conv" title="vips_conv ()"><code class="function">vips_conv()</code></a> for a detailed description.</p>
<p>The mask must be 1xn or nx1 elements. </p>
<p>The image is convolved twice: once with <em class="parameter"><code>mask</code></em>
and then again with <em class="parameter"><code>mask</code></em>
rotated by 90 degrees. This is much faster for certain types of mask
(gaussian blur, for example) than doing a full 2D convolution.</p>
<p>See also: <a class="link" href="libvips-convolution.html#vips-conv" title="vips_conv ()"><code class="function">vips_conv()</code></a>, <a class="link" href="libvips-create.html#vips-gaussmat" title="vips_gaussmat ()"><code class="function">vips_gaussmat()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.5.8.4.10"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>in</p></td>
<td class="parameter_description"><p>input image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out</p></td>
<td class="parameter_description"><p>output image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>mask</p></td>
<td class="parameter_description"><p>convolution mask</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p><code class="literal">NULL</code>-terminated list of optional named arguments</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.5.8.4.11"></a><h4>Returns</h4>
<p> 0 on success, -1 on error</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-sharpen"></a><h3>vips_sharpen ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_sharpen (<em class="parameter"><code><span class="type">VipsImage</span> *in</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> **out</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Optional arguments:</p>
<p><em class="parameter"><code>radius</code></em>
: how large a mask to use
<em class="parameter"><code>x1</code></em>
: flat/jaggy threshold
<em class="parameter"><code>y2</code></em>
: maximum amount of brightening
<em class="parameter"><code>y3</code></em>
: maximum amount of darkening
<em class="parameter"><code>m1</code></em>
: slope for flat areas
<em class="parameter"><code>m2</code></em>
: slope for jaggy areas</p>
<p>Selectively sharpen the L channel of a LAB image. The input image is
transformed to <a class="link" href="libvips-VipsImage.html#VIPS-INTERPRETATION-LABS:CAPS"><span class="type">VIPS_INTERPRETATION_LABS</span></a>. </p>
<p>The operation performs a gaussian blur of radius <em class="parameter"><code>radius</code></em>
and subtracts
from <em class="parameter"><code>in</code></em>
to generate a high-frequency signal. This signal is passed
through a lookup table formed from the five parameters and added back to
<em class="parameter"><code>in</code></em>
.</p>
<p>The lookup table is formed like this:</p>
<div class="informalexample"><pre class="programlisting">
^
y2 |- - - - - -----------
| /
| / slope m2
| .../
-x1 | ... |
-------------------...---------------------->
| ... | x1
|... slope m1
/ |
/ m2 |
/ |
/ |
/ |
/ |
______/ _ _ _ _ _ _ | -y3
|
</pre></div>
<p></p>
<p>For printing, we recommend the following settings (the defaults):</p>
<div class="informalexample"><pre class="programlisting">
radius == 3
x1 == 1.5
y2 == 20 (don't brighten by more than 20 L*)
y3 == 50 (can darken by up to 50 L*)
m1 == 1 (some sharpening in flat areas)
m2 == 2 (more sharpening in jaggy areas)
</pre></div>
<p></p>
<p>If you want more or less sharpening, we suggest you just change the m1
and m2 parameters. </p>
<p>The <em class="parameter"><code>radius</code></em>
parameter changes the width of the fringe and can be
adjusted according to the output printing resolution. As an approximate
guideline, use 1 for 4 pixels/mm (CRT display resolution), 2 for 8
pixels/mm, 3 for 12 pixels/mm and 4 for 16 pixels/mm (300 dpi == 12
pixels/mm). These figures refer to the image raster, not the half-tone
resolution.</p>
<p>See also: <a class="link" href="libvips-convolution.html#vips-conv" title="vips_conv ()"><code class="function">vips_conv()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.5.8.5.17"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>in</p></td>
<td class="parameter_description"><p>input image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out</p></td>
<td class="parameter_description"><p>output image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p><code class="literal">NULL</code>-terminated list of optional named arguments</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.5.8.5.18"></a><h4>Returns</h4>
<p> 0 on success, -1 on error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-gaussblur"></a><h3>vips_gaussblur ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_gaussblur (<em class="parameter"><code><span class="type">VipsImage</span> *in</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> **out</code></em>,
<em class="parameter"><code><span class="type">double</span> sigma</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Optional arguments:</p>
<p><em class="parameter"><code>precision</code></em>
: <a class="link" href="libvips-basic.html#VipsPrecision" title="enum VipsPrecision"><span class="type">VipsPrecision</span></a> for blur, default VIPS_PRECISION_INTEGER
<em class="parameter"><code>min_ampl</code></em>
: minimum amplitude, default 0.2</p>
<p>This operator runs <a class="link" href="libvips-create.html#vips-gaussmat" title="vips_gaussmat ()"><code class="function">vips_gaussmat()</code></a> and <a class="link" href="libvips-convolution.html#vips-convsep" title="vips_convsep ()"><code class="function">vips_convsep()</code></a> for you on an image.
Set <em class="parameter"><code>min_ampl</code></em>
smaller to generate a larger, more accurate mask. Set <em class="parameter"><code>sigma</code></em>
larger to make the blur more blurry. </p>
<p>See also: <a class="link" href="libvips-create.html#vips-gaussmat" title="vips_gaussmat ()"><code class="function">vips_gaussmat()</code></a>, <a class="link" href="libvips-convolution.html#vips-convsep" title="vips_convsep ()"><code class="function">vips_convsep()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.5.8.6.8"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>in</p></td>
<td class="parameter_description"><p>input image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out</p></td>
<td class="parameter_description"><p>output image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>sigma</p></td>
<td class="parameter_description"><p>how large a mask to use</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p><code class="literal">NULL</code>-terminated list of optional named arguments</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.5.8.6.9"></a><h4>Returns</h4>
<p> 0 on success, -1 on error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-spcor"></a><h3>vips_spcor ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_spcor (<em class="parameter"><code><span class="type">VipsImage</span> *in</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> *ref</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> **out</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Calculate a correlation surface.</p>
<p><em class="parameter"><code>ref</code></em>
is placed at every position in <em class="parameter"><code>in</code></em>
and the correlation coefficient
calculated. The output
image is always float.</p>
<p>The output
image is the same size as the input. Extra input edge pixels are made by
copying the existing edges outwards. </p>
<p>The correlation coefficient is calculated as:</p>
<div class="informalexample"><pre class="programlisting">
sumij (ref(i,j)-mean(ref))(inkl(i,j)-mean(inkl))
c(k,l) = ------------------------------------------------
sqrt(sumij (ref(i,j)-mean(ref))^2) *
sqrt(sumij (inkl(i,j)-mean(inkl))^2)
</pre></div>
<p></p>
<p>where inkl is the area of <em class="parameter"><code>in</code></em>
centred at position (k,l).</p>
<p>from Niblack "An Introduction to Digital Image Processing",
Prentice/Hall, pp 138.</p>
<p>If the number of bands differs, one of the images
must have one band. In this case, an n-band image is formed from the
one-band image by joining n copies of the one-band image together, and then
the two n-band images are operated upon.</p>
<p>The output image is always float, unless either of the two inputs is
double, in which case the output is also double.</p>
<p>See also: <a class="link" href="libvips-convolution.html#vips-fastcor" title="vips_fastcor ()"><code class="function">vips_fastcor()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.5.8.7.15"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>in</p></td>
<td class="parameter_description"><p>input image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>ref</p></td>
<td class="parameter_description"><p>reference image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out</p></td>
<td class="parameter_description"><p>output image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p><code class="literal">NULL</code>-terminated list of optional named arguments</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.5.8.7.16"></a><h4>Returns</h4>
<p> 0 on success, -1 on error</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-fastcor"></a><h3>vips_fastcor ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_fastcor (<em class="parameter"><code><span class="type">VipsImage</span> *in</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> *ref</code></em>,
<em class="parameter"><code><span class="type">VipsImage</span> **out</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>Calculate a fast correlation surface.</p>
<p><em class="parameter"><code>ref</code></em>
is placed at every position in <em class="parameter"><code>in</code></em>
and the sum of squares of
differences calculated. </p>
<p>The output
image is the same size as the input. Extra input edge pixels are made by
copying the existing edges outwards. </p>
<p>If the number of bands differs, one of the images
must have one band. In this case, an n-band image is formed from the
one-band image by joining n copies of the one-band image together, and then
the two n-band images are operated upon.</p>
<p>The output type is uint if both inputs are integer, float if both are float
or complex, and double if either is double or double complex.
In other words, the output type is just large enough to hold the whole
range of possible values.</p>
<p>See also: <a class="link" href="libvips-convolution.html#vips-spcor" title="vips_spcor ()"><code class="function">vips_spcor()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.5.8.8.10"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>in</p></td>
<td class="parameter_description"><p>input image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>ref</p></td>
<td class="parameter_description"><p>reference image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>out</p></td>
<td class="parameter_description"><p>output image</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p><code class="literal">NULL</code>-terminated list of optional named arguments</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.5.8.8.11"></a><h4>Returns</h4>
<p> 0 on success, -1 on error</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="libvips-convolution.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="VipsCombine"></a><h3>enum VipsCombine</h3>
<p>How to combine values.</p>
<div class="refsect3">
<a name="id-1.4.5.9.2.4"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="VIPS-COMBINE-MAX:CAPS"></a>VIPS_COMBINE_MAX</p></td>
<td class="enum_member_description">
<p>take the maximum of the possible values</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="VIPS-COMBINE-SUM:CAPS"></a>VIPS_COMBINE_SUM</p></td>
<td class="enum_member_description">
<p>sum all the values</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="VIPS-COMBINE-LAST:CAPS"></a>VIPS_COMBINE_LAST</p></td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.24</div>
</body>
</html>
|