Mercurial > mercurial > hgweb_mover.cgi
comparison src/testtune.cpp @ 5:3b734fd6ee2b
v0.2
| author | pyon@macmini |
|---|---|
| date | Thu, 06 Oct 2011 20:27:54 +0900 |
| parents | 1ea4f7981ff5 |
| children | b59dfcc84d7a |
comparison
equal
deleted
inserted
replaced
| 4:a505f7417742 | 5:3b734fd6ee2b |
|---|---|
| 1 // Filename : testtune.cpp | 1 // Filename : testtune.cpp |
| 2 // Last Change: 29-Sep-2011. | 2 // Last Change: 06-Oct-2011. |
| 3 // | 3 // |
| 4 | 4 |
| 5 #include "wx/utils.h" | 5 #include "wx/utils.h" |
| 6 #include "wx/file.h" | 6 #include "wx/file.h" |
| 7 #include "wx/string.h" | 7 #include "wx/string.h" |
| 8 #include "wx/app.h" | |
| 8 #include "wx/image.h" | 9 #include "wx/image.h" |
| 9 | 10 |
| 10 bool IsBlack( int r, int g, int b ) | 11 bool IsBlack( int r, int g, int b ) |
| 11 { | 12 { |
| 12 if ( r == 0 && g == 0 && b == 0 ) { | 13 if ( r == 0 && g == 0 && b == 0 ) { |
| 72 g = img.GetGreen( x, y ); | 73 g = img.GetGreen( x, y ); |
| 73 b = img.GetBlue( x, y ); | 74 b = img.GetBlue( x, y ); |
| 74 if( IsBlack( (int)r, (int)g, (int)b ) ) black++; | 75 if( IsBlack( (int)r, (int)g, (int)b ) ) black++; |
| 75 } | 76 } |
| 76 float z = (float)black / h; | 77 float z = (float)black / h; |
| 77 float zmin = 0.103428 * 0.95; | 78 float zmin = 0.095713; |
| 78 float zmax = 0.103428 * 1.05; | 79 float zmax = 0.108600; |
| 79 | 80 |
| 80 wxFile f( file ); | 81 wxFile f( file ); |
| 81 long l = f.Length(); | 82 long l = f.Length(); |
| 82 float lmin = 2181468 * 0.95; | 83 float lmin = 2072393; |
| 83 float lmax = 2181468 * 1.05; | 84 float lmax = 2346082; |
| 84 | 85 |
| 85 //wxPuts(wxString::Format(wxT("z = %f, len = %d"),z,len)); | 86 wxPuts(wxString::Format(wxT("z = %f, len = %d"),z,l)); |
| 86 if ( zmin < z && z < zmax | 87 if ( zmin < z && z < zmax |
| 87 && lmin < l && l < lmax ) { | 88 && lmin < l && l < lmax ) { |
| 88 return true; | 89 return true; |
| 89 } | 90 } |
| 90 return false; | 91 return false; |
| 91 } | 92 } |
| 92 | 93 |
| 93 int main( int argc, char **argv ) | 94 int main( int argc, char **argv ) |
| 94 { | 95 { |
| 95 wxInitAllImageHandlers(); | 96 wxInitAllImageHandlers(); |
| 96 wxString file = wxT("img\\img081.jpg"); | 97 //wxString file = wxT("nodetect/img045.jpg"); |
| 98 //wxString file = wxT("nodetect/img073.jpg"); | |
| 99 //wxString file = wxT("nodetect/img174.jpg"); | |
| 100 //wxString file = wxT("nodetect/img182.jpg"); | |
| 101 //wxString file = wxT("nodetect/img246.jpg"); | |
| 102 //wxString file = wxT("nodetect/img268.jpg"); | |
| 103 wxString file = wxT("nodetect/img294.jpg"); | |
| 97 | 104 |
| 98 if ( IsMarksheet( file ) ) wxPuts(wxT("perhaps marksheet !")); | 105 if ( IsMarksheet( file ) ) wxPuts(file+wxT(" is perhaps marksheet !")); |
| 99 wxString hhs = GuessHhs( file ); | 106 wxString hhs = GuessHhs( file ); |
| 100 wxPuts(hhs); | 107 wxPuts(hhs); |
| 101 | 108 |
| 102 } | 109 } |
| 103 | 110 |
