Introduction
Get 3D from image-to-3d.
Get 3D
Request
POST /image-to-3d-sessions/get-3d/preview/<Session Code>
Parameters
selected_spin_index OPTIONAL for non turbo meshes
type : number
in : body
default : 0
description : select image index from generated four images. Available selected index : 0, 1, 2, 3
Note : You have to pass this parameter if preview_mesh is turbo.
selected_spin OPTIONAL for non turbo meshes
type : string
in : body
description : select one image url from generated spins four images.
Note : You have to pass this parameter if preview_mesh is turbo.
scaled_bbox OPTIONAL
type : array
in : body
description: is the scaled bounding box describing the target dimensions of the asset to be generated. Specifically, scaled_bbox is a list of 3 float numbers, where scaled_bbox[0] is width, scaled_bbox[1] is height and scaled_bbox[2] is the depth.
pivot_point OPTIONAL
type : array
in : body
example : [0.0, 0.0, 0.0]
description: This parameter allows customizing the pivot point or origin of the exported mesh.
Specifically, pivot_point
is a list of 3 float numbers corresponding to the x, y, and z pivot point coordinates.
The pivot_point values should be in the range [-0.5, 0.5]
, inclusive, and are normalized to the dimensions of the mesh's bounding box. The parameter will be used as follows:
- For the exported mesh to have a pivot point in the center of its bounding box, pass
[0, 0, 0]
(default). [-0.5, -0.5, -0.5]
will result in the pivot point being at the left, bottom, back (-X, -Y, -Z) corner of the bounding box, and[0.5, 0.5, 0.5]
will result in a pivot point at the right, top, front (+X, +Y, +Z) corner of the bounding box.- For the exported mesh to have a pivot point at the center bottom of the bounding box, pass
[0, -0.5, 0]
.
Python
import requests
import json
url = "https://api.csm.ai/image-to-3d-sessions/get-3d/preview/SESSION_P_44569824122"
payload = json.dumps({
selected_spin_index: 0
selected_spin: "https://via.placeholder.com/300/09f/fff.png"
})
headers = {
'x-api-key': '<X-API_KEY>',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Node.js
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://api.csm.ai/image-to-3d-sessions/get-3d/preview/SESSION_P_44569824122',
'headers': {
'x-api-key': '<X-API_KEY>',
'Content-Type': 'application/json'
},
'body': JSON.stringify({
selected_spin_index: 0
selected_spin: "https://via.placeholder.com/300/09f/fff.png"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Curl
curl -k --location 'https://api.csm.ai/image-to-3d-sessions/get-3d/preview/SESSION_P_44569824122' \
--header 'x-api-key: <X-API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
}'
Response
{
"error": "",
"message": "Generating Mesh",
"statusCode": 200,
"data": {
"scenario": "SESSION_P_44569824122",
"unique_trial_key": "168923176748ZJ@NcRfUjXn2r5u8x",
"status": "unprocessed",
"complete_job_data": {
"scenario": "SESSION_P_44569824122",
"job_priority": "2",
"username": "admin@test.com",
"call": "dreamfusion",
"user_id": "000000",
"status": "unprocessed",
"start_time": "1689231769.6472576",
"unique_trial_key": "168923176748ZJ@NcRfUjXn2r5u8x",
"task_data": "{\"scenario\": \"SESSION_P_44569824122\", \"unique_trial_key\": \"168923176748ZJ@NcRfUjXn2r5u8x\", \"customer_email\": \"admin@yopmail.com\", \"image_url\": \"https://via.placeholder.com/300/09f/fff.png\", \"text_prompt\": \"Walk\", \"keyword\": \"\", \"discord_user_id\": \"\"}",
"id": "job:dreamfusion:SESSION_P_44569824122_168923176748ZJ@NcRfUjXn2r5u8x"
}
}
}