Forum

Model rotated when exporting as .obj

Started by ivan.mdn, October 31, 2014, 03:53:51 PM

Previous topic - Next topic

ivan.mdn

I'm trying to export a model through the python API using the following code:
crs = PhotoScan.CoordinateSystem('LOCAL_CS["Local CS",LOCAL_DATUM["Local Datum",0],UNIT["metre",1]]')
chunk.exportModel(arqExpModel, format='obj',projection=crs):

But when I try to open the .obj file on another 3d software (like Blender) is appears rotated 90ยบ around the x axis. How can i fix this? It only happens with the .obj format, but unfortunately I can not use a different one on this particular project.

Alexey Pasumansky

Hello ivan.mdn,

What version of PhotoScan you are using? And is the problem reproducible if you use GUI export option?
Best regards,
Alexey Pasumansky,
Agisoft LLC

ivan.mdn

I'm really sorry Alexey, but it was actually a problem when loading the model on the other software. It had nothing to do with photoScan. But anyways, thank you for you quick answer.

jeremyeastwood

I'm having the exact same problem - it is an issue with loading the model onto other software (and does happen when using the GUI exporter / uploader as well), but a simple fix would be to rotate the model 90deg about the x-axis before export - how can I modify the above code do this?

Thanks

Alexey Pasumansky

Are you sure, you are choosing Z-up option, for example, when importing model in Blender?
Best regards,
Alexey Pasumansky,
Agisoft LLC

ivan.mdn

jeremyeastwood, what Alexey has mentioned is exactly what was happening to me. It seems that Blender imports the model with a different axis orientation, but you can set it to match PhotoScan's orientation like Alexey said.

But since you raised the question, I am actually needing something similiar to what you asked, but a little more sofisticated:
I have three markers set on my model: the first I am using as the origin of the local coordinate system (using the shift option when exporting) and I would like to rotate the model so that when exporting it I could guarantee that the other two points (wich are aligned on the xy plane) have positive x, y, and z values. Is this possible to do throught the python API ?

Alexey Pasumansky

Hello ivan.mdn,

Could you please provide some scheme of the marker placement or a screenshot?

But still the task is not quite clear, if you know the coordinates of the first marker (origin point), then the coordinate system is already defined in your project and you can check the estimated values of two other points.
Best regards,
Alexey Pasumansky,
Agisoft LLC

ivan.mdn

I'm sorry Alexey, indeed I sounded a little confusing. I am actually modelling human faces. The three points I mentioned are placed on the tip of the nose (wich I am using as the origin) and the external corner of each eye. What I want is to be able to rotate the model so that the z axis is pointing towards the face, the x axis is pointing up (to the forehead) and the y axis is pointing to the right ear (model's left ear). And also I would need for the imaginary line connecting the two points on the eyes to be parallel to the y axis. This way I could guarantee that no matter what were the positions of the cameras used to create the model, the result of the exportation process would always show up the same way, or in other words, the model would always be facing foward when you look at it on the screen.
Below I attached a picture for ilustration purposes: