Skip to content

Commit

Permalink
Publish OPF 1.0.5 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
krahenbuhl authored Feb 8, 2024
1 parent a7d6c6d commit 57a736f
Show file tree
Hide file tree
Showing 49 changed files with 2,427 additions and 1,278 deletions.
76 changes: 22 additions & 54 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Attribution-ShareAlike 4.0 International
Attribution 4.0 International

=======================================================================

Expand Down Expand Up @@ -54,18 +54,16 @@ exhaustive, and do not form part of our licenses.

=======================================================================

Creative Commons Attribution-ShareAlike 4.0 International Public
License
Creative Commons Attribution 4.0 International Public License

By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution-ShareAlike 4.0 International Public License ("Public
License"). To the extent this Public License may be interpreted as a
contract, You are granted the Licensed Rights in consideration of Your
acceptance of these terms and conditions, and the Licensor grants You
such rights in consideration of benefits the Licensor receives from
making the Licensed Material available under these terms and
conditions.
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.


Section 1 -- Definitions.
Expand All @@ -84,59 +82,51 @@ Section 1 -- Definitions.
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.

c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.

d. Copyright and Similar Rights means copyright and/or similar rights
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.

e. Effective Technological Measures means those measures that, in the
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.

f. Exceptions and Limitations means fair use, fair dealing, and/or
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.

g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.

h. Licensed Material means the artistic or literary work, database,
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.

i. Licensed Rights means the rights granted to You subject to the
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.

j. Licensor means the individual(s) or entity(ies) granting rights
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.

k. Share means to provide material to the public by any means or
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.

l. Sui Generis Database Rights means rights other than copyright
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.

m. You means the individual or entity exercising the Licensed Rights
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.


Expand Down Expand Up @@ -182,13 +172,7 @@ Section 2 -- Scope.
Licensed Rights under the terms and conditions of this
Public License.

b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.

c. No downstream restrictions. You may not offer or impose
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Expand Down Expand Up @@ -270,24 +254,9 @@ following conditions.
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.

b. ShareAlike.

In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.

1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.

2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.

3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.


Section 4 -- Sui Generis Database Rights.
Expand All @@ -302,8 +271,7 @@ apply to Your use of the Licensed Material:
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
Rights (but not its individual contents) is Adapted Material; and

c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Examples of OPF files are available under the `examples` subfolder.

## JSON encoding

JSON files used throught this specification have the following restrictions on formatting and encoding.
JSON files used throughout this specification have the following restrictions on formatting and encoding.

1. JSON must use UTF-8 encoding
2. All strings defined in this spec (properties names, enums) use only ASCII charset and must be written as plain text.
Expand Down Expand Up @@ -80,7 +80,7 @@ An example of a hypothetical `PIX4D_spatial_ref_sys` extension of [geo-referenci
As per convention, the extension schema should allow additional properties to allow future extensibility of the extension.

Where an extension is meant to share data between teams or with a third party, its format should be specified and documented.
The specification of the extenstion should be documented under the "/extensions/<extension name>/" folder.
The specification of the extension should be documented under the "/extensions/<extension name>/" folder.

### Naming

Expand All @@ -94,20 +94,20 @@ Names MUST use lowercase snake-case following the prefix, e.g. `OPF_some_extensi

[JSON schema](https://json-schema.org/) is the source of truth regarding conformance with the specification, with the caveat that not all the semantics in the specification can be captured in a schema. The schemas are located in the `schema` directory.

Note that by convention schemas of this specification always allow additional properties, this is required to suppport forward compatibility of the format. Such additionnal properties are strictly reserved for future version of the specification and shall not be used for the purpose of extensions. Extensions of the specification are provided through the [extensions mechanism](#extensions) exclusively.
Note that by convention schemas of this specification always allow additional properties, this is required to support forward compatibility of the format. Such additional properties are strictly reserved for future version of the specification and shall not be used for the purpose of extensions. Extensions of the specification are provided through the [extensions mechanism](#extensions) exclusively.

### Custom extensions to JSON schema

In some instances we have slightly extended the JSON schema vocabularies in order to add additional data that may be used to further validate a compliance with the specification.
These extensions are described below:

- New properties in project.schema.json : `required_resources_per_item_type`, `optional_resources_per_item_type`, `required_sources_per_item_type` and `optional_sources_per_item_type` dictionnaries describe which _resources_ and which _sources_ are required and optional for a given item type.
- New properties in project.schema.json : `required_resources_per_item_type`, `optional_resources_per_item_type`, `required_sources_per_item_type` and `optional_sources_per_item_type` dictionaries describe which _resources_ and which _sources_ are required and optional for a given item type.

In addition, in the spirit of forward compatibility, we relax the requirement of JSON schemas with respect to the `enum` keyword, which we redefine as an open-ended list of values for the purpose of this specification.

## Existing Tooling

- PIX4Dmatic: import and export (commercial, free for visualisation, since v1.46)
- PIX4Dmatic: import and export (commercial, free for visualization, since v1.46)
- [Python](https://github.com/Pix4D/pyopf)

## Citation
Expand All @@ -118,9 +118,9 @@ If you use the OPF specification in your research or projects, we kindly request

## License

Copyright (c) 2023 Pix4D SA
Copyright (c) 2023-2024 Pix4D SA

This specification and all the associated files, including but not limited to the markdown files, json schemas and any automatically generated HTML and PDF files are licensed under the Creative Commons Attribution 4.0 International License (CC BY-SA 4.0).
This specification and all the associated files, including but not limited to the markdown files, json schemas and any automatically generated HTML and PDF files are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

All scripts and/or code contained in this repository are licensed under Apache License 2.0.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
"nodeAttributes":{
"parent":12
},
"nodeCoordinates":9,
"nodeIndices":9,
"nodeLevelIndexing":[
0,
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"nodeLevelIndexing": {
"type": "array",
"description": "The indexing of octree node levels. For a level `l`, the range `[nodeLevelIndexing[l], nodeIndexing[l] + 1, ..., nodeIndexing[l + 1] - 1]` corresponds to the indices of all nodes belonging to this level. The size of this array **MUST** match the number of levels plus one",
"description": "The indexing of octree node levels. For a level `l`, the range `[nodeLevelIndexing[l], nodeLevelIndexing[l] + 1, ..., nodeLevelIndexing[l + 1] - 1]` corresponds to the indices of all nodes belonging to this level. The size of this array **MUST** match the number of levels plus one",
"items": {
"type": "integer"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import argparse
import json
import sys
from pathlib import Path


def patch_gltf(gltf_path):
extension_to_patch = "OPF_mesh_primitive_partitioning"
bad_key = "nodeCoordinates"
good_key = "nodeIndices"
gltf_obj = json.load(open(gltf_path, "r"))

for mesh in gltf_obj.get("meshes", []):
for primitive in mesh.get("primitives", []):
ext_obj = primitive.get("extensions", {}).get(extension_to_patch)
if ext_obj is None:
continue
if bad_key in ext_obj:
ext_obj[good_key] = ext_obj.get(bad_key)
del ext_obj[bad_key]

return gltf_obj


def gltf_point_cloud_uris(opf_obj):
for item in opf_obj.get("items", []):
if item["type"] in ["calibration", "point_cloud"]:
for resource in item.get("resources", []):
if resource["format"] != "model/gltf+json":
continue
yield resource["uri"]


parser = argparse.ArgumentParser(
description="Patch OPF project with invalid OPF_mesh_primitive_partitioning extension"
)
parser.add_argument("opf_path", type=str, help="path to the opf project to patch")
args = parser.parse_args()

opf_obj = json.load(open(args.opf_path, "r"))
for gltf_uri in gltf_point_cloud_uris(opf_obj):
gltf_path = Path(args.opf_path).parent / gltf_uri
gltf_obj = patch_gltf(gltf_path)
json.dump(gltf_obj, open(gltf_path, "w"), indent=2)
Loading

0 comments on commit 57a736f

Please sign in to comment.