Ask Your Question

How can I compare an ideal projection with a real projection?

asked 2016-04-12 14:41:06 -0500

mvc gravatar image


I'm trying to evaluate the accuracy of a projector. I mean, I want to compare an image with the ideal projection with an image with the real projection.

What procedure should I follow using OpenCv? Have you got some suggestions?

Thank you in advance! :)

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2016-04-12 21:42:52 -0500

Tetragramm gravatar image

updated 2016-04-14 20:39:24 -0500

Well, a few ways to do it. I think the structured light module might actually be the easiest. That will help you determine any deformations with the surface, and maybe projector distortion.

The other way would be to calibrate a camera, use the projector to display a chessboard in different positions. Undistort the image using the camera calibration, then warp the corners of the projection into an appropriately sized frame. Then treat that as the image from a theoretical camera at the projector location. I'm not sure whether you would need to reverse the distortion into the projector or not, but it shouldn't be hard to try.


So, thinking about this, there are actually three separate problems.

  1. The Surface is not flat. - Use Structured Light
  2. The Projector lens has distortion - Use Camera Calibration in reverse.
  3. The Projector is not projecting square - Use Homography

You can probably safely ignore the first unless you're trying to project on a round building or something.

For the second the procedure is as follows:

  • Project a chessboard on the wall with a calibrated camera viewing it.
  • Undistort captured images according to camera calibration.
  • Find corners of projected image and warp into a (X by Y) projector resolution image so the corners are the corners of the image.
  • Use that to run a normal camera calibration

For the third, it's pretty simple.

  • Pick the shape the projection should look like in aspect ratio. (IE: Find the corners of the projection screen)
  • Display a totally white image and find the corners.
  • Find the largest rectangle of screen aspect ratio that fits within the white. OR within the screen, if the projection is bigger than the display screen.

EDIT #2:

How to adjust the shape of the projection to make it square.

I'm assuming you have moved the projector into the best position you can manage, and already adjusted the keystone to get it as close as possible to correct. But now you need to project some pattern in a uniform manner but the image isn't uniform.

The first step is to get your calibrated camera (since every little bit helps) and take a picture. I'm going to fake the photos in GIMP, it's quicker and you'll get the idea.

image description

Then you need to get your tape measure and measure the projection screen. You need to do this to be sure of the aspect ratio so you can warp it as if you were facing it directly on. Measure it in the X and Y directions. Take your undistorted image and pick the corners of your screen (or surface) and warp them to a Mat of the same aspect ratio of the screen, which I'll call ScreenMat. It should be a larger resolution than your projection.

image description
(See that? That's why you calibrate your camera and undistort first. Your lines should be straight, not bent, I think. If they aren't, you will need do a Camera ...

edit flag offensive delete link more


I think I'm gonna apply the second choice. That's what I've been thinking about. But my doubts are:

1 - What techniques should I apply to measure the projection errors?

2 - Should I change the pose of the camera to acquire some images of the projected chessboard?

3 - That procedure is the projector calibration?

mvc gravatar imagemvc ( 2016-04-13 05:30:44 -0500 )edit

Actually I guess structered light will give you an idea on how the background you are projecting on is deformed, but much less about the actual projecting error. I think projecting a pattern in both cases and then calculating the deformation homography between both, will yield way more interesting results.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-04-13 06:36:54 -0500 )edit

@Tetragramm, can you explain me better in what consist the step 3 in the second approach?

I also can't understand the third approach. Can you explain it to me in a deep way? Showing images or something... I'm new in this issues and I really have difficulties understanding this...

mvc gravatar imagemvc ( 2016-04-13 09:31:34 -0500 )edit

@Tetragramm Thank you a lot for your answer, it has clarified much my ideas, although I still have some doubts!

mvc gravatar imagemvc ( 2016-04-13 09:35:38 -0500 )edit

@StevenPuttemans thank's for your answer :)

How can I calculate the homography between both? I will get the image captured by the camera, but is it correct to compare it with the image projected by the projector? What do I need to take into account? What distances, and things like that...

mvc gravatar imagemvc ( 2016-04-13 09:44:43 -0500 )edit

@Tetragramm thank you so much!

I think I've understood everything. Just to be sure, the function in the link is findHomography, right? I see a lot of functions there. Also, the images you've posted and the explanations are for the the step 3 in the second approach, right? Thank you so much!

mvc gravatar imagemvc ( 2016-04-15 06:26:34 -0500 )edit

Yes, the function is findHomography. I thought I grabbed the direct link.

This is the third approach. You do almost exactly the same thing for the third step in the second approach. Create a Mat with the resolution of your projector, find the homography between the corners of the projection (not the screen) and the corners of the Mat. Warp the image into the buffer using the homography.

Tetragramm gravatar imageTetragramm ( 2016-04-15 06:58:09 -0500 )edit

Thank you, I got it! :)

Besides this, I'd like to apply more techniques to detect projection errors and interpret distortion coefficients and intrinsic parameters, and also understand their influence on projector accuracy.

Can you give me some advice? :) Do you have some knowledge on how to do it?

mvc gravatar imagemvc ( 2016-04-15 08:16:12 -0500 )edit

If the projector is projecting square, do I need the third step in the second approach?

mvc gravatar imagemvc ( 2016-04-15 09:13:20 -0500 )edit

What's the goal of making the third step in the second approach? I'm not understanding... Sorry for asking so much!

mvc gravatar imagemvc ( 2016-04-15 14:53:18 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-04-12 14:41:06 -0500

Seen: 126 times

Last updated: Apr 14 '16