The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.
Become a Premium Member and unlock a new, free course in leading technologies each month.
/// 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;
}
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
///
/// 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();
}
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.