[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-7365a75f-2a5b-403b-9075-b47a3923b289":3,"$f6eIcHtkclsNwyywRzUNtGgG_DuE7vQDQs9-yFtIWnwM":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"7365a75f-2a5b-403b-9075-b47a3923b289","azure-ai-vision-imageanalysis-java","使用Azure AI Vision SDK for Java构建图像分析应用程序。在实现图像标题、OCR文本提取、对象检测、标记或智能裁剪时使用。","cat_coding_devops","mod_coding","sickn33,coding","---\nname: azure-ai-vision-imageanalysis-java\ndescription: \"Build image analysis applications with Azure AI Vision SDK for Java. Use when implementing image captioning, OCR text extraction, object detection, tagging, or smart cropping.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# Azure AI Vision Image Analysis SDK for Java\n\nBuild image analysis applications using the Azure AI Vision Image Analysis SDK for Java.\n\n## Installation\n\n```xml\n\u003Cdependency>\n    \u003CgroupId>com.azure\u003C\u002FgroupId>\n    \u003CartifactId>azure-ai-vision-imageanalysis\u003C\u002FartifactId>\n    \u003Cversion>1.1.0-beta.1\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\n## Client Creation\n\n### With API Key\n\n```java\nimport com.azure.ai.vision.imageanalysis.ImageAnalysisClient;\nimport com.azure.ai.vision.imageanalysis.ImageAnalysisClientBuilder;\nimport com.azure.core.credential.KeyCredential;\n\nString endpoint = System.getenv(\"VISION_ENDPOINT\");\nString key = System.getenv(\"VISION_KEY\");\n\nImageAnalysisClient client = new ImageAnalysisClientBuilder()\n    .endpoint(endpoint)\n    .credential(new KeyCredential(key))\n    .buildClient();\n```\n\n### Async Client\n\n```java\nimport com.azure.ai.vision.imageanalysis.ImageAnalysisAsyncClient;\n\nImageAnalysisAsyncClient asyncClient = new ImageAnalysisClientBuilder()\n    .endpoint(endpoint)\n    .credential(new KeyCredential(key))\n    .buildAsyncClient();\n```\n\n### With DefaultAzureCredential\n\n```java\nimport com.azure.identity.DefaultAzureCredentialBuilder;\n\nImageAnalysisClient client = new ImageAnalysisClientBuilder()\n    .endpoint(endpoint)\n    .credential(new DefaultAzureCredentialBuilder().build())\n    .buildClient();\n```\n\n## Visual Features\n\n| Feature | Description |\n|---------|-------------|\n| `CAPTION` | Generate human-readable image description |\n| `DENSE_CAPTIONS` | Captions for up to 10 regions |\n| `READ` | OCR - Extract text from images |\n| `TAGS` | Content tags for objects, scenes, actions |\n| `OBJECTS` | Detect objects with bounding boxes |\n| `SMART_CROPS` | Smart thumbnail regions |\n| `PEOPLE` | Detect people with locations |\n\n## Core Patterns\n\n### Generate Caption\n\n```java\nimport com.azure.ai.vision.imageanalysis.models.*;\nimport com.azure.core.util.BinaryData;\nimport java.io.File;\nimport java.util.Arrays;\n\n\u002F\u002F From file\nBinaryData imageData = BinaryData.fromFile(new File(\"image.jpg\").toPath());\n\nImageAnalysisResult result = client.analyze(\n    imageData,\n    Arrays.asList(VisualFeatures.CAPTION),\n    new ImageAnalysisOptions().setGenderNeutralCaption(true));\n\nSystem.out.printf(\"Caption: \\\"%s\\\" (confidence: %.4f)%n\",\n    result.getCaption().getText(),\n    result.getCaption().getConfidence());\n```\n\n### Generate Caption from URL\n\n```java\nImageAnalysisResult result = client.analyzeFromUrl(\n    \"https:\u002F\u002Fexample.com\u002Fimage.jpg\",\n    Arrays.asList(VisualFeatures.CAPTION),\n    new ImageAnalysisOptions().setGenderNeutralCaption(true));\n\nSystem.out.printf(\"Caption: \\\"%s\\\"%n\", result.getCaption().getText());\n```\n\n### Extract Text (OCR)\n\n```java\nImageAnalysisResult result = client.analyze(\n    BinaryData.fromFile(new File(\"document.jpg\").toPath()),\n    Arrays.asList(VisualFeatures.READ),\n    null);\n\nfor (DetectedTextBlock block : result.getRead().getBlocks()) {\n    for (DetectedTextLine line : block.getLines()) {\n        System.out.printf(\"Line: '%s'%n\", line.getText());\n        System.out.printf(\"  Bounding polygon: %s%n\", line.getBoundingPolygon());\n        \n        for (DetectedTextWord word : line.getWords()) {\n            System.out.printf(\"  Word: '%s' (confidence: %.4f)%n\",\n                word.getText(),\n                word.getConfidence());\n        }\n    }\n}\n```\n\n### Detect Objects\n\n```java\nImageAnalysisResult result = client.analyzeFromUrl(\n    imageUrl,\n    Arrays.asList(VisualFeatures.OBJECTS),\n    null);\n\nfor (DetectedObject obj : result.getObjects()) {\n    System.out.printf(\"Object: %s (confidence: %.4f)%n\",\n        obj.getTags().get(0).getName(),\n        obj.getTags().get(0).getConfidence());\n    \n    ImageBoundingBox box = obj.getBoundingBox();\n    System.out.printf(\"  Location: x=%d, y=%d, w=%d, h=%d%n\",\n        box.getX(), box.getY(), box.getWidth(), box.getHeight());\n}\n```\n\n### Get Tags\n\n```java\nImageAnalysisResult result = client.analyzeFromUrl(\n    imageUrl,\n    Arrays.asList(VisualFeatures.TAGS),\n    null);\n\nfor (DetectedTag tag : result.getTags()) {\n    System.out.printf(\"Tag: %s (confidence: %.4f)%n\",\n        tag.getName(),\n        tag.getConfidence());\n}\n```\n\n### Detect People\n\n```java\nImageAnalysisResult result = client.analyzeFromUrl(\n    imageUrl,\n    Arrays.asList(VisualFeatures.PEOPLE),\n    null);\n\nfor (DetectedPerson person : result.getPeople()) {\n    ImageBoundingBox box = person.getBoundingBox();\n    System.out.printf(\"Person at x=%d, y=%d (confidence: %.4f)%n\",\n        box.getX(), box.getY(), person.getConfidence());\n}\n```\n\n### Smart Cropping\n\n```java\nImageAnalysisResult result = client.analyzeFromUrl(\n    imageUrl,\n    Arrays.asList(VisualFeatures.SMART_CROPS),\n    new ImageAnalysisOptions().setSmartCropsAspectRatios(Arrays.asList(1.0, 1.5)));\n\nfor (CropRegion crop : result.getSmartCrops()) {\n    System.out.printf(\"Crop region: aspect=%.2f, x=%d, y=%d, w=%d, h=%d%n\",\n        crop.getAspectRatio(),\n        crop.getBoundingBox().getX(),\n        crop.getBoundingBox().getY(),\n        crop.getBoundingBox().getWidth(),\n        crop.getBoundingBox().getHeight());\n}\n```\n\n### Dense Captions\n\n```java\nImageAnalysisResult result = client.analyzeFromUrl(\n    imageUrl,\n    Arrays.asList(VisualFeatures.DENSE_CAPTIONS),\n    new ImageAnalysisOptions().setGenderNeutralCaption(true));\n\nfor (DenseCaption caption : result.getDenseCaptions()) {\n    System.out.printf(\"Caption: \\\"%s\\\" (confidence: %.4f)%n\",\n        caption.getText(),\n        caption.getConfidence());\n    System.out.printf(\"  Region: x=%d, y=%d, w=%d, h=%d%n\",\n        caption.getBoundingBox().getX(),\n        caption.getBoundingBox().getY(),\n        caption.getBoundingBox().getWidth(),\n        caption.getBoundingBox().getHeight());\n}\n```\n\n### Multiple Features\n\n```java\nImageAnalysisResult result = client.analyzeFromUrl(\n    imageUrl,\n    Arrays.asList(\n        VisualFeatures.CAPTION,\n        VisualFeatures.TAGS,\n        VisualFeatures.OBJECTS,\n        VisualFeatures.READ),\n    new ImageAnalysisOptions()\n        .setGenderNeutralCaption(true)\n        .setLanguage(\"en\"));\n\n\u002F\u002F Access all results\nSystem.out.println(\"Caption: \" + result.getCaption().getText());\nSystem.out.println(\"Tags: \" + result.getTags().size());\nSystem.out.println(\"Objects: \" + result.getObjects().size());\nSystem.out.println(\"Text blocks: \" + result.getRead().getBlocks().size());\n```\n\n### Async Analysis\n\n```java\nasyncClient.analyzeFromUrl(\n    imageUrl,\n    Arrays.asList(VisualFeatures.CAPTION),\n    null)\n    .subscribe(\n        result -> System.out.println(\"Caption: \" + result.getCaption().getText()),\n        error -> System.err.println(\"Error: \" + error.getMessage()),\n        () -> System.out.println(\"Complete\")\n    );\n```\n\n## Error Handling\n\n```java\nimport com.azure.core.exception.HttpResponseException;\n\ntry {\n    client.analyzeFromUrl(imageUrl, Arrays.asList(VisualFeatures.CAPTION), null);\n} catch (HttpResponseException e) {\n    System.out.println(\"Status: \" + e.getResponse().getStatusCode());\n    System.out.println(\"Error: \" + e.getMessage());\n}\n```\n\n## Environment Variables\n\n```bash\nVISION_ENDPOINT=https:\u002F\u002F\u003Cresource>.cognitiveservices.azure.com\u002F\nVISION_KEY=\u003Cyour-api-key>\n```\n\n## Image Requirements\n\n- Formats: JPEG, PNG, GIF, BMP, WEBP, ICO, TIFF, MPO\n- Size: \u003C 20 MB\n- Dimensions: 50x50 to 16000x16000 pixels\n\n## Regional Availability\n\nCaption and Dense Captions require GPU-supported regions. Check [supported regions](https:\u002F\u002Flearn.microsoft.com\u002Fazure\u002Fai-services\u002Fcomputer-vision\u002Fconcept-describe-images-40) before deployment.\n\n## Trigger Phrases\n\n- \"image analysis Java\"\n- \"Azure Vision SDK\"\n- \"image captioning\"\n- \"OCR image text extraction\"\n- \"object detection image\"\n- \"smart crop thumbnail\"\n- \"detect people image\"\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,125,169,"2026-05-16 13:05:34",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"DevOps","devops","mdi-cog-outline","CI\u002FCD、容器化、部署运维",3,162,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"c3acf422-e1ca-4cc9-aa4f-bad8151acf75","1.0.0","azure-ai-vision-imageanalysis-java.zip",2575,"uploads\u002Fskills\u002F7365a75f-2a5b-403b-9075-b47a3923b289\u002Fazure-ai-vision-imageanalysis-java.zip","efcb0f664dea9b26bf4a5960f3e222aa3bd4ded2dce16a4b13204695887035b2","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":8404}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]