int flagDeltaThreshold;
double deltaThreshold;
+ double sigmaThreshold;
}lmrcImageBinarizationInfo;
/* struct end */
--- /dev/null
+/*
+# lmrcImageFeatureCalc.h : $Revision$
+# $Date$
+# Created by $Author$
+# Usage : lmrcImageFeatureCalc.h
+# Attention
+# $Loccker$
+# $State$
+#
+*/
+/* $Log$ */
+#ifndef LMRC_IMAGE_FEATURE_CALC
+#define LMRC_IMAGE_FEATURE_CALC
+
+#include <stdio.h>
+#include "./lmrcImageCalcArea.h"
+
+/* constant begin */
+
+
+/* constant end */
+
+/* struct begin */
+
+struct lmrcImagePerimeterCalcInfo {
+ int flagArea;
+ mrcImage* Area;
+ mrcImage* Label;
+
+ //
+ mrcImage* ChainCode;
+} lmrcImagePerimeterCalcInfo;
+
+struct lmrcImageCircularityCalcInfo {
+
+} lmrcImageCircularityCalcInfo;
+
+
+/* struct end */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* prototype begin */
+
+void lmrcImagePerimeterCalc(mrcImage* out, mrcImage* in, lmrcImagePerimeterCalcInfo* linfo, int mode);
+void lmrcImageCircularityCalc(mrcImage* out, mrcImage* in, lmrcImageCircularityCalc* linfo, int mode);
+
+
+/* prototype end */
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif /* LMRC_IMAGE_FEATURE_CALC */
}
break;
}
+ case 4:
+ case 6: {
+ if(t - linfo.sigmaThreshold <= data0 && data0 <= t + linfo.sigmaThreshold ) { /* Near */
+ flagNear = 1;
+ }
+ break;
+ }
+ case 5:
+ case 7: {
+ if(data0 < t - linfo.sigmaThreshold || t + linfo.sigmaThreshold < data0 ) { /* Near */
+ flagNear = 1;
+ }
+ break;
+ }
default: {
fprintf(stderr, "Not supported mode in lmrcImageBinarization : %d", mode);
break;
if(0<flagNear) {
break;
}
- }
+ }
}
switch(mode) {
case 0: {
}
break;
}
+ case 4: {
+ if(data < t - linfo.sigmaThreshold || t + linfo.sigmaThreshold < data){
+ if(0<linfo.flagNear && 0<flagNear) {
+ data = 1;
+ } else {
+ data = 0;
+ }
+ } else {
+ data = 1;
+ n++;
+ }
+ break;
+ }
+ case 5: {
+ if(t - linfo.sigmaThreshold <= data && data <= t + linfo.sigmaThreshold){
+ if(0<linfo.flagNear && 0<flagNear) {
+ data = 1;
+ } else {
+ data = 0;
+ }
+ } else {
+ data = 1;
+ n++;
+ }
+ break;
+ }
+ case 6: {
+ if(data < t - linfo.sigmaThreshold || t + linfo.sigmaThreshold < data){
+ if(0<linfo.flagNear && 0<flagNear) {
+ data = data;
+ } else {
+ data = v;
+ }
+ } else {
+ data = data;
+ n++;
+ }
+ break;
+ }
+ case 7: {
+ if(t - linfo.sigmaThreshold <= data && data <= t + linfo.sigmaThreshold){
+ if(0<linfo.flagNear && 0<flagNear) {
+ data = data;
+ } else {
+ data = v;
+ }
+ } else {
+ data = data;
+ n++;
+ }
+ break;
+ }
default: {
fprintf(stderr, "Not supported mode in lmrcImageBinarization : %d", mode);
break;
fprintf(fpt, " 1: Above thresHold, 0. Under thresHold, 1.\n");
fprintf(fpt, " 2: Under thresHold, value. Above thresHold, unchanged.\n");
fprintf(fpt, " 3: Above thresHold, value. Under thresHold, unchanged.\n");
- fprintf(fpt, " 16: Automatically Determine threshold by Kittler Method\n");
- fprintf(fpt, " 32: Automatically Determine threshold by Ohtsu Method\n");
- fprintf(fpt, " 48: Automatically Determine threshold by p-tile Method\n");
+ fprintf(fpt, " 4: thresHold +- sigma, 1. Others 0.\n");
+ fprintf(fpt, " 5: thresHold +- sigma, 0. Others 1.\n");
+ fprintf(fpt, " 6: thresHold +- sigma, unchanged. Others value.\n");
+ fprintf(fpt, " 7: thresHold +- sigma, value. Others unchanged.\n");
+ fprintf(fpt, " +16: Automatically Determine threshold by Kittler Method\n");
+ fprintf(fpt, " +32: Automatically Determine threshold by Ohtsu Method\n");
+ fprintf(fpt, " +48: Automatically Determine threshold by p-tile Method\n");
fprintf(fpt, " p range: 0.0 - 1.0\n");
- fprintf(fpt, " 64: Automatically Determine threshold by Differential-Histogram Method\n");
- fprintf(fpt, " 80: Automatically Determine threshold by Laplacian-Histogram Method\n");
+ fprintf(fpt, " +64: Automatically Determine threshold by Differential-Histogram Method\n");
+ fprintf(fpt, " +80: Automatically Determine threshold by Laplacian-Histogram Method\n");
}
double
int flagDeltaThreshold;
double deltaThreshold;
+ double sigmaThreshold;
}lmrcImageBinarizationInfo;
/* struct end */
#define LMRC_IMAGE_FEATURE_CALC
#include <stdio.h>
-#include "lmrcImageAreaCalc.h"
+#include "./lmrcImageCalcArea.h"
/* constant begin */
WORLDNAME=Tools
WORLDNAME=Tools
WORLDNAME=Tools
+WORLDNAME=Tools
"-O","-O[utput]","Output:Parameters","Optional","1","1","OutParam","outFile::ASCII","stdout"
"-t","-t[hreshold]","Value of threshold","Optional","1","1","t","Real","0"
"-dt","-d[elta]t[hreshold]","Difference threshold","Optional","1","1","deltaThreshold","Real","0"
+"-st","-s[igma]t[hreshold]","Sigma threshold(BandPath)","Optional","1","1","sigmaThreshold","Real","0.5"
"-v","-v[alue]","Value","Optional","1","1","v","Real","0"
"-near","-near","Near[pixel]: Near-area also binary","Optional","1","1","near","Real","0"
"-nLevel","-nLevel","nLevel: For creating histgram by Kittler and Ohtsu ","Optional","1","1","nLevel","Integer","256"
long flagdeltaThreshold;
float deltaThreshold;
+ long flagsigmaThreshold;
+ float sigmaThreshold;
+
long flagv;
float v;
}
SBREAK;
}
+ SCASE("st") {
+ if(i+1<argc) {
+ info->sigmaThreshold = stringGetNthRealData(argv[i+1], 1, " ,");
+ i++;
+ info->flagsigmaThreshold++;
+ } else {
+ usage(argv[0]);
+ exit(EXIT_FAILURE);
+ }
+ SBREAK;
+ }
SCASE("v") {
if(i+1<argc) {
info->v = stringGetNthRealData(argv[i+1], 1, " ,");
info->fptOutParam = stdout; info->flagOutParam = 0;
info->t = 0; info->flagt = 0;
info->deltaThreshold = 0; info->flagdeltaThreshold = 0;
+ info->sigmaThreshold = 0.5; info->flagsigmaThreshold = 0;
info->v = 0; info->flagv = 0;
info->near = 0; info->flagnear = 0;
info->nLevel = 256; info->flagnLevel = 0;
if(info->flagdeltaThreshold) {
}
+ if(info->flagsigmaThreshold) {
+ }
+
if(info->flagv) {
}
linfo.flagDeltaThreshold = info.flagdeltaThreshold;
linfo.deltaThreshold = info.deltaThreshold;
+ linfo.sigmaThreshold = info.sigmaThreshold;
- DEBUGPRINT1("mode: %d\n", info.mode);
+ DEBUGPRINT1("mode: %ld\n", info.mode);
threshold = lmrcImageBinarization(&out, &in, linfo, info.mode);
mrcFileWrite(&out, info.Out ,"in main" ,0);
[-O[utput] OutParam (stdout ).as(outFile::ASCII ) ] :Optional :Output:Parameters
[-t[hreshold] t (0 ).as(Real ) ] :Optional :Value of threshold
[-d[elta]t[hreshold] deltaThreshold (0 ).as(Real ) ] :Optional :Difference threshold
+ [-s[igma]t[hreshold] sigmaThreshold (0.5 ).as(Real ) ] :Optional :Sigma threshold(BandPath)
[-v[alue] v (0 ).as(Real ) ] :Optional :Value
[-near near (0 ).as(Real ) ] :Optional :Near[pixel]: Near-area also binary
[-nLevel nLevel (256 ).as(Integer ) ] :Optional :nLevel: For creating histgram by Kittler and Ohtsu
1: Above thresHold, 0. Under thresHold, 1.
2: Under thresHold, value. Above thresHold, unchanged.
3: Above thresHold, value. Under thresHold, unchanged.
- 16: Automatically Determine threshold by Kittler Method
- 32: Automatically Determine threshold by Ohtsu Method
- 48: Automatically Determine threshold by p-tile Method
+ 4: thresHold +- sigma, 1. Others 0.
+ 5: thresHold +- sigma, 0. Others 1.
+ 6: thresHold +- sigma, unchanged. Others value.
+ 7: thresHold +- sigma, value. Others unchanged.
+ +16: Automatically Determine threshold by Kittler Method
+ +32: Automatically Determine threshold by Ohtsu Method
+ +48: Automatically Determine threshold by p-tile Method
p range: 0.0 - 1.0
- 64: Automatically Determine threshold by Differential-Histogram Method
- 80: Automatically Determine threshold by Laplacian-Histogram Method
+ +64: Automatically Determine threshold by Differential-Histogram Method
+ +80: Automatically Determine threshold by Laplacian-Histogram Method
</PRE>
</BODY>
</HTML>
-O 1 0 1 0 0 1 -1x1+1+4.500000 ' ' 'OutParam' 'Output:Parameters' O
-f 1 0 1 0 0 -1x1+1+6.000000 0 0 0.000000 0 0 0 't' 'Value of threshold' t
-f 1 0 1 0 0 -1x1+1+7.500000 0 0 0.000000 0 0 0 'deltaThreshold' 'Difference threshold' dt
- -f 1 0 1 0 0 -1x1+1+9.000000 0 0 0.000000 0 0 0 'v' 'Value' v
- -f 1 0 1 0 0 -1x1+1+10.500000 0 0 0.000000 0 0 0 'near' 'Near[pixel]: Near-area also binary' near
- -i 1 0 1 0 0 -1x1+1+12.000000 0 0 256 0 0 'nLevel' 'nLevel: For creating histgram by Kittler and Ohtsu ' nLevel
- -I 1 0 1 0 0 1 -1x1+1+13.500000 ' ' 'configFile' 'ConfigurationFile' c
- -f 1 0 1 0 0 -1x1+1+15.000000 0 0 0.500000 0 0 0 'p' 'p' p
- -i 1 0 1 0 0 -1x1+1+16.500000 0 0 0 0 0 'mode' 'Mode' m
+ -f 1 0 1 0 0 -1x1+1+9.000000 0 0 0.500000 0 0 0 'sigmaThreshold' 'Sigma threshold(BandPath)' st
+ -f 1 0 1 0 0 -1x1+1+10.500000 0 0 0.000000 0 0 0 'v' 'Value' v
+ -f 1 0 1 0 0 -1x1+1+12.000000 0 0 0.000000 0 0 0 'near' 'Near[pixel]: Near-area also binary' near
+ -i 1 0 1 0 0 -1x1+1+13.500000 0 0 256 0 0 'nLevel' 'nLevel: For creating histgram by Kittler and Ohtsu ' nLevel
+ -I 1 0 1 0 0 1 -1x1+1+15.000000 ' ' 'configFile' 'ConfigurationFile' c
+ -f 1 0 1 0 0 -1x1+1+16.500000 0 0 0.500000 0 0 0 'p' 'p' p
+ -i 1 0 1 0 0 -1x1+1+18.000000 0 0 0 0 0 'mode' 'Mode' m
-E
-E
-E
fprintf(stderr, " [-O[utput] OutParam (stdout ).as(outFile::ASCII ) ] :Optional :Output:Parameters\n");
fprintf(stderr, " [-t[hreshold] t (0 ).as(Real ) ] :Optional :Value of threshold\n");
fprintf(stderr, " [-d[elta]t[hreshold] deltaThreshold (0 ).as(Real ) ] :Optional :Difference threshold\n");
+ fprintf(stderr, " [-s[igma]t[hreshold] sigmaThreshold (0.5 ).as(Real ) ] :Optional :Sigma threshold(BandPath)\n");
fprintf(stderr, " [-v[alue] v (0 ).as(Real ) ] :Optional :Value\n");
fprintf(stderr, " [-near near (0 ).as(Real ) ] :Optional :Near[pixel]: Near-area also binary\n");
fprintf(stderr, " [-nLevel nLevel (256 ).as(Integer ) ] :Optional :nLevel: For creating histgram by Kittler and Ohtsu \n");