File: avg.cpp

package info (click to toggle)
vips 8.18.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 53,240 kB
  • sloc: ansic: 172,611; cpp: 12,257; python: 5,077; sh: 773; perl: 40; makefile: 25; javascript: 6
file content (31 lines) | stat: -rw-r--r-- 441 bytes parent folder | download | duplicates (2)
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
/*
 * compile with:
 *
 *      g++ -g -Wall avg.cpp `pkg-config vips-cpp --cflags --libs`
 *
 */

#define DEBUG

#include <vips/vips8>

using namespace vips;

int
main(int argc, char **argv)
{
	if (vips_init(argv[0]))
		vips_error_exit(NULL);

	VImage in = VImage::new_from_file(argv[1],
		VImage::option()->set("access", VIPS_ACCESS_SEQUENTIAL));
	double avg;

	avg = in.avg();

	printf("avg = %g\n", avg);

	vips_shutdown();

	return 0;
}