Skip to content
Commits on Source (5)
......@@ -21,10 +21,11 @@
#include <cmath>
#include <sstream>
#include <iostream>
#include <ossim/imaging/ossimImageWriterFactoryRegistry.h>
using namespace std;
#define USE_UINT8 false
#define USE_UINT8 true
int main(int argc, char *argv[])
{
......@@ -34,19 +35,16 @@ int main(int argc, char *argv[])
ossimInit::instance()->addOptions(ap);
ossimInit::instance()->initialize(ap);
if ( (ap.argc() < 4) || ap.read("-h") || ap.read("--help") )
if ( (ap.argc() < 2) || ap.read("-h") || ap.read("--help") )
{
cout << "\nUsage: "<<ap[0]<<" <dx> <dy> <filename>\n"<<endl;
cout << "\nUsage: "<<ap[0]<<" <filename>\n"<<endl;
return 0;
}
int dx = atoi(ap[1]);
int dy = atoi(ap[2]);
ossimFilename filename = ap[3];
filename.setExtension(".tif");
ossimFilename filename = ap[1];
// Establish the image geometry's map projection:
ossimIpt image_size (256, 256);
ossimIpt image_size (32, 32);
ossimGpt observerGpt (0, 0, 0);
ossimDpt gsd (1.0, 1.0); // must be same value in both directions
ossimRefPtr<ossimEquDistCylProjection> mapProj = new ossimEquDistCylProjection();
......@@ -80,46 +78,47 @@ int main(int argc, char *argv[])
outImage->initialize();
else
return -1;
double A = (max - min)/2.0;
outImage->fill(min);
PIXEL_TYPE step = 8;
PIXEL_TYPE value = 0;
PIXEL_TYPE* buffer = ( PIXEL_TYPE*) outImage->getBuf(0);
if ((dx != 0) || (dy != 0))
{
// Allocate image buffer:
ossim_uint32 i = 0;
double phase = 0;
double dpx = 0;
if (dx != 0)
dpx = 2*M_PI/dx; // phase rate (radians per pixel)
double dpy = 0;
if (dy != 0)
dpy = 2*M_PI/dy; // phase rate (radians per pixel)
for (int y=0; y<image_size.y; y++)
{
phase = y*dpy;
for (int x=0; x<image_size.x; x++)
{
// Loops to fill one n x n chip with a single freq (1/lambda) component:
buffer[i++] = (PIXEL_TYPE) (A * (cos(phase) + 1.0));
phase += dpx;
}
buffer[i++] = value;
if (value == 248)
value = 0;
else
value += step;
}
}
outImage->write("tile.tif");
// Create output image chain:
ossimRefPtr<ossimMemoryImageSource> memSource = new ossimMemoryImageSource;
memSource->setImage(outImage);
memSource->setImageGeometry(geometry.get());
ossimRefPtr<ossimTiffWriter> writer = new ossimTiffWriter();
// Create TIFF writer:
ossimRefPtr<ossimImageFileWriter> writer =
ossimImageWriterFactoryRegistry::instance()->createWriterFromExtension(filename.ext());
if (!writer)
throw runtime_error( "Unable to create writer given filename extension." );
writer->connectMyInputTo(0, memSource.get());
writer->setFilename(filename);
writer->setGeotiffFlag(true);
bool success = writer->execute();
//writer->writeExternalGeometryFile();
return 0;
if (success)
cout<<"Wrote "<<filename<<"\n"<<endl;
else
cout<<"Error encountered writing "<<filename<<"\n"<<endl;
return (int)success;
}
......@@ -23,8 +23,11 @@ int main(int argc, char* argv[])
ossimArgumentParser::ossimParameter tempParam3(tempString3);
ossimArgumentParser::ossimParameter tempParam4(tempString4);
ossimArgumentParser argumentParser(&argc, argv);
ossimInit::instance()->addOptions(argumentParser);
ossimInit::instance()->initialize(argumentParser);
ossimInit* init = ossimInit::instance();
init->addOptions(argumentParser);
init->initialize(argumentParser);
bool useElevation = init->getElevEnabledFlag();
bool rpcFlag = false;
bool cgFlag = false;
ossimDrect imageRect;
......@@ -176,7 +179,7 @@ int main(int argc, char* argv[])
{
// Solve for replacement RPC:
ossimNotify(ossimNotifyLevel_INFO) << "\nSolving for RPC coefficients..." << std::endl;
ossimRefPtr<ossimRpcSolver> solver = new ossimRpcSolver(true, false);
ossimRefPtr<ossimRpcSolver> solver = new ossimRpcSolver(useElevation, false);
bool converged = solver->solve(imageRect, geom.get(), error);
rpc = solver->getRpcModel();
}
......
ossim (2.6.1-2) UNRELEASED; urgency=medium
ossim (2.6.2-1~exp1) experimental; urgency=medium
* Team upload.
* New upstream release.
* Bump Standards-Version to 4.3.0, no changes.
* Refresh patches.
-- Bas Couwenberg <sebastic@debian.org> Tue, 25 Dec 2018 22:51:03 +0100
-- Bas Couwenberg <sebastic@debian.org> Thu, 17 Jan 2019 07:01:36 +0100
ossim (2.6.1-1) unstable; urgency=medium
......
......@@ -187,7 +187,7 @@ Author: Bas Couwenberg <sebastic@debian.org>
<< "\n Example:"
--- a/apps/ossim-rpcgen/ossim-rpcgen.cpp
+++ b/apps/ossim-rpcgen/ossim-rpcgen.cpp
@@ -38,7 +38,7 @@ int main(int argc, char* argv[])
@@ -41,7 +41,7 @@ int main(int argc, char* argv[])
argumentParser.getApplicationName() + " takes an input image and generates a "
"corresponding RPC geometry in a variety of formats. If a bounding box is specified, the "
"default output filename (based on the input filename) will be appended with the bbox spec"
......
......@@ -58,6 +58,14 @@ class OSSIM_DLL ossimMatrix4x4
ossim::Quaternion getRotate()const;
void getRotate(ossim::Quaternion& quat)const;
ossimMatrix4x4 operator=(const ossimMatrix4x4& rhs)
{
theData[0][0]=rhs.theData[0][0]; theData[0][1]=rhs.theData[0][1]; theData[0][2]=rhs.theData[0][2]; theData[0][3]=rhs.theData[0][3];
theData[1][0]=rhs.theData[1][0]; theData[1][1]=rhs.theData[1][1]; theData[1][2]=rhs.theData[1][2]; theData[1][3]=rhs.theData[1][3];
theData[2][0]=rhs.theData[2][0]; theData[2][1]=rhs.theData[2][1]; theData[2][2]=rhs.theData[2][2]; theData[2][3]=rhs.theData[2][3];
theData[3][0]=rhs.theData[3][0]; theData[3][1]=rhs.theData[3][1]; theData[3][2]=rhs.theData[3][2]; theData[3][3]=rhs.theData[3][3];
return *this;
}
ossimMatrix4x4 operator+ (const ossimMatrix4x4& rhs)const
{
return ossimMatrix4x4(theData[0][0] + rhs.theData[0][0], theData[0][1] + rhs.theData[0][1], theData[0][2] + rhs.theData[0][2], theData[0][3] + rhs.theData[0][3],
......
......@@ -249,6 +249,7 @@ public:
bool getElevationLookupFlag()const;
const ossimMatrix4x4& getModelTransform() const { return theModelTransform; }
void setModelTransform(const ossimMatrix4x4& transform);
/**
* @brief Implementation of pure virtual
......
......@@ -62,7 +62,7 @@ double ossimDtedElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt)
double ossimDtedElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
{
double h = getHeightAboveMSL(gpt);
if(h != ossim::nan())
if(!ossim::isnan(h))
{
double offset = getOffsetFromEllipsoid(gpt);
......
......@@ -21,7 +21,7 @@ double ossimGeneralRasterElevationDatabase::getHeightAboveMSL(const ossimGpt& gp
double ossimGeneralRasterElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
{
double h = getHeightAboveMSL(gpt);
if(h != ossim::nan())
if(!ossim::isnan(h))
{
h += getOffsetFromEllipsoid(gpt);
}
......
......@@ -57,7 +57,7 @@ double ossimSrtmElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt)
double ossimSrtmElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
{
double h = getHeightAboveMSL(gpt);
if(h != ossim::nan())
if(!ossim::isnan(h))
{
h += getOffsetFromEllipsoid(gpt);
}
......
......@@ -342,7 +342,7 @@ double ossimTiledElevationDatabase::getHeightAboveMSL(const ossimGpt& gpt)
double ossimTiledElevationDatabase::getHeightAboveEllipsoid(const ossimGpt& gpt)
{
double h = getHeightAboveMSL(gpt);
if(h != ossim::nan())
if(!ossim::isnan(h))
{
h += getOffsetFromEllipsoid(gpt);
}
......
......@@ -655,12 +655,16 @@ long ossimEquDistCylProjection::Convert_Equidistant_Cyl_To_Geodetic(double Easti
{
dy = Northing - Eqcy_False_Northing;
dx = Easting - Eqcy_False_Easting;
*Latitude = dy / Ra;
double RaInv = 1.0/Ra;
*Latitude = dy *RaInv;
if (Ra_Cos_Eqcy_Std_Parallel == 0)
*Longitude = 0;
else
*Longitude = Eqcy_Origin_Long + dx / Ra_Cos_Eqcy_Std_Parallel;
{
double RaCosLatInv = 1.0/Ra_Cos_Eqcy_Std_Parallel;
*Longitude = Eqcy_Origin_Long + dx*RaCosLatInv;
}
// if (*Latitude > PI_OVER_2) /* force distorted values to 90, -90 degrees */
// *Latitude = PI_OVER_2;
......
......@@ -271,6 +271,14 @@ void ossimMapProjection::update()
updateTransform();
}
void ossimMapProjection::setModelTransform (const ossimMatrix4x4& transform)
{
theModelTransform = transform;
theInverseModelTransform = theModelTransform;
theInverseModelTransform.i();
updateFromTransform();
}
void ossimMapProjection::updateTransform()
{
// Assumes model coordinates in meters:
......
......@@ -400,6 +400,9 @@ bool ossimRpcSolver::solve(const ossimDrect& imageBounds,
<<theMaxResidual<<") is larger than the desired error tolerance ("<<tolerance<<" p)."
<< std::endl;
}
// Initialize metadata:
theRpcModel->setMetersPerPixel(geom->getMetersPerPixel());
return converged;
}
......
......@@ -79,6 +79,7 @@ bool ossimNitfFileHeader::getDesInformation(ossimNitfDesInformation &desInfo,
}
}
}
return false;
}
bool ossimNitfFileHeader::hasImages()const
......