Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
imgcond.c
Package: gsnake.rar [view]
Upload User: shhuayu888
Upload Date: 2013-03-28
Package Size: 1788k
Code Size: 4k
Category:
Windows Develop
Development Platform:
Unix_Linux
- /****************************************************************************
- File Name : imgcond.c
- Purpose : histogram conditioning
- Date : Aug 31,1995
- GSNAKE API is jointly developed by the Information Technology Institute (ITI), Singapore, and the School of Applied Science, Nanyang Technological
- University (NTU), Singapore.
- These software programs are available to the user without any license or royalty fees. Permission is hereby granted to use, copy, modify, and distribute this software and its documentation for any purpose. ITI and NTU gives no warranty, express, implied, or statuary for the software and/or documentation provided, including, without limitation, waranty of merchantibility and warranty of fitness for a particular purpose. The software provided hereunder is on an "as is" basis, and ITI and NTU has no obligation to provide maintenance, support, updates, enhancements, or modifications.
- GSNAKE API is available for any UNIX compatible system. User feedback, bugs, or software and manual suggestions should be sent via electronic mail to one of the following, who may or may not act on them as he/she desires :
- asschan@ntu.ac.sg
- kflai@iti.gov.sg
- ***************************************************************************/
- #include "xwindow.h"
- #include "gsnake.h"
- void printhelp();
- void getparam(int, char** ,char **,int *, int *,float*, float*,float*, float*, float*);
- main(int argc, char *argv[])
- {
- IMAGE myimage; /* image object */
- int magnify = 1; /* magnification factor */
- int filetype = _ras; /* image file format */
- float low_p = 0; /* low percentage */
- float high_p = 1; /* high percentage */
- float low_v = 0; /* low intensity value */
- float high_v = 1; /* high intensity value */
- float epow = 1; /* exponential power */
- char *filename = NULL; /* output file name */
- char Title[30] = "imgcond : ";
- short register i, j;
- if ( argc==1 ) printhelp();
- else {
- xwin_setTitle(strcat(Title,argv[1]));
- getparam( argc, argv, &filename, &filetype, &magnify,
- &low_p, &high_p, &low_v,&high_v, &epow);
- if (!(myimage.read(argv[1]))) {
- printf("Histogram Specification parameters :n");
- printf("ntLow Percent:%ftHigh Percent:%f",low_p,high_p);
- printf("ntLow Value :%ftHigh Value :%f",low_v,high_v);
- printf("ntExponent :%ftMagnification:%d",epow,magnify);
- myimage.show( magnify, 2 );
- myimage.condition( low_p, high_p, low_v, high_v, epow );
- myimage.show( magnify, 1, myimage.getCol()*magnify );
- printf("Press enter to continuen");
- getchar();
- if (filename)
- if ( myimage.write(filename,filetype) )
- printf("nnUnable to write file %sn", filename);
- }
- xwin_close();
- return NOERROR;
- }
- }
- void getparam( int ac, char** av,
- char **fname, /* output file name */
- int *ftype, /* output file type */
- int *Mfactor, /* magnification factor */
- float* lp, /* low percentage */
- float *hp, /* high percentage */
- float *lv, /* low intensity */
- float*hv, /* high intensity */
- float *e_pow ) /* exponential power */
- {
- register int i;
- char *inputstr;
- for (i=2; i<ac; i++) {
- if (*(av[i]) != '-') continue;
- inputstr = av[i]+2;
- switch( *(av[i]+1) ) {
- case 'O':
- if (*(av[i]+2) =='/')
- {
- *ftype =_ras;
- inputstr = av[i]+3;
- }
- else *ftype =_bin;
- *fname = inputstr;
- break;
- case 'M' :
- *Mfactor=atoi(inputstr);
- break;
- case 'P' :
- inputstr=av[i]+3;
- switch (*(av[i]+2)) {
- case 'l': *lp=atof(inputstr); break;
- case 'h': *hp=atof(inputstr);break;
- }
- break;
- case 'V' :
- inputstr = av[i]+3;
- switch( *(av[i]+2) ) {
- case 'l' : *lv = atof(inputstr);break;
- case 'h' : *hv = atof(inputstr);break;
- }
- break;
- case 'E' :
- *e_pow=atof(inputstr);
- break;
- default: break;
- }
- }
- }
- void printhelp()
- {
- printf("nn Histogram conditioning of image");
- printf("n Usage :imgcond <image> -[option]<value>");
- printf("n [ option ]");
- printf("n O : Output filename,");
- printf("n / : Save file as sun rasterfile type");
- printf("n M : Magnification factor, default 1 ");
- printf("n Pl,Ph: Low and High Percentage values ");
- printf("n : Default Pl = 0 , Ph = 1");
- printf("n Vl,Vh: Low and High Pixel values ");
- printf("n : Default Vl = 0 , Vh = 1n");
- printf("n Using imgcond with defaults is equivalent to histogram equalisation.nn") ;
- }