This API endpoint is designed to calculate the area of items on a flat plane surface. It uses a combination of image processing techniques to identify regions of interest and adjust for the camera's angle in order to provide accurate area measurements.
The API expects a JSON body with the following fields:
x1, y1: Coordinates of the top-left point of the desired image region.
x2, y2: Coordinates of the top-right point.
x3, y3: Coordinates of the bottom-right point.
x4, y4: Coordinates of the bottom-left point.
These points define a quadrilateral region that will be extracted from the input image.
width: Desired width of the output image.
height: Desired height of the output image.
This specifies the aspect ratio of the output image after warping.
A numerical value used to segment the image into foreground and background regions. Pixels with intensity values above the threshold are considered foreground.
A multiplier used to adjust the calculated area of the identified regions. This can be helpful to calibrate the results to a specific unit of measurement (e.g., square meters).
A boolean flag indicating whether to return the processed image along with the aria calculations.
A base64-encoded string representing the input image. Response:
The API returns a JSON object with the following fields:
Total number of distinct pixels detected in the post-processed image.
Percentage of the total image area covered by detected region in the post-processed image.
Actual area of detected regions, calculated using the provided area_multiplier.
Base64-encoded JPEG image showing the region.
{
"cropping_points": {
"x1": 275,
"y1": 1078,
"x2": 2014,
"y2": 642,
"x3": 4177,
"y3": 1304,
"x4": 2096,
"y4": 2084
},
"aspect_ratio": {
"width": 4,
"height": 5
},
"threshold": 45000,
"area_multiplier": 0.02,
"return_image": false,
"base64_png": "hWbyKpB..."
}