head	1.2;
access
	monica
	thoth;
symbols;
locks; strict;
comment	@// @;


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

1.1
date	94.02.18.18.48.36;	author thoth;	state Exp;
branches;
next	;


desc
@program to quantize the egyptian_dude picture.
@


1.2
log
@int main & exit(0)
@
text
@// Emacs: -*- C++ -*-
static char test110_rcsid[] = "$Id: test110.c,v 1.1 1994/02/18 18:48:36 thoth Exp monica $";

//
// primitive quantization based on thresholding.
// written for the egyptian_dude picture.
//

//
// $Log: test110.c,v $
//Revision 1.1  1994/02/18  18:48:36  thoth
//Initial revision
//

#include "IntDI.h"
#include "OtherI.h"
#include "FloatDI.h"
#include "ImageIter.h"

typedef IA_IntDiscreteImage	IntDI;

class HistImage: public IA_OtherI<IA_IntPoint,int> {
    IntDI	hist;
  public:
    HistImage(IntDI hist_)
    :IA_OtherI<IA_IntPoint,int>(IA_IntPointSet(concat(0, hist_.domain().inf()),
				    concat(255, hist_.domain().sup()))),
    hist(hist_) {
	domain().output(cout);
    }
    int operator()(const IA_IntPoint &p) const {
	return p[0]+hist(cdr(p)) > 255;
    }
    IA_OtherI<IA_IntPoint,int> *clone_self() const { return new HistImage(*this); }
};

int main()
{
  IntDI	im(IntDI::read_PGM(cin));

  IA_IVIter<IA_IntPoint,int>	iter(im);

  int	*const vals = new int[im.card()];
  int	v;
  {
      for (int *scan = vals; iter(v); scan++) {
	  if (v<0x60)
	      *scan = 0;
	  else if (v<215)
	      *scan = 176;
	  else
	      *scan = 255;
      }
  }

  IntDI(im.domain(), vals, im.card(), 1).write_PGM(cout);

  exit(0);
}
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
static char test110_rcsid[] = "$Id: test105.c,v 1.1 93/03/10 13:57:00 thoth Exp $";
d10 4
a13 1
// $Log:	test105.c,v $
d57 2
@
