Nodes/ComfyUI-3D-MeshTool/json to camposes
ComfyUI Node

json to camposes

Feed your multi-view dataset's camera JSON straight into the graph

By 807502278·Created 2 years ago·Updated 2 years ago· 23
json to camposes
    • rotation
    • translation
    • coordinates
    • Image
    json_campos_dir
    to_angletrue

    Multi-view 3D datasets - the kind you get from capture rigs, photogrammetry tools, or packaged benchmarks - almost always ship as a folder of images plus a JSON describing where each shot was taken. json to camposes (from ComfyUI-3D-MeshTool) is the node that swallows that JSON and turns it into the camera tensors this pack and ComfyUI-3D-Pack actually understand, loading the image batch along the way.

    If you've been manually exporting camera angles or hardcoding orbit paths, this is the node that makes a real dataset flow end-to-end. It's the natural front end for img-bath-rotationZ and RT-to-camposes.

    How it works

    It reads a GeoJSON-style file with a top-level features array. Each feature carries:

    • properties.translation - camera position
    • properties.rotation - camera orientation
    • properties.filename - the image for that view
    • geometry.coordinates - a position/coordinate triple

    It walks the features, stacks the values into rotation, translation, and coordinates tensors, and loads every referenced image into one batch. The to_angle toggle (default on) converts rotation from radians to degrees by multiplying by 57.2958 - 3D-Pack's camera math works in degrees, and most capture tools write radians, so this toggle is what keeps your angles from being off by a factor of ~57.

    It also sanity-checks that the images actually exist. Paths are resolved relative to the JSON file's own directory. If some images are missing it prints a warning and drops those pose entries from all tensors - a nice touch that keeps your counts consistent instead of crashing downstream.

    The four outputs

    • rotation, translation, coordinates - Tensors, one row per valid view
    • Image - the batched IMAGE, in the same order

    Wire rotation into RT-to-camposes or img-bath-rotationZ, and Image into whatever consumes the frames. Because the node drops missing-image rows, the rotation count and the image batch stay matched.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/807502278/ComfyUI-3D-MeshTool
    cd ComfyUI-3D-MeshTool
    pip install -r requirements.txt
    

    Restart ComfyUI (or install via ComfyUI Manager, search "ComfyUI-3D-MeshTool"). No model downloads.

    Common issues

    The node prints "The JSON data is not valid" if parsing fails but doesn't raise - the error is just a console line, so the first thing to check when you get empty or weird output is whether your file parses at all. It also expects the exact key names above (properties.translation, geometry.coordinates, etc.). If your dataset uses different keys (some tools name translation position or rotation as a full matrix), this node won't understand it - pre-convert to the expected shape first. And a features key is mandatory; a bare list of poses won't work.

    Category3D_MeshTool/Camera

    Inputs (2)

    NameTypeDefaultDescription
    json_campos_dirSTRING
    to_angleBOOLEANtrue

    Outputs (4)

    NameTypeDescription
    rotationTensor
    translationTensor
    coordinatesTensor
    ImageIMAGE