/usr/share/doc/libvips-doc/html/vipsmanualse4.html is in libvips-doc 7.38.5-2.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title>The VMask class</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<!-- 3,html -->
<meta name="src" content="vipsmanual.tex">
<meta name="date" content="2014-02-25 16:58:00">
<link rel="stylesheet" type="text/css" href="vipsmanual.css">
</head><body
>
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
href="vipsmanualse5.html" >next</a>] [<a
href="vipsmanualse3.html" >prev</a>] [<a
href="vipsmanualse3.html#tailvipsmanualse3.html" >prev-tail</a>] [<a
href="#tailvipsmanualse4.html">tail</a>] [<a
href="vipsmanualch1.html#vipsmanualse4.html" >up</a>] </p></div>
<h3 class="sectionHead"><span class="titlemark">1.4 </span> <a
id="x9-190001.4"></a>The <span
class="pcrr7t-">VMask </span>class</h3>
<!--l. 3--><p class="noindent" >The <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VMask</span></span></span> class is an abstraction over the VIPS
<span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">DOUBLEMASK</span></span></span> and <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">INTMASK</span></span></span> types which gives convenient
and safe representation of matrices.
<!--l. 7--><p class="indent" > <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VMask</span></span></span> has two sub-classes, <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VIMask</span></span></span> and <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VDMask</span></span></span>.
These represent matrices of integers and doubles
respectively.
<!--l. 10--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">1.4.1 </span> <a
id="x9-200001.4.1"></a>Constructors</h4>
<!--l. 12--><p class="noindent" >There are four constructors for <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VIMask</span></span></span> and <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VDMask</span></span></span>:
<div class="verbatim" id="verbatim-27">
VIMask( int xsize, int ysize );
 <br />VIMask( int xsize, int ysize,
 <br />  int scale, int offset, ... );
 <br />VIMask( int xsize, int ysize,
 <br />  int scale, int offset,
 <br />  std::vector<int> coeff );
 <br />VIMask( const char ⋆name );
 <br />VIMask();
 <br />VDMask( int xsize, int ysize );
 <br />VDMask( int xsize, int ysize,
 <br />  double scale, double offset, ... );
 <br />VDMask( int xsize, int ysize,
 <br />  double scale, double offset,
 <br />  std::vector<double> coeff );
 <br />VDMask( const char ⋆name );
 <br />VDMask();
</div>
<!--l. 31--><p class="nopar" >
<!--l. 33--><p class="indent" > The first form creates an empty matrix, with the specified
dimensions; the second form initialises a matrix from
a varargs list; the third form sets the matrix from a
vector of coefficients; the fourth from the named file.
The final form makes a mask object with no contents
yet.
<!--l. 38--><p class="indent" > The varargs constructors are not wrapped in Python —
use the vector constructor instead. For example:
<div class="verbatim" id="verbatim-28">
m = VMask.VIMask (3, 3, 1, 0,
 <br />  [-1, -1, -1,
 <br />   -1,  8, -1,
 <br />   -1, -1, -1])
</div>
<!--l. 46--><p class="nopar" >
<!--l. 48--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">1.4.2 </span> <a
id="x9-210001.4.2"></a>Projection functions</h4>
<!--l. 50--><p class="noindent" >A set of member functions of <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VIMask</span></span></span> provide access to the
fields in the matrix:
<div class="verbatim" id="verbatim-29">
int xsize() const;
 <br />int ysize() const;
 <br />int scale() const;
 <br />int offset() const;
 <br />const char ⋆filename() const;
</div>
<!--l. 59--><p class="nopar" >
<!--l. 61--><p class="indent" > <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VDMask</span></span></span> is the same, except that the <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">scale()</span></span></span> and
<span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">offset()</span></span></span> members return <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">double</span></span></span>. <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VMask</span></span></span> allows all
operations that are common to <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VIMask</span></span></span> and <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VDMask</span></span></span>.
<!--l. 65--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">1.4.3 </span> <a
id="x9-220001.4.3"></a>Assignment</h4>
<!--l. 67--><p class="noindent" ><span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VMask</span></span></span> defines copy and assignment with pointer-style
semantics. You can write stuff like:
<div class="verbatim" id="verbatim-30">
VIMask fred( "mask" );
 <br />VMask jim;
 <br />
 <br />jim = fred;
