LOST  0.0.1
LOST: Open-source Star Tracker
io.cpp File Reference
#include "io.hpp"
#include <cairo/cairo.h>
#include <stdio.h>
#include <inttypes.h>
#include <math.h>
#include <errno.h>
#include <assert.h>
#include <stdlib.h>
#include <limits.h>
#include <unistd.h>
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#include <memory>
#include <cstring>
#include <random>
#include <algorithm>
#include <map>
#include <chrono>
#include "attitude-estimators.hpp"
#include "attitude-utils.hpp"
#include "databases.hpp"
#include "decimal.hpp"
#include "star-id.hpp"
#include "star-utils.hpp"
Include dependency graph for io.cpp:

Go to the source code of this file.

Classes

class  lost::GeneratedStar
 A star used in simulated image generation. Contains extra data about how to simulate the star. More...
 
class  lost::CentroidComparison
 The result of comparing actual and expected centroids Used for debugging and benchmarking. More...
 

Namespaces

 lost
 LOST starting point.
 

Macros

#define DEFAULT_BSC_PATH   "bright-star-catalog.tsv"
 
#define LOST_PIPELINE_COMPARE(precondition, errmsg, comparator, path, isBinary)
 

Typedefs

typedef CentroidAlgorithm *(* lost::CentroidAlgorithmFactory) ()
 
typedef StarIdAlgorithm *(* lost::StarIdAlgorithmFactory) ()
 
typedef AttitudeEstimationAlgorithm *(* lost::AttitudeEstimationAlgorithmFactory) ()
 
typedef PipelineInputList(* lost::PipelineInputFactory) ()
 
typedef void(* lost::PipelineComparator) (std::ostream &os, const PipelineInputList &, const std::vector< PipelineOutput > &, const PipelineOptions &)
 

Functions

std::vector< CatalogStar > lost::BscParse (std::string tsvPath)
 Parse the bright star catalog from the TSV file on disk. More...
 
const Catalog & lost::CatalogRead ()
 Read and parse the full catalog from disk. If called multiple times, will re-use the first result. More...
 
unsigned char * lost::SurfaceToGrayscaleImage (cairo_surface_t *cairoSurface)
 Convert a colored Cairo image surface into a row-major array of grayscale pixels. More...
 
cairo_surface_t * lost::GrayscaleImageToSurface (const unsigned char *image, const int width, const int height)
 
void lost::SurfacePlot (std::string description, cairo_surface_t *cairoSurface, const Stars &stars, const StarIdentifiers *starIds, const Catalog *catalog, const Attitude *attitude, double red, double green, double blue, double alpha, bool rawStarIndexes=false)
 Plot information about an image onto the image using Cairo. More...
 
SerializeContext lost::serFromDbValues (const DatabaseOptions &values)
 
MultiDatabaseDescriptor lost::GenerateDatabases (const Catalog &, const DatabaseOptions &values)
 Appropriately create descriptors for all requested databases according to command-line options. More...
 
std::ostream & lost::operator<< (std::ostream &os, const Camera &camera)
 Print information about the camera in machine and human-readable form. More...
 
decimal lost::FocalLengthFromOptions (const PipelineOptions &values, int xResolution)
 Calculate the focal length, in pixels, based on the given command line options. More...
 
PipelineInputList lost::GetPngPipelineInput (const PipelineOptions &values)
 Create a PngPipelineInput using command line options. More...
 
PipelineInputList lost::GetGeneratedPipelineInput (const PipelineOptions &values)
 Create a GeneratedPipelineInput based on the command line options in values More...
 
PipelineInputList lost::GetPipelineInput (const PipelineOptions &values)
 Come up with a list of pipeline inputs based on command line options. More...
 
Pipeline lost::SetPipeline (const PipelineOptions &values)
 Create a pipeline from command line options. More...
 
CentroidComparison lost::CentroidsCompare (decimal threshold, const Stars &expected, const Stars &actual)
 Compare expected and actual centroids. More...
 
CentroidComparison lost::CentroidComparisonsCombine (std::vector< CentroidComparison > comparisons)
 
StarIdComparison lost::StarIdsCompare (const StarIdentifiers &expected, const StarIdentifiers &actual, const Catalog &expectedCatalog, const Catalog &actualCatalog, decimal centroidThreshold, const Stars &expectedStars, const Stars &inputStars)
 Compare expected and actual star identifications. More...
 
void lost::PipelineComparatorPlotCentroidIndices (std::ostream &os, const PipelineInputList &expected, const std::vector< PipelineOutput > &actual, const PipelineOptions &)
 Plot an annotated image where centroids are annotated with their centroid index. More...
 
void lost::PipelineComparison (const PipelineInputList &expected, const std::vector< PipelineOutput > &actual, const PipelineOptions &values)
 Print or otherwise analyze the results of (perhaps multiple) runs of a star tracking pipeline. More...
 

Variables

const int lost::kMaxBrightness = 255
 

Macro Definition Documentation

◆ DEFAULT_BSC_PATH

#define DEFAULT_BSC_PATH   "bright-star-catalog.tsv"

Definition at line 95 of file io.cpp.

◆ LOST_PIPELINE_COMPARE

#define LOST_PIPELINE_COMPARE (   precondition,
  errmsg,
  comparator,
  path,
  isBinary 
)
Value:
do { \
if (precondition) { \
UserSpecifiedOutputStream pos(path, isBinary); \
comparator(pos.Stream(), expected, actual, values); \
} else { \
std::cerr << "ERROR: Comparator not applicable: " << errmsg << std::endl; \
exit(1); \
} \
} while (0)