/usr/share/gtk-doc/html/libvips/libvips-convolution.html is in libvips-doc 7.26.3-1build1.
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 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 | <!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</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="VIPS Reference Manual">
<link rel="up" href="ch02.html" title="VIPS operation API by section">
<link rel="prev" href="libvips-conversion.html" title="conversion">
<link rel="next" href="VipsFormat.html" title="VipsFormat">
<meta name="generator" content="GTK-Doc V1.17 (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="2">
<tr valign="middle">
<td><a accesskey="p" href="libvips-conversion.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">VIPS Reference Manual</th>
<td><a accesskey="n" href="VipsFormat.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libvips-convolution.synopsis" class="shortcut">Top</a>
|
<a href="#libvips-convolution.description" class="shortcut">Description</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 valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="libvips-convolution.stability-level"></a><h2>Stability Level</h2>
Stable, unless otherwise indicated
</div>
<div class="refsynopsisdiv">
<a name="libvips-convolution.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include <vips/vips.h>
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-aconvsep" title="im_aconvsep ()">im_aconvsep</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#DOUBLEMASK:CAPS" title="DOUBLEMASK"><span class="type">DOUBLEMASK</span></a> *mask</code></em>,
<em class="parameter"><code><span class="type">int</span> n_layers</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-aconv" title="im_aconv ()">im_aconv</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#DOUBLEMASK:CAPS" title="DOUBLEMASK"><span class="type">DOUBLEMASK</span></a> *mask</code></em>,
<em class="parameter"><code><span class="type">int</span> n_layers</code></em>,
<em class="parameter"><code><span class="type">int</span> cluster</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()">im_conv</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-conv-f" title="im_conv_f ()">im_conv_f</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#DOUBLEMASK:CAPS" title="DOUBLEMASK"><span class="type">DOUBLEMASK</span></a> *mask</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-convsep" title="im_convsep ()">im_convsep</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-convsep-f" title="im_convsep_f ()">im_convsep_f</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#DOUBLEMASK:CAPS" title="DOUBLEMASK"><span class="type">DOUBLEMASK</span></a> *mask</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-compass" title="im_compass ()">im_compass</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-gradient" title="im_gradient ()">im_gradient</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-lindetect" title="im_lindetect ()">im_lindetect</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-sharpen" title="im_sharpen ()">im_sharpen</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><span class="type">int</span> mask_size</code></em>,
<em class="parameter"><code><span class="type">double</span> x1</code></em>,
<em class="parameter"><code><span class="type">double</span> y2</code></em>,
<em class="parameter"><code><span class="type">double</span> y3</code></em>,
<em class="parameter"><code><span class="type">double</span> m1</code></em>,
<em class="parameter"><code><span class="type">double</span> m2</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-grad-x" title="im_grad_x ()">im_grad_x</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-grad-y" title="im_grad_y ()">im_grad_y</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-fastcor" title="im_fastcor ()">im_fastcor</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *ref</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-spcor" title="im_spcor ()">im_spcor</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *ref</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-gradcor" title="im_gradcor ()">im_gradcor</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *ref</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-contrast-surface" title="im_contrast_surface ()">im_contrast_surface</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><span class="type">int</span> half_win_size</code></em>,
<em class="parameter"><code><span class="type">int</span> spacing</code></em>);
<span class="returnvalue">int</span> <a class="link" href="libvips-convolution.html#im-addgnoise" title="im_addgnoise ()">im_addgnoise</a> (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><span class="type">double</span> sigma</code></em>);
</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.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="im-aconvsep"></a><h3>im_aconvsep ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_aconvsep (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#DOUBLEMASK:CAPS" title="DOUBLEMASK"><span class="type">DOUBLEMASK</span></a> *mask</code></em>,
<em class="parameter"><code><span class="type">int</span> n_layers</code></em>);</pre>
<p>
Perform an approximate separable convolution of <em class="parameter"><code>in</code></em> with <em class="parameter"><code>mask</code></em>.
</p>
<p>
The mask must be 1xn or nx1 elements.
The output image
always has the same <span class="type">VipsBandFmt</span> as the input image.
</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.
</p>
<p>
Larger values for <em class="parameter"><code>n_layers</code></em> give more accurate
results, but are slower. As <em class="parameter"><code>n_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>
See also: <a class="link" href="libvips-convolution.html#im-convsep-f" title="im_convsep_f ()"><code class="function">im_convsep_f()</code></a>, <a class="link" href="libvips-mask.html#im-create-dmaskv" title="im_create_dmaskv ()"><code class="function">im_create_dmaskv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_layers</code></em> :</span></p></td>
<td>number of layers for approximation</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-aconv"></a><h3>im_aconv ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_aconv (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#DOUBLEMASK:CAPS" title="DOUBLEMASK"><span class="type">DOUBLEMASK</span></a> *mask</code></em>,
<em class="parameter"><code><span class="type">int</span> n_layers</code></em>,
<em class="parameter"><code><span class="type">int</span> cluster</code></em>);</pre>
<p>
Perform an approximate convolution of <em class="parameter"><code>in</code></em> with <em class="parameter"><code>mask</code></em>.
</p>
<p>
The output image
always has the same <span class="type">VipsBandFmt</span> as the input image.
</p>
<p>
Larger values for <em class="parameter"><code>n_layers</code></em> give more accurate
results, but are slower. As <em class="parameter"><code>n_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>
<p>
See also: <a class="link" href="libvips-convolution.html#im-convsep-f" title="im_convsep_f ()"><code class="function">im_convsep_f()</code></a>, <a class="link" href="libvips-mask.html#im-create-dmaskv" title="im_create_dmaskv ()"><code class="function">im_create_dmaskv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n_layers</code></em> :</span></p></td>
<td>number of layers for approximation</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cluster</code></em> :</span></p></td>
<td>cluster lines closer than this distance</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-conv"></a><h3>im_conv ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_conv (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);</pre>
<p>
Convolve <em class="parameter"><code>in</code></em> with <em class="parameter"><code>mask</code></em> using integer arithmetic. The output image
always has the same <span class="type">VipsBandFmt</span> as the input image.
</p>
<p>
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>. For integer <em class="parameter"><code>in</code></em>, the division by scale
includes round-to-nearest.
</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>
See also: <a class="link" href="libvips-convolution.html#im-conv-f" title="im_conv_f ()"><code class="function">im_conv_f()</code></a>, <a class="link" href="libvips-convolution.html#im-convsep" title="im_convsep ()"><code class="function">im_convsep()</code></a>, <a class="link" href="libvips-mask.html#im-create-imaskv" title="im_create_imaskv ()"><code class="function">im_create_imaskv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-conv-f"></a><h3>im_conv_f ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_conv_f (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#DOUBLEMASK:CAPS" title="DOUBLEMASK"><span class="type">DOUBLEMASK</span></a> *mask</code></em>);</pre>
<p>
Convolve <em class="parameter"><code>in</code></em> with <em class="parameter"><code>mask</code></em> using floating-point arithmetic. The output image
is always <code class="literal">IM_BANDFMT_FLOAT</code> unless <em class="parameter"><code>in</code></em> is <code class="literal">IM_BANDFMT_DOUBLE</code>, in which case
<em class="parameter"><code>out</code></em> is also <code class="literal">IM_BANDFMT_DOUBLE</code>.
</p>
<p>
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>
See also: <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>, <a class="link" href="libvips-convolution.html#im-convsep-f" title="im_convsep_f ()"><code class="function">im_convsep_f()</code></a>, <a class="link" href="libvips-mask.html#im-create-dmaskv" title="im_create_dmaskv ()"><code class="function">im_create_dmaskv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-convsep"></a><h3>im_convsep ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_convsep (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);</pre>
<p>
Perform a separable convolution of <em class="parameter"><code>in</code></em> with <em class="parameter"><code>mask</code></em> using integer arithmetic.
See <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a> for a detailed description.
</p>
<p>
The mask must be 1xn or nx1 elements.
The output image
always has the same <span class="type">VipsBandFmt</span> as the input image.
</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#im-convsep-f" title="im_convsep_f ()"><code class="function">im_convsep_f()</code></a>, <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>, <a class="link" href="libvips-mask.html#im-create-imaskv" title="im_create_imaskv ()"><code class="function">im_create_imaskv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-convsep-f"></a><h3>im_convsep_f ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_convsep_f (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#DOUBLEMASK:CAPS" title="DOUBLEMASK"><span class="type">DOUBLEMASK</span></a> *mask</code></em>);</pre>
<p>
Perform a separable convolution of <em class="parameter"><code>in</code></em> with <em class="parameter"><code>mask</code></em> using floating-point
arithmetic.
</p>
<p>
The mask must be 1xn or nx1 elements.
The output image
is always <code class="literal">IM_BANDFMT_FLOAT</code> unless <em class="parameter"><code>in</code></em> is <code class="literal">IM_BANDFMT_DOUBLE</code>, in which case
<em class="parameter"><code>out</code></em> is also <code class="literal">IM_BANDFMT_DOUBLE</code>.
</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>
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>
See also: <a class="link" href="libvips-convolution.html#im-convsep" title="im_convsep ()"><code class="function">im_convsep()</code></a>, <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>, <a class="link" href="libvips-mask.html#im-create-dmaskv" title="im_create_dmaskv ()"><code class="function">im_create_dmaskv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-compass"></a><h3>im_compass ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_compass (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);</pre>
<p>
<em class="parameter"><code>in</code></em> is convolved 8 times with <em class="parameter"><code>mask</code></em>, each time <em class="parameter"><code>mask</code></em> is rotated by 45
degrees. Each output pixel is the largest absolute value of the 8
convolutions.
</p>
<p>
See also: <a class="link" href="libvips-convolution.html#im-lindetect" title="im_lindetect ()"><code class="function">im_lindetect()</code></a>, <a class="link" href="libvips-convolution.html#im-gradient" title="im_gradient ()"><code class="function">im_gradient()</code></a>, <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-gradient"></a><h3>im_gradient ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_gradient (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);</pre>
<p>
<em class="parameter"><code>in</code></em> is convolved with <em class="parameter"><code>mask</code></em> and with <em class="parameter"><code>mask</code></em> after a 90 degree rotation. The
result is the sum of the absolute value of the two convolutions.
</p>
<p>
See also: <a class="link" href="libvips-convolution.html#im-lindetect" title="im_lindetect ()"><code class="function">im_lindetect()</code></a>, <a class="link" href="libvips-convolution.html#im-gradient" title="im_gradient ()"><code class="function">im_gradient()</code></a>, <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-lindetect"></a><h3>im_lindetect ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_lindetect (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><a class="link" href="libvips-mask.html#INTMASK:CAPS" title="INTMASK"><span class="type">INTMASK</span></a> *mask</code></em>);</pre>
<p>
<em class="parameter"><code>in</code></em> is convolved four times with <em class="parameter"><code>mask</code></em>, each time <em class="parameter"><code>mask</code></em> is rotated by 45
degrees. Each output pixel is the largest absolute value of the four
convolutions.
</p>
<p>
See also: <a class="link" href="libvips-convolution.html#im-compass" title="im_compass ()"><code class="function">im_compass()</code></a>, <a class="link" href="libvips-convolution.html#im-gradient" title="im_gradient ()"><code class="function">im_gradient()</code></a>, <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask</code></em> :</span></p></td>
<td>convolution mask</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-sharpen"></a><h3>im_sharpen ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_sharpen (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><span class="type">int</span> mask_size</code></em>,
<em class="parameter"><code><span class="type">double</span> x1</code></em>,
<em class="parameter"><code><span class="type">double</span> y2</code></em>,
<em class="parameter"><code><span class="type">double</span> y3</code></em>,
<em class="parameter"><code><span class="type">double</span> m1</code></em>,
<em class="parameter"><code><span class="type">double</span> m2</code></em>);</pre>
<p>
Selectively sharpen the L channel of a LAB image. Works for <code class="literal">IM_CODING_LABQ</code>
and LABS images.
</p>
<p>
The operation performs a gaussian blur of size <em class="parameter"><code>mask_size</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>
<p>
</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:
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
mask_size == 7
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>mask_size</code></em> parameter changes the width of the fringe and can be
adjusted according to the output printing resolution. As an approximate
guideline, use 3 for 4 pixels/mm (CRT display resolution), 5 for 8
pixels/mm, 7 for 12 pixels/mm and 9 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#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mask_size</code></em> :</span></p></td>
<td>how large a mask to use</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>x1</code></em> :</span></p></td>
<td>flat/jaggy threshold</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y2</code></em> :</span></p></td>
<td>maximum amount of brightening</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y3</code></em> :</span></p></td>
<td>maximum amount of darkening</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>m1</code></em> :</span></p></td>
<td>slope for flat areas</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>m2</code></em> :</span></p></td>
<td>slope for jaggy areas</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-grad-x"></a><h3>im_grad_x ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_grad_x (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
<p>
Find horizontal differences between adjacent pixels.
</p>
<p>
Generates an image where the value of each pixel is the difference between
it and the pixel to its right. The output has the same height as the input
and one pixel less width. One-band integer formats only. The result is
always <code class="literal">IM_BANDFMT_INT</code>.
</p>
<p>
This operation is much faster than (though equivalent to) <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a> with the
mask [[-1, 1]].
</p>
<p>
See also: <a class="link" href="libvips-convolution.html#im-grad-y" title="im_grad_y ()"><code class="function">im_grad_y()</code></a>, <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-grad-y"></a><h3>im_grad_y ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_grad_y (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>);</pre>
<p>
Find vertical differences between adjacent pixels.
</p>
<p>
Generates an image where the value of each pixel is the difference between
it and the pixel below it. The output has the same width as the input
and one pixel less height. One-band integer formats only. The result is
always <code class="literal">IM_BANDFMT_INT</code>.
</p>
<p>
This operation is much faster than (though equivalent to) <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a> with the
mask [[-1], [1]].
</p>
<p>
See also: <a class="link" href="libvips-convolution.html#im-grad-x" title="im_grad_x ()"><code class="function">im_grad_x()</code></a>, <a class="link" href="libvips-convolution.html#im-conv" title="im_conv ()"><code class="function">im_conv()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-fastcor"></a><h3>im_fastcor ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_fastcor (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *ref</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</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. One-band, 8-bit unsigned images only. The output
image is always <code class="literal">IM_BANDFMT_UINT</code>. <em class="parameter"><code>ref</code></em> must be smaller than or equal to
<em class="parameter"><code>in</code></em>. The output
image is the same size as the input.
</p>
<p>
See also: <a class="link" href="libvips-convolution.html#im-spcor" title="im_spcor ()"><code class="function">im_spcor()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ref</code></em> :</span></p></td>
<td>reference image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-spcor"></a><h3>im_spcor ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_spcor (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *ref</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</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. One-band, 8 or 16-bit images only. <em class="parameter"><code>in</code></em> and <em class="parameter"><code>ref</code></em> must have the
same <span class="type">VipsBandFmt</span>. The output
image is always <code class="literal">IM_BANDFMT_FLOAT</code>. <em class="parameter"><code>ref</code></em> must be smaller than or equal to
<em class="parameter"><code>in</code></em>. The output
image is the same size as the input.
</p>
<p>
The correlation coefficient is calculated as:
</p>
<p>
</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>
See also: <a class="link" href="libvips-convolution.html#im-gradcor" title="im_gradcor ()"><code class="function">im_gradcor()</code></a>, <a class="link" href="libvips-convolution.html#im-fastcor" title="im_fastcor ()"><code class="function">im_fastcor()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ref</code></em> :</span></p></td>
<td>reference image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-gradcor"></a><h3>im_gradcor ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_gradcor (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *ref</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</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 a correlation coefficient
calculated. One-band, integer images only. <em class="parameter"><code>in</code></em> and <em class="parameter"><code>ref</code></em> must have the
same <span class="type">VipsBandFmt</span>. The output
image is always <code class="literal">IM_BANDFMT_FLOAT</code>. <em class="parameter"><code>ref</code></em> must be smaller than <em class="parameter"><code>in</code></em>. The output
image is the same size as the input.
</p>
<p>
The method takes the gradient images of the two images then takes the
dot-product correlation of the two vector images.
The vector expression of this method is my (tcv) own creation. It is
equivalent to the complex-number method of:
</p>
<p>
ARGYRIOU, V. et al. 2003. Estimation of sub-pixel motion using
gradient cross correlation. Electronics Letters, 39 (13).
</p>
<p>
See also: <a class="link" href="libvips-convolution.html#im-spcor" title="im_spcor ()"><code class="function">im_spcor()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ref</code></em> :</span></p></td>
<td>reference image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-contrast-surface"></a><h3>im_contrast_surface ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_contrast_surface (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><span class="type">int</span> half_win_size</code></em>,
<em class="parameter"><code><span class="type">int</span> spacing</code></em>);</pre>
<p>
Generate an image where the value of each pixel represents the
contrast within a window of half_win_size from the corresponsing
point in the input image. Sub-sample by a factor of spacing.
</p>
<p>
See also: <a class="link" href="libvips-convolution.html#im-spcor" title="im_spcor ()"><code class="function">im_spcor()</code></a>, <a class="link" href="libvips-convolution.html#im-gradcor" title="im_gradcor ()"><code class="function">im_gradcor()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>half_win_size</code></em> :</span></p></td>
<td>window radius</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>spacing</code></em> :</span></p></td>
<td>subsample output by this</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="im-addgnoise"></a><h3>im_addgnoise ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span> im_addgnoise (<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *in</code></em>,
<em class="parameter"><code><a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a> *out</code></em>,
<em class="parameter"><code><span class="type">double</span> sigma</code></em>);</pre>
<p>
Add gaussian noise with mean 0 and variance sigma to <em class="parameter"><code>in</code></em>.
The noise is generated by averaging 12 random numbers,
see page 78, PIETGEN, 1989.
</p>
<p>
See also: <a class="link" href="libvips-conversion.html#im-gaussnoise" title="im_gaussnoise ()"><code class="function">im_gaussnoise()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>in</code></em> :</span></p></td>
<td>input image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>out</code></em> :</span></p></td>
<td>output image</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>sigma</code></em> :</span></p></td>
<td>standard deviation of noise</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success, -1 on error</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.17</div>
</body>
</html>
|