perspectivecamera

three.js rotate camera in plane

风格不统一 提交于 2019-12-04 10:37:49
I have a camera in my app: camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); camera.position.z = 1; camera.position.y = -5; camera.rotateOnAxis(new THREE.Vector3(1, 0, 0), degInRad(90)); camera.up = new THREE.Vector3(0, 0, 1); Those code in render function must rotate the camera while I'm pressing the keys: if (leftPressed) { camera.rotateOnAxis((new THREE.Vector3(0, 1, 0)).normalize(), degInRad(1)); } else if (rightPressed) { camera.rotateOnAxis((new THREE.Vector3(0, 1, 0)).normalize(), degInRad(-1)); } if (upPressed) { camera.rotateOnAxis((new

cv::warpPerspective only shows part of warped image

落爺英雄遲暮 提交于 2019-12-04 08:23:08
问题 Im changing an image from front perspective to a bids eye view by using getHomography and warpPerspective. It works in that the image warps to the desired perspective but the crop is off. It moves the warped image largely outside the image box. I assume the reason is because the operation results in negative coordinates. I have calculated the points for calculation of the translation matrix manually and not by using any of opencv:s functions for doing that since i.e. the chessboard functions

How to compute the size of the rectangle that is visible to the camera at a given coordinate? [duplicate]

岁酱吖の 提交于 2019-12-03 16:15:25
This question already has an answer here: Three.js - Width of view 1 answer I made a small three.js app that moves a bunch of circles from the bottom of the canvas to the top: let renderer, scene, light, circles, camera; initialize(); animate(); function initialize() { renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true }); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); scene = new THREE.Scene(); light = new THREE.AmbientLight(); scene.add(light); circles = new THREE.Group(); scene.add(circles); camera = new THREE

OpenCV: use solvePnP to determine homography

非 Y 不嫁゛ 提交于 2019-12-03 15:54:36
Over the past weeks I've tried learning to rectify images and with the help of the people here I've managed to understand it better. About a week ago I set up a test example which I wanted to rectify (view the image from above). This worked fine (original: http://sitedezign.net/original.jpg and rectified: http://sitedezign.net/rectified.jpg ) with the function T = cv2.getPerspectiveTransform(UV_cp, XYZ_gcp) where T becomes the Homography. When I tried to do this with real world photos it failed because the realworld coordinates aren't perfectly on a plane (but simply around 10 control points

Python - Perspective transform for OpenCV from a rotation angle

别来无恙 提交于 2019-12-03 13:14:07
I'm working on depth map with OpenCV . I can obtain it but it is reconstructed from the left camera origin and there is a little tilt of this latter and as you can see on the figure, the depth is "shifted" (the depth should be close and no horizontal gradient): I would like to express it as with a zero angle, i try with the warp perspective function as you can see below but i obtain a null field... P = np.dot(cam,np.dot(Transl,np.dot(Rot,A1))) dst = cv2.warpPerspective(depth, P, (2048, 2048)) with : #Projection 2D -> 3D matrix A1 = np.zeros((4,3)) A1[0,0] = 1 A1[0,2] = -1024 A1[1,1] = 1 A1[1,2

Setting up a 2D view in Three.js

老子叫甜甜 提交于 2019-12-03 07:28:13
问题 I'm new to three.js and am trying to set up what amounts to a 2D visualization (for an assortment of layered sprites) using these 3D tools. I'd like some guidance on the PerspectiveCamera() arguments and camera.position.set() arguments. I already have a nudge in the right direction from this answer to a related question, which said to set the z coordinate equal to 0 in camera.position.set(x,y,z) . Below is the snippet of code I'm modifying from one of stemkoski's three.js examples. The parts

cv::warpPerspective only shows part of warped image

旧城冷巷雨未停 提交于 2019-12-02 21:28:45
Im changing an image from front perspective to a bids eye view by using getHomography and warpPerspective. It works in that the image warps to the desired perspective but the crop is off. It moves the warped image largely outside the image box. I assume the reason is because the operation results in negative coordinates. I have calculated the points for calculation of the translation matrix manually and not by using any of opencv:s functions for doing that since i.e. the chessboard functions failed to detect the proper points. I guess this can be fixed by doing additional changes to the

The coordinate system of pinhole camera model

风格不统一 提交于 2019-12-02 19:45:44
Recently, I have been studying the pinhole camera model, but I was confused with the model provided by OpenCV and the " Multiple View geometry in computer vision " textbook. I know that the following photo is a simplified model which switch the position of the image plane and the camera frame. For better illustration and understanding, and taking consideration of the principal point (u0,v0), the relation between two frames is x=f(X/Z)+u0 and y=f(Y/Z)+v0 . However,I was really confused because normally the image coordinate is in the form of the 4th quadrant coordinate as the following one!

perspective Image Stitching

倖福魔咒の 提交于 2019-12-01 14:28:43
I found very useful example from images stitching but my problem was those type of images here is an exemple and here is an other image when i use opencv stitcher the reult imaages is getting smaller like this one is there any method to apply a transform into the input images so they will be like this one here is the code #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include<opencv2/opencv.hpp> #include <opencv2/features2d/features2d.hpp> #include <opencv2/nonfree/nonfree.hpp> #include <opencv2/stitching/stitcher.hpp> #include<vector> using namespace cv; using

How to switch between Perspective and Orthographic cameras keeping size of desired object

谁都会走 提交于 2019-12-01 11:50:56
问题 I try to switch between Perspective and Orthographic cameras in my script. I want object on some depth to keep it's projection size. I gave up to understand the geometry... Could you provide some link to a simple tutorial this is too complicated for me. For object with position.z==0 i have: perspCamera = new THREE.PerspectiveCamera(45, W / H, 1, 1000); perspCamera.position.z = 100; var S=Math.tan((45/180)*Math.PI)*100; orthoCamera = new THREE.OrthographicCamera( -S, S, S, -S, 1, 1000 ); It is