Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Face Detection Tutorial region tags to standard #1201

Merged
merged 1 commit into from
Aug 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
}