Skip to content

Commit

Permalink
Update Face Detection Tutorial region tags to standard
Browse files Browse the repository at this point in the history
  • Loading branch information
alixhami committed Aug 29, 2018
1 parent a88e2ff commit c93bcdf
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

package com.google.cloud.vision.samples.facedetect;

// [BEGIN import_libraries]

// [START vision_face_detection_tutorial_imports]
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.json.JsonFactory;
Expand Down Expand Up @@ -45,7 +44,7 @@
import java.security.GeneralSecurityException;
import java.util.List;
import javax.imageio.ImageIO;
// [END import_libraries]
// [END vision_face_detection_tutorial_imports]

/**
* A sample application that uses the Vision API to detect faces in an image.
Expand All @@ -60,7 +59,7 @@ public class FaceDetectApp {

private static final int MAX_RESULTS = 4;

// [START main]
// [START vision_face_detection_tutorial_run_application]
/**
* Annotates an image using the Vision API.
*/
Expand All @@ -85,9 +84,9 @@ public static void main(String[] args) throws IOException, GeneralSecurityExcept
System.out.printf("Writing to file %s\n", outputPath);
app.writeWithFaces(inputPath, outputPath, faces);
}
// [END main]
// [END vision_face_detection_tutorial_run_application]

// [START get_vision_service]
// [START vision_face_detection_tutorial_client]
/**
* Connects to the Vision API using Application Default Credentials.
*/
Expand All @@ -99,7 +98,7 @@ public static Vision getVisionService() throws IOException, GeneralSecurityExcep
.setApplicationName(APPLICATION_NAME)
.build();
}
// [END get_vision_service]
// [END vision_face_detection_tutorial_client]

private final Vision vision;

Expand All @@ -110,7 +109,7 @@ public FaceDetectApp(Vision vision) {
this.vision = vision;
}

// [START detect_face]
// [START vision_face_detection_tutorial_send_request]
/**
* Gets up to {@code maxResults} faces for an image stored at {@code path}.
*/
Expand Down Expand Up @@ -141,9 +140,9 @@ public List<FaceAnnotation> detectFaces(Path path, int maxResults) throws IOExce
}
return response.getFaceAnnotations();
}
// [END detect_face]
// [END vision_face_detection_tutorial_send_request]

// [START highlight_faces]
// [START vision_face_detection_tutorial_process_response]
/**
* Reads image {@code inputPath} and writes {@code outputPath} with {@code faces} outlined.
*/
Expand Down Expand Up @@ -176,5 +175,5 @@ private static void annotateWithFace(BufferedImage img, FaceAnnotation face) {
gfx.setColor(new Color(0x00ff00));
gfx.draw(poly);
}
// [END highlight_faces]
// [END vision_face_detection_tutorial_process_response]
}

0 comments on commit c93bcdf

Please sign in to comment.