Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy Spann committed Dec 5, 2018
1 parent 6828d7a commit 09f7cfe
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 89 deletions.
124 changes: 54 additions & 70 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,22 @@ public void process(final InputStream input, final java.io.OutputStream out) thr
for (Result result : results) {
attributes.put(String.format("label_%d", i), result.getLabel() );
attributes.put(String.format("probability_%d",i), String.format("%.2f", result.getProbability()));

if ( result.getXmin() > 0) {
attributes.put(String.format("xmin_%d", i), String.format("%.2f", result.getXmin()));
attributes.put(String.format("xmax_%d", i), String.format("%.2f", result.getXmax()));
attributes.put(String.format("ymin_%d", i), String.format("%.2f", result.getYmin()));
attributes.put(String.format("ymax_%d", i), String.format("%.2f", result.getYmax()));
attributes.put(String.format("height_%d", i), String.format("%d", result.getHeight()));
attributes.put(String.format("width_%d", i), String.format("%d", result.getWidth()));
}
attributes.put(String.format("xmin_%d", i), String.format("%.2f", result.getXmin()));
attributes.put(String.format("xmax_%d", i), String.format("%.2f", result.getXmax()));
attributes.put(String.format("ymin_%d", i), String.format("%.2f", result.getYmin()));
attributes.put(String.format("ymax_%d", i), String.format("%.2f", result.getYmax()));
attributes.put(String.format("height_%d", i), String.format("%d", result.getHeight()));
attributes.put(String.format("width_%d", i), String.format("%d", result.getWidth()));

Graphics2D g2d = (Graphics2D) img.createGraphics();

try {
// Draw on the buffered image
// Draw on the buffered image with our rectangles
g2d.setStroke(new BasicStroke(3));
g2d.setColor(Color.GREEN);
g2d.drawRect(Math.round(result.getXmin()), Math.round(result.getYmin()),
Math.round(result.getWidth()),
Math.round(result.getHeight()));
g2d.setColor(Color.BLUE);
g2d.drawRect((int)(result.getXmin()), (int)(result.getYmin()),
(int)(result.getXmax()),
(int)(result.getYmax()));
g2d.dispose();

} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ public List<Result> ssdClassify(String modelPath, byte[] imageBytes) {
for (ObjectDetectorOutput i : ele) {
if ( i != null ) {
Result result = new Result();

result.setLabel(i.getClassName());
result.setProbability(i.getProbability());
result.setXmin(i.getXMin() * width);
result.setXmax(i.getXMax() * height);
result.setYmin(i.getYMin() * width);
result.setYmax(i.getYMax() * height);
result.setXmin(i.getXMin() * width ); //
result.setXmax(i.getXMax() * width ); //
result.setYmin(i.getYMin() * height ); //
result.setYmax(i.getYMax() * height ); //
result.setWidth(width);
result.setHeight(height);
result.setRank(rank);
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 09f7cfe

Please sign in to comment.