Right, I am trying to create a method for a homography warp. Problem is, I suck at linear algebra (actually, didn't do so bad, but it's been several years since I've taken it). And there's no book for this course.

Could anyone out there give me the idiot's version of how to implement this?

Thanks,
Ryan

/// Creates a new image that is width x height pixels./// The pixels of this image are set by applying the inverse homography (provided can be either////// @param source Image to inverse warp/// @param H Homography matrix/// @param width Width of image to create/// @param height Height of image to create/// @returns A width x height sub-region of warped source image///PImage homographyWarp(PImage source, Matrix H, int width, int height) { // // @todo // Inverse warp source to get the pixel values for the new image // Don't forget to divide the image coordinates with w (the 3rd coordinate) when you convert // the homogeneous coordinates back to image coordinates // Also, be sure to use bilinear (or some other) interpolation to get a smooth result. // // @note // Remember that accessing a negative index'd pixel, or a pixel outside of the image will // return a black pixel. This means you do not have to worry about the size of the image. // PImage result = createImage(width, height, RGB); return result;}

The slides from 59-73 really seem to give all the needed information. Which parts are you stuck on specifically? Slide 73 gives all the equations you need to get the 3D coordinates (with trig too, not

Let's say you have an image taken by a camera at a certain point. Now you want to move everything so that it looks like it was taken from a different location. You can't just shift everything evenly - some things will be closer together in the second image and some will be farther apart. The process of 'changing camera angles' after the fact is what is being called homography. If you look really closely past all the technical mumbo-jumbo you can see that wikipedia is saying the same thing, just in a longer winded way.
In the general case, you would need the 3D coordinates of the objects in the image so that you know where to put them all. The homography matrix is the transformation matrix that specifies how everything must rotate.

http://opencv.willowgarage.com/documentation/camera_calibration_and_3d_reconstruction.html#findhomography
OpenCV (which I use) has a routine to find the homography matrix between two images, but it appears you are trying to find the second image given the matrix.
Note: there are several known methods for doing this. I assume (from the way the comments make it look like an academic assignment) that you were given methods in your book or in class that you should use.
If you remember anything from linear algebra, try to remember transformation matrices. That's all this is really.
The simplest (but somewhat technical) definition is that homographic warping is just changing the coordinates of a 3D space and projecting it onto a 2D space.

0

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I think your problem is that you are trying to make the problem harder than it really is. You already have the homography matrix, so you shouldn't need to explicitly mess with a 3D space at all. I don't know what you are expected to know at this point, but if you step back and review your lecture notes and book if you have them, you should see the answer fall out. It's just going to be a good deal of matrix algebra.
Work on it for a bit, but if you get stuck, give some more detail and context and I'll see if I can shed some light on the darker areas.

Well, yeah. It's for another part, which I am working on, and just not getting.

I am just not understanding how we can calculate 3D points from a 2D image + focal length and a vanishing point.

I've browsed around looking for information at other universities, and they are all using the same slides as my instructor. I can't find a single rephrasing of the equations I am supposed to use, or the knowledge I am supposed to be sporting, because they are quite literally reusing the same exact slides.

It's incredibly frustrating, and my usual solution is to read someone else's take on an algorithm if the primary instructor is unclear, but of the few dozen university that I've found on Google, the slides are the same, and there is zero elaboration of the algorithms they use.

////// Sets the 4 points of each of the 5 'Rectangle3D' objects.////// @todo Set nw, ne, se, sw for each retangle////// @param focalLength Focal length for image/// @param vanishingPoint 2D image location of vanishing point/// @param Quadrilaterals 5 quadrilaterals, one for each visible wall in the image/// @param Rectangle3Ds 5 3D rectangle objects////// @post The 5 Rectangle3D objects have had their points updated///void get3DPlanes(float focalLength, Point vanishingPoint, Quadrilateral back, Quadrilateral left, Quadrilateral top, Quadrilateral right, Quadrilateral bottom, Rectangle3D back3D, Rectangle3D left3D, Rectangle3D top3D, Rectangle3D right3D, Rectangle3D bottom3D) { // // @todo // 1. The width and height ratio of the back plane directly tells you the aspect // ratio of the box, so specifying the 3D height gives you the 3D width. // 2. The back plane's height is related to the depth of the box // (see lecture slide: Depth of Box), so specifying the 3D height gives you the 3D depth // 3. Once you compute the 3D width, height, and depth of the box, you can compute the 3D // coordinates of all corners points of the 5 surfaces (you may set the origin to be the // top left corner of the wall surface, 3D X axis aligned to the horizontal axis of the // image, the 3D Y axis aligned to the vertical axis, and the 3D Z axis aligned to the // depth axis of the box). // 4. Store the 3D coordinates for each surface in the corresponding Rectangle object // // @note When you compute these 3D coordinates, don't forget to account for the fact that the // surfaces are not exactly aligned with the box (see the image displayed before calculation // and notice that the front end of the surfaces are not aligned). // You need to adjust the depth coordinates of front points of each surface accordingly // using the 2D image coordinates to get proper results. // // Also, first compute the 3D coordinates for the back plane since those can be reused in // other surfaces. // Point3D Backplane_NW = new Point3D(); Point3D Backplane_NE = new Point3D(); Point3D Backplane_SE = new Point3D(); Point3D Backplane_SW = new Point3D();}

The focal length and vanishing point should translate to a third dimension easily with some basic trig (assuming you have a simple enough image, hot air balloons of varying sizes in the middle of a blue sky would be basically impossible to get a depth on).

Can you link to the slides you mention? I am usually able to find better ways of explaining things.

And, if at all possible, I'd like to understand this stuff tonight (project comes due at midnight, so the sooner, the better). No pressure ^_^.

Normally, this stuff isn't an issue, but like I said, it's been several years since I've done any linear algebra, and I am unlikely to relearn everything in the next three hours.

The slides from 59-73 really seem to give all the needed information. Which parts are you stuck on specifically? Slide 73 gives all the equations you need to get the 3D coordinates (with trig too, not linear algebra).
My guess is that you hit a brain block because you were trying to figure it out too fast since it was due last night (assuming you are in eastern time as it says in the original post).

0

Featured Post

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Okay. So what exactly is the problem here?
How often have we come across situations where we need to know if two strings are 'similar' but not necessarily the same? I have, plenty of times. Until recently, I thought any functionality like that wo…

Introduction
Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…

Viewers will learn about the different types of variables in Java and how to declare them.
Decide the type of variable desired:
Put the keyword corresponding to the type of variable in front of the variable name:
Use the equal sign to assign a v…

This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.