Try both binarizers, use appspot stylesheet, update dependency libs

git-svn-id: https://zxing.googlecode.com/svn/trunk@1192 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2010-01-31 14:43:44 +00:00
parent 171bd88c5d
commit 7cd9541e90
15 changed files with 37 additions and 16 deletions

View file

@ -84,6 +84,7 @@
<fileset dir="web"> <fileset dir="web">
<include name="*.jspx"/> <include name="*.jspx"/>
<include name="*.png"/> <include name="*.png"/>
<include name="*.css"/>
<include name="**/*.jad"/> <include name="**/*.jad"/>
<include name="**/*.jar"/> <include name="**/*.jar"/>
</fileset> </fileset>

View file

@ -63,6 +63,7 @@ import java.net.SocketException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.Collection;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
@ -93,7 +94,7 @@ public final class DecodeServlet extends HttpServlet {
static { static {
HINTS = new Hashtable<DecodeHintType, Object>(5); HINTS = new Hashtable<DecodeHintType, Object>(5);
HINTS.put(DecodeHintType.TRY_HARDER, Boolean.TRUE); HINTS.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
Vector<BarcodeFormat> possibleFormats = new Vector<BarcodeFormat>(); Collection<BarcodeFormat> possibleFormats = new Vector<BarcodeFormat>();
possibleFormats.add(BarcodeFormat.UPC_A); possibleFormats.add(BarcodeFormat.UPC_A);
possibleFormats.add(BarcodeFormat.UPC_E); possibleFormats.add(BarcodeFormat.UPC_E);
possibleFormats.add(BarcodeFormat.EAN_8); possibleFormats.add(BarcodeFormat.EAN_8);
@ -253,9 +254,16 @@ public final class DecodeServlet extends HttpServlet {
BinaryBitmap bitmap = new BinaryBitmap(new GlobalHistogramBinarizer(source)); BinaryBitmap bitmap = new BinaryBitmap(new GlobalHistogramBinarizer(source));
result = reader.decode(bitmap, HINTS); result = reader.decode(bitmap, HINTS);
} catch (ReaderException re) { } catch (ReaderException re) {
log.info("DECODE FAILED: " + re.toString()); try {
response.sendRedirect("notfound.jspx"); // Try again with other binarizer
return; LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
result = reader.decode(bitmap, HINTS);
} catch (ReaderException re2) {
log.info("DECODE FAILED: " + re.toString());
response.sendRedirect("notfound.jspx");
return;
}
} }
if (request.getParameter("full") == null) { if (request.getParameter("full") == null) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -22,9 +22,10 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title>Bad Image</title> <title>Bad Image</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
</head> </head>
<body> <body>
<h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Bad Image</h1> <div id="header"><h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Bad Image</h1></div>
<p>The image you uploaded could not be decoded, or was too large. Go "Back" in your browser and try another <p>The image you uploaded could not be decoded, or was too large. Go "Back" in your browser and try another
image. image.
</p> </p>

View file

@ -22,9 +22,10 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title>Bad URL</title> <title>Bad URL</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
</head> </head>
<body> <body>
<h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Bad URL</h1> <div id="header"><h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Bad URL</h1></div>
<p>You didn't specify a URL, or the URL was not valid, or did not return an image. Go "Back" in your browser and <p>You didn't specify a URL, or the URL was not valid, or did not return an image. Go "Back" in your browser and
try again. try again.
</p> </p>

View file

@ -22,9 +22,10 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title>ZXing Decoder Online</title> <title>ZXing Decoder Online</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
</head> </head>
<body> <body>
<h1><img src="zxing-icon.png" height="32" width="32" alt=""/> ZXing Decoder Online</h1> <div id="header"><h1><img src="zxing-icon.png" height="32" width="32" alt=""/> ZXing Decoder Online</h1></div>
<p>This is a simple page that will let you decode a 1D or 2D barcode found <p>This is a simple page that will let you decode a 1D or 2D barcode found
in an image online. Enter a URL below. in an image online. Enter a URL below.
</p> </p>
@ -45,7 +46,7 @@
<a href="http://code.google.com/p/zxing">project page</a> <a href="http://code.google.com/p/zxing">project page</a>
for details. for details.
</p> </p>
<p>Copyright 2008 and onwards ZXing authors</p> <div id="footer"><p>Copyright 2008 and onwards ZXing authors</p></div>
<jsp:include page="analytics.jspx"/> <jsp:include page="analytics.jspx"/>
</body> </body>
</html> </html>

View file

@ -24,12 +24,13 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title>Decode Succeeded</title> <title>Decode Succeeded</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
<style type="text/css"> <style type="text/css">
td { vertical-align: top; padding: 0.1in; background-color: #EEEEEE; font-family: monospace; } td { vertical-align: top; padding: 0.1in; background-color: #EEEEEE; font-family: monospace; }
</style> </style>
</head> </head>
<body> <body>
<h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Decode Succeeded</h1> <div id="header"><h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Decode Succeeded</h1></div>
<table> <table>
<tr> <tr>
<td>Raw text</td> <td>Raw text</td>
@ -52,7 +53,7 @@
<td><jsp:expression>request.getAttribute("displayResult")</jsp:expression></td> <td><jsp:expression>request.getAttribute("displayResult")</jsp:expression></td>
</tr> </tr>
</table> </table>
<p>Copyright 2008 and onwards ZXing authors</p> <div id="footer"><p>Copyright 2008 and onwards ZXing authors</p></div>
<jsp:include page="analytics.jspx"/> <jsp:include page="analytics.jspx"/>
</body> </body>
</html> </html>

View file

@ -26,14 +26,14 @@
<body> <body>
<h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Download ZXing Reader</h1> <h1><img src="zxing-icon.png" height="32" width="32" alt=""/> Download ZXing Reader</h1>
<p> <p>
<a href="BarcodeReader.jad">Download</a> the ZXing Barcode Reader for J2ME. <a href="market://search?q=pname%3Acom.google.zxing.client.android">Download</a> the Android client.
</p>
<p>
<a href="BarcodeReader.jad">Download</a> the Barcode Reader for J2ME.
</p> </p>
<p> <p>
(<a href="basic/BarcodeReader.jad">Download</a> the alternate "basic" version for J2ME.) (<a href="basic/BarcodeReader.jad">Download</a> the alternate "basic" version for J2ME.)
</p> </p>
<p>
<a href="market://search?q=pname%3Acom.google.zxing.client.android">Download</a> the Android client.
</p>
<p>Copyright 2008 and onwards ZXing authors</p> <p>Copyright 2008 and onwards ZXing authors</p>
<jsp:include page="analytics.jspx"/> <jsp:include page="analytics.jspx"/>
</body> </body>

View file

@ -22,9 +22,10 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head> <head>
<title>No Barcode Found</title> <title>No Barcode Found</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
</head> </head>
<body> <body>
<h1><img src="zxing-icon.png" height="32" width="32" alt=""/> No Barcode Found</h1> <div id="header"><h1><img src="zxing-icon.png" height="32" width="32" alt=""/> No Barcode Found</h1></div>
<p>No barcode was found in this image. Either it did not contain a barcode, or did not contain one in a <p>No barcode was found in this image. Either it did not contain a barcode, or did not contain one in a
supported format, or the software was simply unable to find it. Go "Back" in your browser and try another image. supported format, or the software was simply unable to find it. Go "Back" in your browser and try another image.
</p> </p>

7
zxingorg/web/style.css Normal file
View file

@ -0,0 +1,7 @@
body{background-color:#e9eef3;font-family:Arial,sans-serif;font-size:12px}
td{font-size:14px}
#header{background-color:#dde3e9;border-bottom:1px solid #f2f7fc}
#header h1{font-size:15px;font-weight:bold;padding:12px;border-bottom:1px solid #c8d0d9}
#header span{font-weight:normal;color:#5e6b75}
#footer{width:100%;text-align:center;padding-top:12px}
#footer a{text-decoration:none;color:#5e6b75}