How to use Camera Views to simulate a real camera

14 visualizaciones (últimos 30 días)
Fabio
Fabio el 12 de En. de 2015
Comentada: Mike Garrity el 13 de En. de 2015
Hello,
I am trying to use Camera Views functions (e.g. campos, camva, etc.) to simulate a real viewing camera, but when I change the parameters it seems not to behave as expected.
For example:
- when I position the camera using campos(), the camera doesn't look like exactly in that position. It looks a bit further.
- when I change the camera view angle with camva(), it looks like a zoom rather than a variation in the camera view angle.
- when I set camtarget() after campos(), the camera position changes and the plot shrinks. Whereas I would only like to keep the camera in the same position, but point it to view another location.
The code I am using is rather simple. It is a dummy code to understand the behaviour of the commands.
surf(peaks);
xlabel('x')
ylabel('y')
zlabel('z')
campos([70 50 15])
camtarget([5 45 0])
Is there anyone with some experience with this functions? How can I simulate a real camera using Camera Views commands?
Thanks,
Fabio

Respuestas (2)

Mike Garrity
Mike Garrity el 12 de En. de 2015
Editada: Mike Garrity el 12 de En. de 2015
You need to set the Projection to perspective.
set(gca,'Projection','perspective')
The default is orthographic, which is kind of like an infinitely long telephoto lens.
As you can see, the default CameraViewAngle is awfully wide in this case.
Turning it down to something like 35 looks a lot better.
camva(35)

Fabio
Fabio el 13 de En. de 2015
Thanks Mike for your reply. I figured a few new things out with your hint.
One additional thing.
Lets say that instead of having a function to view (like that of the example above) I have an object with a certain texturing. If I fix a camera position with a wide angle of view I will be able to see the whole object at a certain resolution (some details of it). If I narrow down the angle of view I am expecting to see a smaller portion of the object and the same resolution of the previous (wide) case. So, if I weren't able to see some details in the wide case, I'd not able to see them in the narrow case.
When I use the command camva() it looks like that when the view narrows down the resolution increases as well and I can see more details of the viewed object.
Is this behaviour something expected or am I completely wrong?
Thanks
  1 comentario
Mike Garrity
Mike Garrity el 13 de En. de 2015
I'm not sure I follow.
The camera's viewport is rasterized to a fixed number of pixels. As you decrease the view angle, that viewport covers a smaller area in the model. Therefore, the resolution at which the model is rasterized increases.
But if you have a texturemap on the model, then the number of texels isn't going to be affected by the camera view angle.
I'd probably need to know more about your case to give a sensible answer.

Iniciar sesión para comentar.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by