Skip to content

[Interactive Camera] How to get the image data? #3797

Discussion options

You must be logged in to vote

Not really, as I dont really use python3.
I tried the other scene using pygame (in the same directory) and it seems to work/display something.
So if you modify a little bit the script, you can get for example the depth buffer
Here is a quick&dirty update of the pygame_example.py
It will save the pixels of the depth buffer on the disk.

import Sofa
import Sofa.SofaGL
import SofaRuntime
import Sofa.Simulation as sim
import os
import time
sofa_directory = os.environ['SOFA_ROOT']
import pygame
from OpenGL.GL import *
from OpenGL.GLU import *
import numpy as np
from PIL import Image

display_size = (800, 600)


def init_display(node):
    pygame.display.init()
    pygame.display.set_mode(displa…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@MingshanHe
Comment options

@fredroy
Comment options

Answer selected by hugtalbot
@MingshanHe
Comment options

@yang-si-hang
Comment options

@spbnb
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants