head	1.6;
access;
symbols;
locks; strict;
comment	@// @;


1.6
date	94.12.01.16.00.25;	author rjj;	state Exp;
branches;
next	1.5;

1.5
date	94.10.13.20.34.37;	author rjj;	state Exp;
branches;
next	1.4;

1.4
date	94.10.11.00.27.28;	author rjj;	state Exp;
branches;
next	1.3;

1.3
date	94.09.27.19.39.38;	author rjj;	state Exp;
branches;
next	1.2;

1.2
date	94.09.02.01.47.45;	author rjj;	state Exp;
branches;
next	1.1;

1.1
date	94.09.01.00.11.08;	author rjj;	state Exp;
branches;
next	;


desc
@Placing under RCS.  This should be the source corresponding to UM 1.0
@


1.6
log
@Corrected loop index type to 'int' to avoid infinite loops.
@
text
@// image_example.03.c    Image histogram

#include "UcharDI.h"
#include "ImageIter.h"


int main() {
    IA_Image<IA_Point<int>,u_char>  inImage;

    inImage = read_uchar_PGM(cin);

    u_char  imageMin, imageMax;

    imageMin = min(inImage);
    imageMax = max(inImage);

    IA_Array<int>  histogram( imageMax - imageMin + 1 );

    for (int tmp=imageMin; tmp<=imageMax; tmp++)
	histogram[tmp] = 0;

    IA_IVIter<IA_Point<int>,u_char>
	iIter(inImage);  // Value iterator over input image

    u_char value;

    while (iIter(value)) {
	histogram[value-imageMin]++;
    }

    // Now spit out the results

    cout << "Minimum image value: " << (int) imageMin << "\n"
	 << "Maximum image value: " << (int) imageMax << "\n";

    cout << "I Val\tH Val\n";
    for (int i=imageMin; i <= imageMax; i++) {
	cout << i
	     << "\t"
	     << histogram[i]
	     << "\n";
    }

    return 0;
}
@


1.5
log
@Corrected spelling and style.
@
text
@d10 1
a10 1
    inImage = IA_Image<IA_Point<int>,u_char>::read_PGM(cin);
d18 1
d37 2
a38 2
    for (u_char i=imageMin; i <= imageMax; i++) {
	cout << (int) i
@


1.4
log
@Modified to use 'return 0;' rather than 'exit(0);'.
@
text
@d1 1
a1 1
// image_example.03. c    Image histogram
@


1.3
log
@Deleted duplicate comment in header.
@
text
@a2 1
#include <stdlib.h>
d43 1
a43 1
    exit( 0 );
@


1.2
log
@Modified to be iac++ v2.0 compliant.
@
text
@a0 1
// image_example.03.c
@


1.1
log
@Initial revision
@
text
@a0 2
// Emacs: -*- C++ -*-

d2 1
a2 1
// Image histogram
d4 1
a7 2
typedef  IA_IVIter<IA_IntPoint, u_char>  IA_UcharIVIter;

d9 1
a9 1
main() {
d23 2
a24 1
    IA_UcharIVIter iIter(inImage);  // Value iterator over input image
d44 2
@
