English 中文(简体)
开放式地图
原标题:OpenCV cvRemap Cropping Image

So I am very new to OpenCV (2.1), so please keep that in mind.

因此,我设法校准我使用的廉价网络照相机(wide angle查封),使用校对校准方法得出内在和扭曲的系数。

I then have no trouble feeding these values back in and producing image maps, which I then apply to a video feed to correct the incoming images.

I run into an issue however. I know when it is warping/correcting the image, it creates several skewed sections, and then formats the image to crop out any black areas. My question then is can I view the complete warped image, including some regions that have black areas? Below is an example of the black regions with skewed sections I was trying to convey if my terminology was off:

An image better conveying the regions I am talking about can be found here! This image was discovered in this post.

Currently: The cvRemap() returns basically the yellow box in the image linked above, but I want to see the whole image as there is relevant data I am looking to get out of it.

www.un.org/Depts/DGACM/index_spanish.htm 我曾尝试过:。 将比例转换到图像图,以适应完整的形象(包括扩展部分)

        CvMat *intrinsic = (CvMat*)cvLoad( "Intrinsics.xml" );
        CvMat *distortion = (CvMat*)cvLoad( "Distortion.xml" );

        cvInitUndistortMap( intrinsic, distortion, mapx, mapy );

        cvConvertScale(mapx, mapx, 1.25, -shift_x);   // Some sort of scale conversion
        cvConvertScale(mapy, mapy, 1.25, -shift_y);   // applied to the image map

        cvRemap(distorted,undistorted,mapx,mapy);

我认为,当我正确调整了X/y的转变(gues/检查)时,这种变数就是对图象的曲解,使更正无用。 这里可能有一些数项内容,但我并没有正确理解/理解。

是否有任何其他建议解决这一问题,或我可能做什么错? 我也试图撰写我自己的法典,以纠正歪曲的问题,但我要说的是,开放世界委员会已经知道如何这样做。

最佳回答

From memory, you need to use InitUndistortRectifyMap(cameraMatrix,distCoeffs,R,newCameraMatrix,map1,map2), of which InitUndistortMap is a simplified version.

cvInitUndistortMap( intrinsic, distort, map1, map2 )

相当于:

cvInitUndistortRectifyMap( intrinsic, distort, Identity matrix, intrinsic, 
                           map1, map2 )

新参数为<代码>R和newCameraMatrix。 <代码>R 物种为进行额外的转变(例如轮值)(将其归入身份矩阵)。

您感兴趣的参数是newCameraMatrix/code>。 在<代码>内 页: 1 这与最初的照相矩阵相同,但你可以利用这一基调使你再次谈论。

http://opencv.willowgarage.com/documentation/camera_calibration_and_3d_reruction.html#getoptimalnewcameramatrix” rel=“nofollow”GetOptimal NewCameraMatrix(cameraMat, DistCoeffs,α,...)。 您基本上在<代码>intrinsicdistort、您的原始形象大小和参数alpha/code>(此外还有集装箱持有结果矩阵,见文件)。 参数<代码>alpha/code>将实现你想要的东西。

我引用文件:

The function computes the optimal new camera matrix based on the free scaling parameter. By varying this parameter the user may retrieve only sensible pixels alpha=0, keep all the original image pixels if there is valuable information in the corners alpha=1, or get something in between. When alpha>0, the undistortion result will likely have some black pixels corresponding to “virtual” pixels outside of the captured distorted image. The original camera matrix, distortion coefficients, the computed new camera matrix and the newImageSize should be passed to InitUndistortRectifyMap to produce the maps for Remap.

举例来说,所有显示你希望的黑色比照(alpha=1

In summary:

  • call cvGetOptimalNewCameraMatrix with alpha=1 to obtain newCameraMatrix.
  • use cvInitUndistortRectifymap with R being identity matrix and newCameraMatrix set to the one you just calculated
  • feed the new maps into cvRemap.
问题回答

暂无回答




相关问题
Python/OpenCV: Converting images taken from capture

I m trying to convert images taken from a capture (webcam) and do some processing on them with OpenCV, but I m having a difficult time.. When trying to convert the image to grayscale, the program ...

How to smooth a histogram?

I want to smooth a histogram. Therefore I tried to smooth the internal matrix of cvHistogram. typedef struct CvHistogram { int type; CvArr* bins; float thresh[CV_MAX_DIM][2]; /* ...

Testing complex datatypes?

What s are some ways of testing complex data types such as video, images, music, etc. I m using TDD and wonder are there alternatives to "gold file" testing for rendering algorithms. I understand that ...

Displaying OpenCV iplimage data structures with wxPython

Here is my current code (language is Python): newFrameImage = cv.QueryFrame(webcam) newFrameImageFile = cv.SaveImage("temp.jpg",newFrameImage) wxImage = wx.Image("temp.jpg", wx.BITMAP_TYPE_ANY)....

What is the memory structure of OpenCV s cvMat?

Imagine I have the following: CvMat* mat = cvCreateMat(3,3,CV_16SC3) This is a 3x3 matrix of integers of channel 3. Now if you look at OpenCV documentation you will find the following as the ...

Face detection and comparison

I m running a small research on face detection and comparison for my article. Currently, I m using rapid face detection based on haar like features based on OpenCV cascade (I ll implement learning ...