</div>
<!--l. 75--><p class="nopar" >
<!--l. 77--><p class="indent" > This reads the file <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">mask</span></span></span>, noting a pointer to the
mask in <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">fred</span></span></span>. It then makes <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">jim</span></span></span> also point to it, so
<span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">jim</span></span></span> and <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">fred</span></span></span> are sharing the same underlying matrix
values.
<!--l. 81--><p class="indent" > Internally, a <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VMask</span></span></span> object is just a pointer to a
reference-counting block, which in turn holds a pointer to
the underlying VIPS <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">MASK</span></span></span> type. You can therefore
efficiently pass <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VMask</span></span></span> objects to functions by value, and
return <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VMask</span></span></span> objects as function results.
<!--l. 86--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">1.4.4 </span> <a
id="x9-230001.4.4"></a>Computing with <span
class="pcrr7t-">VMask</span></h4>
<!--l. 88--><p class="noindent" >You can use <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">[]</span></span></span> to get at matrix elements, numbered
left-to-right, top-to-bottom. Alternatively, use <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">()</span></span></span> to address
elements by <span
class="cmmi-10">x,y </span>position. For example:
<div class="verbatim" id="verbatim-31">
VIMask fred( "mask" );
 <br />
 <br />for( int i = 0; i < fred.xsize(); i++ )
 <br />    fred[i] = 12;
</div>
<!--l. 97--><p class="nopar" >
<!--l. 99--><p class="noindent" >will set the first line of the matrix to 12, and:
<div class="verbatim" id="verbatim-32">
VDMask fred( "mask" );
 <br />
 <br />for( int x = 0; x < fred.xsize(); x++ )
 <br />    fred(x, x) = 12.0;
</div>
<!--l. 107--><p class="nopar" >
<!--l. 109--><p class="noindent" >will set the leading diagonal to 12.
<!--l. 112--><p class="indent" > These don’t work well in Python, so there’s an extra
member, <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">get()</span></span></span>, which will get an element by <span
class="cmmi-10">x,y</span>
position.
<div class="verbatim" id="verbatim-33">
x = mat.get (2, 4)
</div>
<!--l. 117--><p class="nopar" >
<!--l. 119--><p class="indent" > See the member functions below for other operations on
<span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VMask</span></span></span>.
<!--l. 121--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">1.4.5 </span> <a
id="x9-240001.4.5"></a><span
class="pcrr7t-">VIMask </span>operations</h4>
<!--l. 123--><p class="noindent" >The following operations are defined for <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VIMask</span></span></span>:
<div class="verbatim" id="verbatim-34">
// Cast to VDMask and VImage
 <br />operator VDMask();
 <br />operator VImage();
 <br />
 <br />// Build gaussian and log masks
 <br />static VIMask gauss( double, double );
 <br />static VIMask gauss_sep( double, double );
 <br />static VIMask log( double, double );
 <br />
 <br />// Rotate
 <br />VIMask rotate45();
 <br />VIMask rotate90();
 <br />
 <br />// Transpose, invert, join and multiply
 <br />VDMask trn() ;
 <br />VDMask inv();
 <br />VDMask cat( VDMask );
 <br />VDMask mul( VDMask );
</div>
<!--l. 144--><p class="nopar" >
<!--l. 146--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">1.4.6 </span> <a
id="x9-250001.4.6"></a><span
class="pcrr7t-">VDMask </span>operations</h4>
<!--l. 148--><p class="noindent" >The following operations are defined for <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-">VDMask</span></span></span>:
<div class="verbatim" id="verbatim-35">
// Cast to VIMask and VImage
 <br />operator VIMask();
 <br />operator VImage();
 <br />
 <br />// Build gauss and log masks
 <br />static VDMask gauss( double, double );
 <br />static VDMask log( double, double );
 <br />
 <br />// Rotate
 <br />VDMask rotate45();
 <br />VDMask rotate90();
 <br />
 <br />// Scale to intmask
 <br />VIMask scalei();
 <br />
 <br />// Transpose, invert, join and multiply
 <br />VDMask trn();
 <br />VDMask inv();
 <br />VDMask cat( VDMask );
 <br />VDMask mul( VDMask );
</div>
<!--l. 171--><p class="nopar" >
<!--l. 173--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">1.4.7 </span> <a
id="x9-260001.4.7"></a>Output of masks</h4>
<!--l. 175--><p class="noindent" >You can output masks with the usual <span class="obeylines-h"><span class="verb"><span
class="pcrr7t-"><<</span></span></span> operator.
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
href="vipsmanualse5.html" >next</a>] [<a
href="vipsmanualse3.html" >prev</a>] [<a
href="vipsmanualse3.html#tailvipsmanualse3.html" >prev-tail</a>] [<a
href="vipsmanualse4.html" >front</a>] [<a
href="vipsmanualch1.html#vipsmanualse4.html" >up</a>] </p></div>
<!--l. 1--><p class="indent" > <a
id="tailvipsmanualse4.html"></a>
</body></html>
|