Menu

이미지에서 객체 좌표 얻기

이미지 본문과 영어로 된 코멘트를 게시하고 지정된 개체의 좌표를 최대 6세트까지 받을 수 있습니다. 사각형 좌표뿐만 아니라 점 좌표도 요청할 수 있습니다. 한 면의 최대 이미지 크기는 500픽셀이며, 이보다 큰 이미지는 작업자 인터페이스에서 축소됩니다.

Image-to-Coordinates captcha example, select objects on the picture
Image-to-Coordinates captcha example, draw a rectangle above objects
"points" 및 "rectangles" 작업 예제
Python
Node.js
Go
PHP
bash

Python에서 이미지를 좌표로 변환을(를) 해결하는 방법

#pip3 install anticaptchaofficial

from anticaptchaofficial.imagetocoordinates import *

solver = imagetocoordinates()
solver.set_verbose(1)
solver.set_key("YOUR_KEY")
solver.set_mode("points")
solver.set_comment("Select objects in specified order")

coordinates = solver.solve_and_return_solution("coordinates.png")
if coordinates != 0:
    print("coordinates: ", coordinates)
else:
    print("task finished with error "+solver.error_code)

Node.js에서 이미지를 좌표로 변환을(를) 해결하는 방법

//npm install @antiadmin/anticaptchaofficial
//https://github.com/anti-captcha/anticaptcha-npm

const ac = require("@antiadmin/anticaptchaofficial");
const fs = require('fs');

const captcha = fs.readFileSync('captcha.png', { encoding: 'base64' });

ac.setAPIKey('YOUR_API_KEY_HERE');

//Specify softId to earn 10% commission with your app.
//Get your softId here: https://anti-captcha.com/clients/tools/devcenter
ac.setSoftId(0);

ac.solveImageToCoordinates(captcha, "Select all objects in specified order", "points")
    .then(coordinates => console.log('image coordinates:', coordinates))
    .catch(error => console.log('test received error '+error));

Go에서 이미지를 좌표로 변환을(를) 해결하는 방법

// Install with:
// go get github.com/anti-captcha/anticaptcha-go

package main

import (
    "encoding/base64"
    "fmt"
    "github.com/anti-captcha/anticaptcha-go"
    "log"
)

func main() {
    // Create API client and set the API Key
    ac := anticaptcha.NewClient("API_KEY_HERE")

    // set to 'false' to turn off debug output
    ac.IsVerbose = true

    // Specify softId to earn 10% commission with your app.
    // Get your softId here: https://anti-captcha.com/clients/tools/devcenter
    //ac.SoftId = 1187

    // Make sure the API key funds balance is positive
    balance, err := ac.GetBalance()
    if err != nil {
        log.Fatal(err)
        // Exit program to make sure you don't DDoS API with requests, while having empty balance
        return
    }
    fmt.Println("Balance:", balance)

    // Solve image-to-coordinates captcha
    imageData, err := ac.ReadImageFile("coordinates.jpg")
    if err != nil {
        log.Fatal(err)
    }
    solution, err := ac.SolveImageToCoordinates(base64.StdEncoding.EncodeToString(imageData), anticaptcha.ImageToCoordinates{
        Comment: "Select object in the specified order",
        Mode:    "points",
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Objects X,Y coordinates:", solution)
}

PHP에서 이미지를 좌표로 변환을(를) 해결하는 방법

//git clone https://github.com/anti-captcha/anticaptcha-php.git

include("../anticaptcha.php");
include("../imagetocoordinates.php");

$api = new ImageToCoordinates();
$api->setVerboseMode(true);

//your anti-captcha.com account key
$api->setKey(readline("You API key: "));

//setting file
$api->setFile("captcha.jpg");
$api->setComment("Select all elephants");
$api->setMode("rectangles");

//Specify softId to earn 10% commission with your app.
//Get your softId here: https://anti-captcha.com/clients/tools/devcenter
$api->setSoftId(0);

if (!$api->createTask()) {
    $api->debout("API v2 send failed - ".$api->getErrorMessage(), "red");
    return false;
}

$taskId = $api->getTaskId();


if (!$api->waitForResult()) {
    $api->debout("could not solve captcha", "red");
    $api->debout($api->getErrorMessage());
} else {
    $coordinates    =   $api->getTaskSolution();
    echo "\nresult:\n";
    print_r($coordinates);
    //check result, then if results is wrong:
    $api->reportIncorrectImageCaptcha();
}

bash에서 이미지를 좌표로 변환을(를) 해결하는 방법

curl -i -H "Accept: application/json" \
-H "Content-Type: application/json" \
-X POST -d '{
    "clientKey":"YOUR_API_KEY_HERE",
    "task":
        {
            "type":"ImageToCoordinatesTask",
            "body":"BASE64_BODY_HERE__NO_NEWLINES__NO_EXTRA_TAGS__ONLY_CLEAN_BASE64",
            "comment":"Select all elephants",
            "mode":"rectangles"
        },
    "softId": 0
}' https://api.anti-captcha.com/createTask

작업 객체

속성 유형 필수 목적
type 문자열 ImageToCoordinatesTask
작업 유형을 정의하세요.
body 문자열 base64로 인코딩된 파일 본문. 줄 바꿈 없이 전송하여야 합니다. 'data:image/png,' 혹은 이와 유사한 태그는 포함하지 말고, 순수하게 base64만 사용하시기 바랍니다!
comment 문자열 아니요 영어 문자만 포함된 작업에 대한 코멘트. 예제: "Select objects in specified order" 또는 "select all cars".
mode 문자열 아니요 작업 모드는 "points" 또는 "rectangles"에 해당하며, 기본값은 "points"입니다.
websiteURL 문자열 아니요 지출 통계에서 이미지 CAPTCHA의 출처를 구분하기 위한 선택적 매개변수

작업 솔루션 객체

속성 유형 목적
coordinates 문자열 좌표 집합의 배열. "points" 모드의 경우 (x,y) 집합입니다. "rectangles"의 경우, 왼쪽 상단에서 시작하여 오른쪽 하단 방향으로 (x1,y1,x2,y2)입니다. 좌표 시작점은 왼쪽 상단 모서리입니다.

응답 예제

{
    "errorId":0,
    "status":"ready",
    "solution":
    {
      "coordinates":[
        [17,48,54,83],
        [76,93,140,164]
      ]
    },
    "cost":"0.000700",
    "ip":"46.98.54.221",
    "createTime":1472205564,
    "endTime":1472205570,
    "solveCount":"0"
}