head	1.3;
access
	monica
	thoth;
symbols;
locks
	monica:1.3; strict;
comment	@// @;


1.3
date	94.08.24.00.30.59;	author monica;	state Exp;
branches;
next	1.2;

1.2
date	94.08.24.00.02.50;	author monica;	state Exp;
branches;
next	1.1;

1.1
date	94.08.23.20.18.35;	author monica;	state Exp;
branches;
next	;


desc
@@


1.3
log
@int main & exit(0)
@
text
@// Emacs: -*- C++ -*-
// $Id: test025.c,v 1.2 1994/08/24 00:02:50 monica Exp monica $ $Log: test025.c,v $
//Revision 1.2  1994/08/24  00:02:50  monica
//added int main & return 0;
//
//Revision 1.1  1994/08/23  20:18:35  monica
//Initial revision
//
// image_example.03.c
// Image histogram

#include "test.h"

typedef  IA_IVIter<IA_Point<int>, u_char>  IA_UcharIVIter;


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

//    inImage = IA_Image<IA_Point<int>,u_char>::read_PGM(cin);

    inImage = read_uchar_PGM("/cis/research/iac++/depot/src/test_image/RCS/sr71.pgm");

    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_UcharIVIter 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 (u_char i=imageMin; i <= imageMax; i++) {
	cout << (int) i
	     << "\t"
	     << histogram[i]
	     << "\n";
    }
    exit(0);
}







@


1.2
log
@added int main & return 0;
@
text
@d2 4
a5 1
// $Id: test025.c,v 1.1 1994/08/23 20:18:35 monica Exp monica $ $Log: test025.c,v $
d53 1
a53 1
    return 0;
d55 7
@


1.1
log
@Initial revision
@
text
@d2 4
a5 1
// $Id$ $Log$
d14 1
a14 1
main() {
d50 1
@
