1\chapter{Image processing menus}
2\mylabel{sec:menus}
3
4\noindent
5This chapter is runs quickly through the \ct{Toolkits} menu.  See
6\cref{sec:program} if you want to understand how the menus are written
7(or want to add more of your own). Use the Toolkit Browser to find stuff.
8
9Some things are common to almost all menu items:
10
11\begin{description}
12
13\item[Tooltips]
14	If you rest your mouse pointer over an item,
15	you'll see a quick description of what the item does.
16
17\item[Grouping]
18	You can select several objects, click \ctr{Edit}\ct{Group}, and then
19	when you click the item, it will operate on all the objects in the
20	group.
21
22\item[Any type]
23	Almost all items will work on any object. You can add an image and a
24	number, for example, find the colour difference between a number and
25	an image, or transform a matrix from LAB to XYZ.
26
27\end{description}
28
29\section{Colour}
30\mylabel{sec:menu-colour}
31
32This menu groups operations on colorimetric images and patches of
33colour. A colour patch is three float numbers plus a tag saying how those
34number should be interpreted as colour (for example, as a colour in CIE LAB
35colourspace). You can drag and drop between colour patches, and into and from
36the inkwell in an image paint window. Double-left-click on a colour patch to
37open a colour select dialog.
38
39\nip{} has 9 main types of colorimetric image, see \tref{tb:colour}.
40All these types are D65 (that is, daylight) absolute colorimetric.
41When it displays an image, \nip{} uses the \ct{Type} field in the image
42header as a hint on how to transform the numbers in the image into RGB for
43the display. The current \ct{Type} is displayed at the end of the caption
44line below an image thumbnail.
45
46The \ct{Mono}, \ct{GREY16} and \ct{RGB16} types are not really calibrated
47themselves: they are usually whatever you get by loading an image from a file.
48You'll usually need an extra step, such as applying an embedded ICC profile,
49before you get accurate colour.
50
51\begin{tab2}
52\begin{center}
53\begin{tabular}{||l|l|l||}
54\hline
55Name & Format & Notes \\
56\hline
57\ct{Mono} & One band 8 bit &
58	Not calibrated \\
59\ct{sRGB} & Three band 8 bit &
60	Screen device space for the sRGB standard \\
61\ct{GREY16} & One band 16 bit &
62	Not calibrated \\
63\ct{RGB16} & Three band 16 bit &
64	Not calibrated \\
65\ct{Lab} & Three band float &
66	The 1976 version of the CIE perceptual colourspace \\
67\ct{LabQ} & Four band 8 bit &
68	Like \ct{Lab}, but represented as 10:11:11 bits \\
69\ct{LabS} & Three band 16 bit &
70	Like \ct{Lab}, but represented as 15:16:16 bits \\
71\ct{LCh} & Three band float &
72	\ct{Lab}, but with polar coordinates \\
73\ct{XYZ} & Three band float &
74	The base CIE colourspace \\
75\ct{Yxy} & Three band float &
76	Sometimes useful for colour meters \\
77\ct{UCS} & Three band float &
78	Highly uniform space from the CMC(l:c) standard \\
79\hline
80\end{tabular}
81\end{center}
82\caption{\nip{} colourspaces}
83\mylabel{tb:colour}
84\end{tab2}
85
86\begin{description}
87
88\item[\ct{New}]
89	Make a patch of colour, or pick a colour from a slice through CIELAB
90	colourspace.
91
92\item[\ct{Convert To Colour}]
93	Convert anything into a Colour object.
94
95\item[\ct{Colourspace}]
96	Change the colourspace. The stored numbers change, but the
97	visual appearance should stay the same.
98
99\item[\ct{Tag As}]
100	Change the colourspace tag (the \ct{Type} field in the image
101	header). The stored numbers stay the same, but the visual appearance
102	should change.
103
104\item[\ct{Colour Temperature}]
105	Change the colour temperature. \ct{Move Whitepoint} just adjusts the
106	ratios of X and Z using the CIE standard illuminants.
107
108	\ct{D65 to D50} and \ct{D50 to D65} transform using either a 3x3
109	matrix which is numerically minimal in XYZ space with respect to the
110	colours on a Macbeth Color Checker, or via Bradford cone space. The
111	Bradford transform omits the power term.
112
113	The final two items go from XYZ to LAB and back, but with D50
114	normalisation rather than the default D65.
115
116\item[\ct{ICC}]
117	Transform images (not patches of colour) device space to profile
118	connection space (LAB float) and back.
119
120	You need to be careful about colour temperature issues:
121	all printers work with D50, and \nip{} is all D65. Use the D65 to D50
122	interchange items in the \ct{Colour Temperature} menu to swap back and
123	forth.
124
125	All printers also work with relative colorimetry, and \nip{} is
126	generally absolute. Use \ct{Absolute to Relative} to scale an absolute
127	colorimetric image by a media white point.
128
129\item[\ct{Radiance}]
130	\nip{} can read and write images written by the Radiance family
131	of programs (usually with the suffix \ct{.hdr}), commonly used in
132	HDR photrography.
133
134	Images in this format used a packed floating point layout for their
135	pixels. Items in this menu pack and unpack pixels for you.
136
137\item[\ct{Difference}]
138	Calculate various colour difference metrics. You can mix patches of
139	colour and colour images.
140
141\item[\ct{Adjust}]
142	Change colour in a colorimetric way. \ct{Recombination}
143	multiplies each pixel in an image through a matrix. \ct{Cast}
144	displaces the neutral axis in LAB space. \ct{HSB} lets you adjust an
145	image in LCh colourspace.
146
147\item[\ct{Similar Colour}]
148	find pixels in an image with a similar colour to a patch of
149	colour.
150
151\item[\ct{Measure Colour Chart}]
152	This takes a trimmed image of a colour chart (a rectangular grid of
153	coloured squares), measures the average pixel value in the centre 50\%
154	of each square, and returns a matrix of the measured values.
155
156	Use \ct{Make Synthetic Colour Chart} to make a colour chart image from
157	a matrix of measurements.
158
159\item[\ct{Plot ab Scatter}]
160	draws a 2 dimensional histogram of the distribution of pixel colours
161	in LAB colourspace.
162
163\end{description}
164
165\section{Filter}
166\mylabel{sec:menu-filter}
167
168This menu groups operations which filter images, or which are filters in the
169photoshop sense.
170
171\begin{description}
172
173\item[\ct{Convolution}]
174	This menu has several standard convolution operations (blur, sharpen,
175	edge detect, etc.), plus the option to convolve with a custom kernel.
176
177	Two menu items are slightly more complicated. \ct{Unsharp Mask}
178	transforms to CIE LAB colour space, then sharpens just the L band
179	with a cored unsharp filter. The \ctr{Tasks}\ct{Print} menu has a
180	version of this filter tuned for typical inkjet printers.
181
182	\ct{Custom Blur} builds and applies a square or gaussian convolution
183	kernel for you based on a radius setting.
184
185\item[\ct{Rank}]
186	A preset median filter, and a custom rank filter that lets you specify
187	window size and rank.
188
189	The \ct{Image Rank} item does pixel-wise ranking of a set of images.
190
191\item[\ct{Morphology}]
192	These menu items implement basic morphological operations. Images are
193	zero for background and non-zero (usually 255) for object. Matricies
194	are shown as 0, 1 and * for background, object and don't-care.
195
196	The \ct{Threshold} item does a simple level threshold. Use the
197	\ctr{Math}\ct{Relational} menu to construct more complex image
198	binarisations. Use \ctr{Math}\ct{Boolean} to combine morphologies.
199
200	The first half of the menu lists simple erode and dilate operations, 4-
201	and 8-way connected. The second half contains several useful compound
202	filters.
203
204	See also \ctr{Histogram}\ct{Find Profile} for
205	something that can search an image for object edges. And
206	\ct{Math}\ctr{Statistics}\ct{Edges} can count the number of edges
207	across and down an image.
208
209\item[\ct{Fourier}]
210	A selection of ideal, Gaussian and Butterworth Fourier space filters.
211
212	You can make other mask shapes yourself using the \ctr{Image}\ct{Make
213	Patterns} menus, then apply them using \ctr{Math}\ct{Fourier}. You can
214	also use the image paintbox to directly paint out peaks in a
215	fourier-space image before transforming back to real space.
216
217\item[\ct{Enhance}]
218	A selection of simple image enhancement filters. \ct{Statistical
219	Difference} passes a window over an image and tries to match the
220	region statistics at each point to a target mean and deviation.
221
222\item[\ct{Spatial Correlation}]
223	Place a small image at every possible position in a big image and
224	calculate the correlation at each position. \ct{Simple Difference} is
225	the much faster unnormalised version.
226
227\item[\ct{GREYCstoration}]
228	VIPS includes a copy of the CImg library and you can use two useful
229	CImg operations from this menu: denoising and enlarging.
230
231\item[\ct{Tilt Brightness}]
232	A selection of tools for adjusting the brightness of an image across
233	it's surface. Useful for correcting lighting problems.
234
235\item[\ct{Blend}]
236	Blend two objects together using either a third object to control the
237	blend at each point, or a slider to set all points together. You can
238	blend almost anything with anything.
239
240	One useful version is to use a text image (see \ctr{Image}\ctr{Make
241	Patterns}\ct{Text}) to blend between two colours (see
242	\ctr{Colour}\ct{New}).
243
244	\ct{Along Line} does a left/right or top/bottom fade between two
245	images.
246
247\item[\ct{Overlay}]
248	Make a colour overlay of two monochrome images. Useful with
249	\ctr{Image}\ctr{Transform} for testing image superposition.
250
251\item[\ct{Colourize}]
252	Use a colour image to tint a monochrome image. Useful in conjunction
253	with \ctr{Image}\ctr{Transform}.
254
255\item[\ct{Browse}]
256	Look at either the bits or the bands of an image.
257
258\item[\ct{Photographic Negative} and friends]
259	A small selection of simple, faintly photoshop-style filters.
260
261\end{description}
262
263\section{Histogram}
264\mylabel{sec:menu-histogram}
265
266This menu groups operations for finding and transforming image histograms.
267\nip{} represents histograms and lookup tables as images with \ct{Type}
268set to \ct{Histogram}.  Histograms may have pixels in any format and any
269number of bands. You can only find histograms of unsigned 8- and 16-bit
270images.
271
272\begin{description}
273
274\item[\ct{New}]
275	This makes a new ramp histogram. A set of sliders let you adjust the
276	shape. Use \ct{Map Histogram} to apply your ramp to an image.
277
278	\ct{Build LUT from Scatter} makes a histogram from a matrix of
279	$(x, y)$ values.
280
281	\ct{Tag Image as Histogram} marks an image as actually being a
282	histogram after all.
283
284	\ct{Tone Curve} builds a tone curve which you can later apply to an
285	image.
286
287\item[\ct{Find}]
288	A one dimensional histogram treats each band as an independent
289	variable. An $n$-dimensional histogram treats each pixel as a vector of
290	$n$ elements, where $n$ is the number of bands in the image.
291
292\item[\ct{Map}]
293	Looks up each pixel in the input in the histogram and sends the found
294	value to the output.
295
296\item[\ct{Equalise}]
297	Find the global or locally histogram equalised image.
298
299\item[\ct{Cumulative}]
300	Use this and friends to calculate a cumulative histogram (integrate),
301	normalise a histogram and match two histograms.
302
303\item[\ct{Find Profile}]
304	Searches from the edges of an image for the first non-zero pixel and
305	returns a profile histogram.
306
307\item[\ct{Find Projections}]
308	Sum columns and rows in an image.
309
310\item[\ct{Plot Slice}]
311	Mark a guide on an image (drag from the
312	image rulers, or click \ctr{File}\ctr{New}\ct{Guide}) and click
313	\ct{Plot Slice} to make a histogram which is a horizontal or vertical
314	slice through an image. Use \ct{Extract Arrow} to extract the area
315	around an arrow or guide. Use \ct{Plot Object} to make a plot of any
316	object.
317
318\end{description}
319
320\section{Image}
321\mylabel{sec:menu-image}
322
323This menu groups operations which apply only to images.
324
325\begin{description}
326
327\item[\ct{New}]
328	Makes a new image. \ct{Region on Image} makes a new region, arrow,
329	guide or mark on an image. It's usually easier to open a viewer on
330	an image and Ctrl-drag.
331
332\item[\ct{Convert to Image}]
333	Try to make an image out of anything.
334
335\item[\ct{Format}]
336	Switch between the various precisions.
337
338\item[\ct{Header}]
339	Try to change or examine the image header in various ways.
340
341\item[\ct{Cache}]
342	This caches an image in RAM. Use this to save the results of a long
343	computation.
344
345\item[\ct{Levels}]
346	Various tools that change the levels in an image. \ct{Tone Curve} is
347	the only complex one: it lets you adjust the image levels with a set
348	of sliders.
349
350\item[\ct{Transform}]
351	Various tools that change the geometry of an image.
352
353	To use \ctr{Rotate}\ct{Straighten}, mark an arrow on an image
354	(Ctrl-drag up and left in an image view window) along a
355	near-horizontal or near-vertical edge. When you click on
356	\ctr{Rotate}\ct{Straighten}, \nip{} will rotate the image by the
357	smallest amount that makes that edge exactly horizontal or vertical.
358
359	\ct{Linear Match} takes two images and rotates and scales
360	the second so that the images can be superimposed. Drag the
361	tie-=points to mark common features. Use \ctr{Filter}\ct{Overlay}
362	or \ctr{Filter}\ct{Colourize} to actually superimpose them.
363
364	\ct{Rubber Sheet} is useful for fixing things like lens distortion.
365	You give \ct{Find} two images, a reference and a distorted version
366	of that reference, and it automatically finds a transform which
367	will map the distorted image back on to the reference image. Use
368	\ct{Apply} to apply the discovered transform to another image.
369
370\item[\ct{Band}]
371	Extract/insert/delete image bands. Use \ct{To Dimension} to change
372	image bands into a horizontal or vertical dimension. Use \ct{To
373	Bands} to compress the horizontal or vertical dimension into bands
374	(small images only!).
375
376\item[\ct{Crop}]
377	Crops an image. It's often easier to drag out a region. This menu item
378	is only really useful for cropping large groups of images.
379
380\item[\ct{Insert}]
381	This takes two images and pastes the smaller into the centre of the
382	larger. The two images have to have the same number of bands.
383	If you open an image viewer on the large image, you'll see an area
384	which you can drag around to set the exact insert point.
385
386\item[\ct{Select}]
387	Draw elipses and polygons on an image. Useful for selecting defined
388	areas.
389
390\item[\ct{Join}]
391	Use to join two images together bandwise, left/right or up/down.
392	\ct{Array} joins a list of lists of images together into a single
393	large image.
394
395\item[\ct{Tile}]
396	Repeat an image horizontally and vertically to make a larger image, or
397	chop an image into a set of tiles.
398
399\item[\ct{Patterns}]
400	These items all make useful images for you, from checkerboards to
401	gaussian masks. \ct{XY Image} is the most useful: you can use it to
402	build other patterns.
403
404\item[\ct{Test Images}]
405	These items make a variety of useful testcharts for evaluating
406	spatial response and colour.
407
408\end{description}
409
410\section{Math}
411\mylabel{sec:menu-math}
412
413Basic maths operations on any combination of any objects. You can add a slider
414to a matrix, for example, then divide by an image. Hopefully most of these
415are obvious.
416
417\begin{description}
418
419\item[\ctr{Arithmetic}\ct{Absolute Value Vector}]
420	The absolute value item normally calculates mod of each band of an
421	image separately. By contrast, \ct{Absolute Value Vector} treats
422	each pixel as a vector and calculates the modulus of that.
423
424\item[\ct{List}]
425	These aren't really maths operations, but they're in here too.
426
427\end{description}
428
429\section{Matrix}
430\mylabel{sec:menu-matrix}
431
432This menu groups operations which operate on matricies. \nip{} has four ways
433of displaying a matrix, but they all behave in the same way under the skin.
434Almost all the items in the \ct{Math} menu will work on matricies. Most of the
435matrix operations will also work on images.
436
437\begin{description}
438
439\item[\ct{New}]
440	The first four items make matricies which display and edit in various
441	ways useful for different applications. The final two make matricies
442	which are pre-filled with useful numbers.
443
444\item[\ct{Convert to Matrix}]
445	Try to make anything into a matrix.
446
447\item[\ct{Extract}]
448	This group of items extracts various submatricies. You can also do
449	this graphically: just drag-select an area in matrix.
450
451\item[\ct{Insert}, \ct{Delete}, \ldots]
452	Also work on images, which can be handy.
453	A 45 degree rotate will only work for square matricies with
454	odd-length sides.
455
456\item[\ct{Invert}]
457	Simple matrix-only maths operations.
458
459\item[\ct{Plot Scatter}]
460	This takes a two-column matrix where the columns are the X and Y
461	positions of points and draws a scatter graph.
462
463\end{description}
464
465\section{Object}
466\mylabel{sec:menu-object}
467
468This groups a few items which had no obvious home and which change the format
469of objects.
470
471\begin{description}
472
473\item[\ct{Duplicate}]
474	Copy an object, stripping off any derived classes. For images, this
475	really takes a copy of the underlying object (using \ct{im\_copy()}).
476
477\item[\ct{List to Group}]
478	Changes lists (see \ctr{Math}\ct{List}) into Groups (see
479	\ctr{Edit}\ct{Group}) and back. A list os an ordered collection of
480	objects. A group is a list that \nip{} will automatically iterate
481	over.
482
483\item[\ct{Break Up Object}]
484	This tries to take an object apart. So a multi-band image becomes a
485	list of 1-band images. A matrix becomes a list of vectors, and so on.
486	\ct{Assemble Object} is the inverse.
487
488\end{description}
489
490\section{Tasks}
491\mylabel{sec:menu-tasks}
492
493This menu repeats many items from other menus, but tries to group them by
494tasks they are useful for, rather than by function.
495
496\subsection{Capture}
497\mylabel{sec:menu-capture}
498
499This menu groups operations which are useful in capturing images, or for the
500initial processing you might want to do to an image captured from another
501program.
502
503\begin{description}
504
505\item[\ct{CSV Import}]
506	Import an image from a CSV file, with a few controls.
507
508\item[\ct{Interpret Analyze 7 Header}]
509	Read the meta fields for volume layout and calibration from the
510	Analyze header and reformat the image appropriately.
511
512\item[\ct{Capture Video Frame}]
513	This menu item will currently only work on Linux machines with a
514	compatible video4linux capture card. See \pref{sec:vidpref}
515	for notes on how it works.
516
517\item[\ct{Smooth}]
518	Use this to remove texture from images. It's handy in conjunction with
519	\ct{Flatfield}.
520
521\item[\ct{Flatfield}]
522	Use this to correct homogeneity. Select an image of a piece of white
523	(or mid-grey) card, then select the image to correct, then click
524	\ct{Flatfield}. Use \ct{Smooth} to renmove texture from the white card
525	if necessary.
526
527	You can select a single white and a group of images to correct a large
528	set in one step
529
530\item[\ct{White Balance}]
531	Use this to move the white point to make an area of the image you know
532	to be white, white.
533	Mark a region on an image, enclosing a patch you know to be white.
534	Select the region and the image and click on \ct{White Balance}.
535
536\item[\ct{Find Colour Calibration}]
537	Use this to colour calibrate an image. Drag a region enclosing an
538	image of a Macbeth Color Checker Chart and click \ct{Find Colour
539	Calibration}.
540
541\item[\ct{Apply Colour Calibration}]
542	Use this to apply the transform calculated by the previous item to
543	another image. Select the calibration object, select the RGB image
544	you want calibrated, and click \ct{Apply Colour Calibration}.
545
546\end{description}
547
548\subsection{Mosaic}
549\mylabel{sec:menu-mosaic}
550
551The items in this menu are discussed in appalling detail in
552\cref{sec:ir}.
553
554\begin{description}
555
556\item[\ct{One Point}]
557	Join two images left-right or top-bottom with a simple
558	translation. Mark a point on each image to be joined (open image
559	view window, Ctrl-left-click, drag to position), then click on the
560	mosaic button. The
561	operation performs elaborate tie-point adjustment, so your selection
562	of a common feature does not have to be exact.
563
564	The \ct{Manual} versions do not perform automatic tie-point correction
565	and are useful when joing very difficult images.
566
567\item[\ct{Two Point}]
568	Do a join, but allow the right-hand (or bottom) image to rotate and
569	scale if it will improve the match. You need to pick two points on
570	each image.
571
572\item[\ct{Balance}]
573	Break a mosaic apart, examine average pixel value in the overlap
574	regions, adjust brightness to match, and reassemble. This only works
575	for images which have been produced just by mosaic joins! If you've
576	done anything else to the image since loading it, the balance will
577	fail with a mysterious message.
578
579\item[\ct{Manual Balance}]
580	Adjust the brightness in a set of masked areas to match. Useful for
581	removing shadows.
582
583\item[\ct{Rebuild}]
584	Use this to mosaic up one set of files based on joins you made
585	in another.  Breaks a mosaic part to component files, performs a
586	string substitution on the file names, and reassembles.
587
588\item[\ct{Clone Area}]
589	Select over- or under-exposed pixels in one image and replace them
590	with the corresponding pixels from another image. Useful for removing
591	lead numbers used to identify X-ray plates.
592
593	The function
594	operates on two 8-bit mono images.  Move and resize the region
595	on the first image to define the area around the white number.
596	Move the region on the second to overlapping area.  A section of the
597	area on the second image is cloned and blended into the first image.
598	The amount of the defined area to be cloned in defined by a slider
599	within the output image.
600
601\end{description}
602
603\subsection{Picture Frame}
604\mylabel{sec:menu-picture-frame}
605
606Items useful for mocking up painting frames.
607
608\subsection{Print}
609\mylabel{sec:menu-print}
610
611Items useful while preparing an image for printing.
612
613\begin{description}
614
615\item[\ct{Sharpen}]
616	Sharpen an image for printing. This is a version of
617	\ctr{Filter}\ctr{Convolution}\ct{Unsharp Mask} tuned for typical
618	inkjet printers.
619
620\item[\ct{Adjust Tone Curve}]
621	Adjust the reproduction tone curve in LAB. Most useful for offset
622	work, especially from transparencies.
623
624\end{description}
625