本文介绍了如何计算来自计算机视觉相机的像素的水平角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序需要计算120度水平视野的计算机视觉相机的像素角度,以及640像素宽和480像素高的分辨率。

程序接收来自相机的每个图像帧的X,Y像素阵列。
对于最左边的像素,X将为0,角度为-60度。
对于最右边的像素,X将是639和角度60度。
对于中心像素,X将是320并且角度为0。

当(X> 0和 320)和< 640)?

解决方案
  //伪代码。 

//以FOV为单位计算焦距(以像素为单位)b $ b double f =(0.5 * image_width)/ tan(0.5 * fov_radians);

//向量从光学中心对准图像中心和像素
//在相机坐标中。
Vector3D center(0,0,f),pixel(x - center_x,y - center_y,f);

//矢量(0,0,f)和像素之间的夹角
双圆点= dot_product(中心,像素)
双alpha = acos(点/(中心长度()* pixel.length()));


My program needs to compute the angle of a pixel from a computer vision camera that has 120 degrees horizontal field of view, and resolution of 640 pixels wide and 480 pixels high.

Program receives an X,Y array of pixels for each image frame from camera.For left-most pixel, X would be 0 and angle would be -60 degrees.For right-most pixel, X would be 639 and angle 60 degrees.For center pixel, X would be 320 and angle 0.

How is angle computed when (X is > 0 and < 320) and (>320 and <640)?

解决方案
// In pseudocode.

// Compute focal length in pixels from FOV
double f = (0.5 * image_width) / tan(0.5 * fov_radians);

// Vectors subtending image center and pixel from optical center
// in camera coordinates.
Vector3D center(0, 0, f), pixel(x - center_x, y - center_y, f);

// angle between vector (0, 0, f) and pixel
double dot = dot_product(center, pixel)
double alpha = acos(dot / (center.length() * pixel.length()));

这篇关于如何计算来自计算机视觉相机的像素的水平角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 20:52