A computer-implemented method for ordering vertices in an image frame within a data stream, wherein the image frame corresponds to Earth-viewing data. A point of intersection of a primary pair of lines is determined and loaded into computer memory, and interrogated as to a sign of a signed remainder with respect to each of two secondary lines defined by the pairwise ordered sets of vertices. In the case of opposite remainder sign with respect to the two secondary lines, two provisional indices are swapped to obtain a rectified index for each of the four vertices. The process is repeated with respect to the signed remainder of the intersection point of the secondary lines relative to the primary lines. The four vertices are then fit, in accordance with index ordering, into a tiling of the surface of the Earth based on the rectified index of each of the four vertices.
|
1. A computer-implemented method for ordering vertices in a stream of image frames encapsulating Earth-viewing data, the computer-implemented method comprising:
a. receiving, in the stream of image frames, an image frame including four vertices of a terrestrial area, acquired by an optical sensor at an image plane of a remote sensing camera;
b. assigning a provisional index to each of the four vertices;
c. establishing a first point of intersection of two primary lines defined by pairwise ordered sets of vertices;
d. loading the first point of intersection into computer memory;
e. interrogating the first point of intersection as to a sign of a signed remainder with respect to each of two secondary lines defined by the pairwise ordered sets of vertices;
f. in the case of opposite remainder sign with respect to the two secondary lines, swapping a first and a second of the provisional indices to obtain a rectified index for each of the four vertices;
g. establishing a second point of intersection of primary the two secondary linesdefined by the pairwise ordered sets of vertices;
h. loading the second point of intersection into computer memory;
i. interrogating the second point of intersection as to a sign of a signed remainder with respect to each of the two primary lines defined by the pairwise ordered sets of vertices;
j. in the case of opposite remainder sign with respect to the two primary lines, swapping a second and a third of the provisional indices to obtain a rectified index for each of the four vertices, and otherwise using the provisional index of each of the four vertices as the rectified index of each of the four vertices; and
k. fitting the four vertices into a tiling of the surface of the Earth based on the rectified indices of each of the four vertices.
5. A computer program product for ordering vertices in a stream of image frames encapsulating Earth-viewing data, the computer program product comprising a non-transitory computer-readable medium on which are stored computer instructions such that, when executed by a processor, the instructions cause the processor to:
a. receive, in the stream of image frames, an image frame including four vertices of a terrestrial area, acquired by an optical sensor at an image plane of a remote sensing camera;
b. assign a provisional index to each of the four vertices;
c. establish a first point of intersection of two primary lines defined by pairwise ordered sets of vertices;
d. load the first point of intersection into computer memory;
e. interrogate the first point of intersection as to a sign of a signed remainder with respect to each of two secondary lines defined by the pairwise ordered sets of vertices;
f. in the case of opposite remainder sign with respect to the two secondary lines, swap a first and a second of the provisional indices to obtain a rectified index for each of the four vertices;
g. establish a second point of intersection of primary the two secondary linesdefined by pairwise ordered sets of vertices;
h. load the second point of intersection into computer memory;
i. interrogate the second point of intersection as to a sign of a signed remainder with respect to each of the two primary lines defined by the pairwise ordered sets of vertices;
j. in the case of opposite remainder sign with respect to the two primary lines, swap a second and a third of the provisional indices to obtain a rectified index for each of the four vertices, and otherwise use the provisional index of each of the four vertices as the rectified index of each of the four vertices; and
k. fit the four vertices into a tiling of the surface of the Earth based on the rectified indices of each of the four vertices.
2. The method according to
3. The method according to
4. The method according to
6. The computer program product according to
7. The computer program product according to
8. The computer program product according to
|
Remainder=m*x+b−y=0.
Simultaneous solution of the Top line 301 and Bottom line 302 lines yields their common intersection point A, which is loaded into computer memory. The primary lines (as defined above) are tested first, in accordance with a preferred embodiment of the present invention. The coordinates (x, y) of the intersection point A are substituted into the equations of the remaining two lines (referred to as the “secondary” lines), Left line 303 and Right line 304. Mutatis mutandis, the intersection point B is loaded into computer memory, and subsequently substituted into the equations of top and bottom lines 301 and 302.
The term “Signed Remainder” is defined as the Remainder times the sign of the slope of a line, thus:
Signed Remainder=(m*x+b−y=0)×sgn(m),
where sgn(m) is the sign of m.
If intersection point A lies on line 303, then the Signed Remainder is zero, and intersection point A is on line 303. If intersection point A lies above the line 303, and the slope m is positive, the Signed Remainder is negative. Whether the Signed Remainder is positive or negative shall be referred to herein, and in any appended claims, as the “sign” of the Signed Remainder, or the “remainder sign.” Determining whether the sign of the signed remainder is positive or negative may be referred to herein as interrogating the point of intersection as to the sign of the remainder.
If intersection point A is below line 303, and the slope m is positive, the Signed Remainder is positive. If intersection point A is to the right of the line 303, and the slope is positive, the Signed Remainder is positive. If intersection point A is to the left of line 303, and the slope is positive, the Signed Remainder is negative. Thus, if the remainders of the two bounding lines 303 and 304 have opposite signs, the intersection point A lies inside the quadrilateral.
Otherwise, the intersection point A lies outside the quadrilateral. Opposite signs of the signed remainders for the two bounding lines 303 and 304 implies that two corner points 3 and 4 need to be swapped. If the top and bottom lines 301 and 302 intersect inside the quadrilateral 105, then either the corner points 1 and 3 (in
In cases where a bounding line is vertical (and its slope m is undefined), a distinct test is performed to determine whether the intersection of the corresponding primary (or secondary) line lies inside or outside quadrilateral 105.
The method that has been described is summarized in the flowchart shown in
If the primary lines are parallel (506), then the test of intersection of the primary lines is bypassed. If bTopBottom is true and if the intersection point A is inside the Left and Right lines, then the corner points lying on the Top or Bottom lines respectively (otherwise referred to herein as the “Top” points and the “Bottom” points) are swapped (507). Mutatis mutandis, if the intersection point B is inside the Top and Bottom lines, then the corner points lying on the Left or Right lines respectively (otherwise referred to herein as the “Left” points and the “Right” points) are swapped (509). Once the corner point indices have been rectified, the corresponding bounded images are fit (511) into an Earth surface tiling, using standard processing methods.
The remaining question is the determination of which points to swap. The selection is a matter of design choice. Typically, any swapping error is consistent over a range of values of viewing parameters.
Using an arbitrary point swap selection, along with the slope intersection method described above, may advantageously minimize calculations and the time required to swap the points and it has an inherent built-in check to see whether the bowtie of
Application of embodiments of the present invention in particular illustrative cases of initial vertex orderings is now described with reference to
Analogous analyses, based on the method described herein, leads to the conclusion that quadrilateral
The above described methods may be performed, and the above described systems may be implemented, by a computer system, including a processor, by executing appropriate instructions stored in a memory. A computer program product for rectifying images has been described with reference to a processor controlled by instructions stored in a memory. The memory may be random access memory (RAM), read-only memory (ROM), flash memory or any other memory, or combination thereof, suitable for storing control software or other instructions and data. Some of the functions performed by the transformation methods and apparatus have been described with reference to flowcharts and/or block diagrams. Those skilled in the art should readily appreciate that functions, operations, decisions, etc. of all or a portion of each block, or a combination of blocks, of the flowcharts or block diagrams may be implemented as computer program instructions, software, hardware, firmware or combinations thereof. Those skilled in the art should also readily appreciate that instructions or programs defining the functions of the present invention may be delivered to a processor in many forms, including, but not limited to, information permanently stored on tangible non-transitory non-writable storage media (e.g. read-only memory devices within a computer, such as ROM, or devices readable by a computer I/O attachment, such as CD-ROM or DVD disks), information alterably stored on tangible non-transitory writable storage media (e.g. floppy disks, removable flash memory and hard drives) or information conveyed to a computer through communication media, including wired or wireless computer networks. In addition, while the invention may be embodied in software, the functions necessary to implement the invention may optionally or alternatively be embodied in part or in whole using firmware and/or hardware components, such as combinatorial logic, Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs) or other hardware or some combination of hardware, software and/or firmware components.
While the invention is described through the above-described exemplary embodiments, it will be understood by those of ordinary skill in the art that modifications to, and variations of, the illustrated embodiments may be made without departing from the inventive concepts disclosed herein. For example, although some aspects of the shadow estimation method have been described with reference to a flowchart, those skilled in the art should readily appreciate that functions, operations, decisions, etc. of all or a portion of each block, or a combination of blocks, of the flowchart may be combined, separated into separate operations or performed in other orders. Moreover, while the embodiments are described in connection with various illustrative data structures, one skilled in the art will recognize that the system may be embodied using a variety of data structures. Furthermore, disclosed aspects, or portions of these aspects, may be combined in ways not listed above. Accordingly, the invention should not be viewed as being limited to the disclosed embodiments.
An example of computer code that may be used to practice the computer-implemented method described herein is now provided.
© 2017 Intergraph Corporation |
void CKLVParser0601::FixBowTie(double *pdGroundCorner1Lat, double |
*pdGroundCorner1Long, |
double *pdGroundCorner2Lat, double *pdGroundCorner2Long, |
double *pdGroundCorner3Lat, double *pdGroundCorner3Long, |
double *pdGroundCorner4Lat, double *pdGroundCorner4Long, |
bool bSwapRight, bool bSwapBottom) |
{ |
if (sNAN == *pdGroundCorner1Lat ∥ sNAN == *pdGroundCorner1Long ∥ |
sNAN == *pdGroundCorner2Lat ∥ sNAN == *pdGroundCorner2Long ∥ |
sNAN == *pdGroundCorner3Lat ∥ sNAN == *pdGroundCorner3Long ∥ |
sNAN == *pdGroundCorner4Lat ∥ sNAN == *pdGroundCorner4Long) |
{ |
return; |
} |
// treat the lat long as points in a cartesian x,y graph |
// Determine the equation of the four line |
bool bABIntersect = false; |
bool bSwapped = false; |
// Line A from point 1 to point 2 |
double dASlope = 0; |
double dASlopeSign = 1.0; |
double dAIntercept = 0; |
double dARun = *pdGroundCorner2Long − *pdGroundCorner1Long; |
double dARise = *pdGroundCorner2Lat − *pdGroundCorner1Lat; |
if (dARun != 0) |
{ |
dASlope = dARise / dARun; |
if (dASlope < 0) |
{ |
dASlopeSign = −1.0; |
} |
dAIntercept = *pdGroundCorner1Lat − dASlope * *pdGroundCorner1Long; |
} |
else |
{ |
// A vertical line |
// Slope is infinite |
// Intercept is all vertical point at point x(1Long) |
} |
// Line B from point 4 to point 3 |
double dYABIntersect = 0; |
double dXABIntersect = 0; |
double dBSlope = 0; |
double dBSlopeSign = 1.0; |
double dBIntercept = 0; |
double dBRun = *pdGroundCorner4Long − *pdGroundCorner3Long; |
double dBRise = *pdGroundCorner4Lat − *pdGroundCorner3Lat; |
if (dBRun != 0) |
{ |
dBSlope = dBRise / dBRun; |
if (dBSlope < 0) |
{ |
dBSlopeSign = −1.0; |
} |
dBIntercept = *pdGroundCorner3Lat − dBSlope * *pdGroundCorner3Long; |
} |
else |
{ |
// A vertical line |
// Slope is infinite |
// Intercept is all vertical point at point x(1Long) |
} |
// See if the opposite lines intersect |
if (dBRun != 0 && dARun != 0) |
{ |
// General case |
if (dBSlope != dASlope) |
{ |
// They must intersect |
dXABIntersect = (dBIntercept − dAIntercept) / (dASlope − dBSlope); |
dYABIntersect = dASlope * ((dBIntercept − dAIntercept) / (dASlope − |
dBSlope)) + dAIntercept; |
bABIntersect = true; |
} |
// Othewise they are coincident or parallel and do not intersect |
} |
else if (0 == dBRun && 0 == dARun) |
{ |
// Both are vertical and are either coincident or do not itersect |
// Do nothing |
} |
else if (0 == dBRun && 0 != dARun) |
{ |
// B id vertical and A sloped |
// B is the Long value or X |
dXABIntersect = *pdGroundCorner3Long; |
dYABIntersect = dASlope * dXABIntersect + dAIntercept; |
bABIntersect = true; |
} |
else |
{ |
// A is vertical and B sloped |
// A is the Long value or X |
dXABIntersect = *pdGroundCorner1Long; |
dYABIntersect = dBSlope * dXABIntersect + dBIntercept; |
bABIntersect = true; |
} |
// Second set of lines |
bool bCDIntersect = false; |
// Line C from point 2 to point 3 |
double dCSlope = 0; |
double dCSlopeSign = 1.0; |
double dCIntercept = 0; |
double dCRun = *pdGroundCorner3Long − *pdGroundCorner2Long; |
double dCRise = *pdGroundCorner3Lat − *pdGroundCorner2Lat; |
if (dCRun != 0) |
{ |
dCSlope = dCRise / dCRun; |
if (dCSlope < 0) |
{ |
dCSlopeSign = −1.0; |
} |
dCIntercept = *pdGroundCorner2Lat − dCSlope * *pdGroundCorner2Long; |
} |
// Else it is a vertical line |
// Slope is infinite |
// Intercept is all vertical point at point x(1Long) |
// Line D from point 4 to point 1 |
double dYCDIntersect = 0; |
double dXCDIntersect = 0; |
double dDSlope = 0; |
double dDSlopeSign = 1.0; |
double dDIntercept = 0; |
double dDRun = *pdGroundCorner4Long − *pdGroundCorner1Long; |
double dDRise = *pdGroundCorner4Lat − *pdGroundCorner1Lat; |
if (dDRun != 0) |
{ |
dDSlope = dDRise / dDRun; |
if (dDSlope < 0) |
{ |
dDSlopeSign = −1.0; |
} |
dDIntercept = *pdGroundCorner4Lat − dDSlope * *pdGroundCorner4Long; |
} |
// Else it is a vertical line |
// Slope is infinite |
// Intercept is all vertical point at point x(1Long) |
// See if the opposite lines intersect |
if (dDRun != 0 && dCRun != 0) |
{ |
// General case |
if (dDSlope != dCSlope) |
{ |
// They must intersect |
dXCDIntersect = (dDIntercept − dCIntercept) / (dCSlope − dDSlope); |
dYCDIntersect = dCSlope * ((dDIntercept − dCIntercept) / (dCSlope − |
dDSlope)) + dCIntercept; |
bCDIntersect = true; |
} |
// Othewise they are coincident or parallel and do not intersect |
} |
else if (0 == dDRun && 0 == dCRun) |
{ |
// Both are vertical and are either coincident or do not itersect |
// Do nothing |
} |
else if (0 == dDRun && 0 != dCRun) |
{ |
// D is vertical and C sloped |
// D is the Long value or X |
dXCDIntersect = *pdGroundCorner4Long; |
dYCDIntersect = dCSlope * dXCDIntersect + dCIntercept; |
bCDIntersect = true; |
} |
else |
{ |
// C is vertical and D sloped |
// C is the Long value or X |
dXCDIntersect = *pdGroundCorner2Long; |
dYCDIntersect = dDSlope * dXCDIntersect + dDIntercept; |
bCDIntersect = true; |
} |
// Determine if the intersect point is inside the bounding rectangle. If so it is a bowtie |
if (bABIntersect) |
{ |
// see if it is between lines C and D |
double dYC = (dCSlope * dXABIntersect + dCIntercept − dYABIntersect) * |
dCSlopeSign; |
double dYD = (dDSlope * dXABIntersect + dDIntercept − dYABIntersect) * |
dDSlopeSign; |
// If they have opposite signs, it is a bowtie |
if ((dYC >= 0 && dYD <= 0) ∥ (dYC <= 0 && dYD >= 0)) |
{ |
// Swap points 2 and 3 or you could do 1 and 4 |
if (bSwapRight) |
{ |
double dLatTemp = *pdGroundCorner2Lat; |
double dLongTemp = *pdGroundCorner2Long; |
*pdGroundCorner2Lat = *pdGroundCorner3Lat; |
*pdGroundCorner2Long = *pdGroundCorner3Long; |
*pdGroundCorner3Lat = dLatTemp; |
*pdGroundCorner3Long = dLongTemp; |
} |
else |
{ |
double dLatTemp = *pdGroundCorner4Lat; |
double dLongTemp = *pdGroundCorner4Long; |
*pdGroundCorner4Lat = *pdGroundCorner1Lat; |
*pdGroundCorner4Long = *pdGroundCorner1Long; |
*pdGroundCorner1Lat = dLatTemp; |
*pdGroundCorner1Long = dLongTemp; |
} |
dBSlope = 0; |
dBSlopeSign = 1.0; |
dBIntercept = 0; |
dBRun = *pdGroundCorner4Long − *pdGroundCorner3Long; |
dBRise = *pdGroundCorner4Lat − *pdGroundCorner3Lat; |
if (dBRun != 0) |
{ |
dBSlope = dBRise / dBRun; |
if (dBSlope < 0) |
{ |
dBSlopeSign = −1.0; |
} |
dBIntercept = *pdGroundCorner3Lat − dBSlope * |
*pdGroundCorner3Long; |
} |
else |
{ |
// A vertical line |
// Slope is infinite |
// Intercept is all vertical point at point x(1Long) |
} |
} |
} |
if (bCDIntersect && !bSwapped) |
{ |
// see if it is between lines A and B |
double dYA = (dASlope * dXCDIntersect + dAIntercept − dYCDIntersect) * |
dASlopeSign; |
double dYB = (dBSlope * dXCDIntersect + dBIntercept − dYCDIntersect) * |
dBSlopeSign; |
// If they have opposite signs, it is a bowtie |
if ((dYA >= 0 && dYB <= 0) ∥ (dYA <= 0 && dYB >= 0)) |
{ |
// Swap points 3 and 4 or you could do 1 and 2 |
if (bSwapBottom) |
{ |
bSwapped = true; |
double dLatTemp = *pdGroundCorner3Lat; |
double dLongTemp = *pdGroundCorner3Long; |
*pdGroundCorner3Lat = *pdGroundCorner4Lat; |
*pdGroundCorner3Long = *pdGroundCorner4Long; |
*pdGroundCorner4Lat = dLatTemp; |
*pdGroundCorner4Long = dLongTemp; |
} |
else |
{ |
double dLatTemp = *pdGroundCorner1Lat; |
double dLongTemp = *pdGroundCorner1Long; |
*pdGroundCorner1Lat = *pdGroundCorner2Lat; |
*pdGroundCorner1Long = *pdGroundCorner2Long; |
*pdGroundCorner2Lat = dLatTemp; |
*pdGroundCorner2Long = dLongTemp; |
} |
} |
} |
} |
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
5307449, | Dec 20 1991 | Apple Inc | Method and apparatus for simultaneously rendering multiple scanlines |
5319744, | Apr 03 1991 | Intel Corporation | Polygon fragmentation method of distortion correction in computer image generating systems |
5544294, | Dec 28 1993 | Samsung Electronics Co., Ltd. | Method for generating a subpixel mask for computer graphics system and apparatus thereof |
5794004, | Dec 19 1995 | HEWLETT-PACKARD DEVELOPMENT COMPANY, L P | Clipper assisted decomposition of bow-tie quadrilaterals |
6947610, | Mar 02 2001 | Corel Corporation | Method of correcting an image with perspective distortion and producing an artificial image with perspective distortion |
7379619, | Mar 09 2005 | Texas Instruments Incorporated | System and method for two-dimensional keystone correction for aerial imaging |
9489595, | Dec 24 2013 | Huawei Technologies Co., Ltd. | Method, apparatus, and device for detecting convex polygon image block |
20050073532, | |||
20050179688, | |||
20090225180, | |||
20100283853, | |||
20110090399, | |||
20120133840, | |||
20150262343, | |||
20160180501, | |||
20160314563, | |||
20160350966, | |||
20170169573, | |||
20170217589, | |||
20170294002, | |||
WO2009065003, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Nov 24 2020 | Intergraph Corporation | (assignment on the face of the patent) |
Date | Maintenance Fee Events |
Nov 24 2020 | BIG: Entity status set to Undiscounted (note the period is included in the code). |
Date | Maintenance Schedule |
Jul 26 2025 | 4 years fee payment window open |
Jan 26 2026 | 6 months grace period start (w surcharge) |
Jul 26 2026 | patent expiry (for year 4) |
Jul 26 2028 | 2 years to revive unintentionally abandoned end. (for year 4) |
Jul 26 2029 | 8 years fee payment window open |
Jan 26 2030 | 6 months grace period start (w surcharge) |
Jul 26 2030 | patent expiry (for year 8) |
Jul 26 2032 | 2 years to revive unintentionally abandoned end. (for year 8) |
Jul 26 2033 | 12 years fee payment window open |
Jan 26 2034 | 6 months grace period start (w surcharge) |
Jul 26 2034 | patent expiry (for year 12) |
Jul 26 2036 | 2 years to revive unintentionally abandoned end. (for year 12) |