766 std::vector<std::string> args(argc-1);
767 for (
int i=0;i<argc-1;i++)
776 std::string outputfile, fixlutfile, inputposfile, bmlutfile, rescaledlutfile;
777 std::string radialWeightsFile;
785 std::string crlboutput;
788 std::vector< vector3f > inputPos;
789 if (!inputposfile.empty()) {
791 count = inputPos.size();
808 check_arg(args,
"zlutalign", &zlutAlign);
810 float pixelmax = 28 * 255;
813 std::string lutsmpfile;
826 if (!fixlutfile.empty())
830 if(!rescaledlutfile.empty()) {
833 ResampleLUT(qtrk, &lut, lut.
h, &newlut, rescaledlutfile.c_str());
848 if (bmlutfile.empty()) {
854 bmlut.
Load(bmlutfile.c_str());
858 if (!rescaledlutfile.empty())
864 if (inputPos.empty()) {
865 inputPos.resize(count);
866 for (
int i=0;i<count;i++){
871 if (!radialWeightsFile.empty())
873 auto rwd =
ReadCSV(radialWeightsFile.c_str());
874 std::vector<float> rw(rwd.size());
883 std::vector<ImageData> imgs (inputPos.size());
885 std::vector<vector3f> crlb(inputPos.size());
887 for (
uint i=0;i<inputPos.size();i++) {
891 auto p = inputPos[i];
894 if (!crlboutput.empty()) {
902 if(i==0 && !lutsmpfile.empty())
WriteJPEGFile(lutsmpfile.c_str(), imgs[i]);
914 for (
uint i=0;i<inputPos.size();i++)
923 std::vector<vector3f> results(inputPos.size());
924 for (
uint i=0;i<inputPos.size();i++) {
931 dbgprintf(
"Mean err X=%f,Z=%f. St deviation: X=%f,Z=%f\n", meanErr.
x,meanErr.
y,stdevErr.
x,stdevErr.
z);
933 if (!crlboutput.empty())
934 WriteTrace(crlboutput, &crlb[0], crlb.size());
936 WriteTrace(outputfile, &results[0], inputPos.size());
void GenerateLUT(ImageData *lut)
float zlut_minradius
Distance in pixels from the bead center from which to start sampling profiles. Default 1...
void GenerateSample(ImageData *image, vector3f pos, float minRadius, float maxRadius)
static double WaitForFinish(QueuedTracker *qtrk, int N)
float qi_minradius
Distance in pixels from the bead center from which to start sampling profiles. Default 1...
int width
Width of regions of interest to be handled. Typically equals height (square ROI). ...
void ResampleLUT(T *qtrk, ImageData *lut, int zplanes, ImageData *newlut, const char *jpgfile=0, uint buildLUTFlags=0)
int downsample
Image downsampling factor. Applied before anything else. 0 = original, 1 = 1x (W=W/2,H=H/2).
std::vector< std::vector< float > > ReadCSV(const char *filename, char sep)
void GenerateImageFromLUT(ImageData *image, ImageData *zlut, float minradius, float maxradius, vector3f pos, bool splineInterp, int oversampleSubdiv)
void WriteJPEGFile(uchar *data, int w, int h, const char *filename, int quality)
Structure for job results.
int height
Height of regions of interest to be handled. Typically equals width (square ROI). ...
void WriteTrace(std::string filename, vector3f *results, int nResults)
Structure for the settings used by the algorithms implemented in QueuedTracker.
int zlut_radialsteps
Number of radial steps to sample on.
std::vector< vector3f > ReadVector3CSV(const char *file, char sep)
virtual void SetLocalizationMode(LocMode_t locType)=0
Select which algorithm is to be used.
uint frame
Frame number this ROI belongs to.
static TImageData alloc(int w, int h)
virtual void SetRadialZLUT(float *data, int count, int planes)=0
Set the radial lookup tables to be used for z tracking.
vector3f pos
Final 3D position found. If no z localization was performed, the value of z will be 0...
Normalize found radial profiles.
LocalizationJob job
Job metadata. See LocalizationJob.
CPU implementation of the QueuedTracker interface.
QTrkComputedConfig cfg
The settings used by this instance of QueuedTracker.
int ReadJPEGFile(uchar *srcbuf, int srclen, uchar **data, int *width, int *height)
float zlut_roi_coverage
Factor of the ROI to include in sampling. Between 0 and 1, default 1. Maxradius = ROI/2*roi_coverage...
static void MeanStDevError(const std::vector< vector3f > &truepos, const std::vector< vector3f > &v, vector3f &meanErr, vector3f &stdev)
float qi_radial_coverage
Sampling points per radial pixel. Default 3.0.
float zlut_angular_coverage
Factor of the sampling perimeter to cover with angular sampling steps. Between 0 and 1...
void check_arg(const std::vector< std::string > &args, const char *name, T *param)
float qi_roi_coverage
Factor of the ROI to include in sampling. Between 0 and 1, default 1. Maxradius = ROI/2*roi_coverage...
vector3< float > vector3f
void dbgprintf(const char *fmt,...)
void check_strarg(const std::vector< std::string > &args, const char *name, std::string *param)
int qi_iterations
Number of times to run the QI algorithm, sampling around the last found position. ...
CUDA implementation of the QueuedTracker interface.
float qi_angstep_factor
Factor to reduce angular steps on lower iterations. Default 1.0 (no effect).
void Load(ImageData *lut)
virtual int FetchResults(LocalizationResult *results, int maxResults)=0
Fetch available results.
virtual void SetRadialWeights(float *zcmp)=0
Set radial weights used for comparing LUT profiles.
Abstract tracker interface, implemented by QueuedCUDATracker and QueuedCPUTracker.
void ScheduleImageData(ImageData *data, const LocalizationJob *jobInfo)
Quick function to schedule a single ROI from an ImageData object.
float zlut_radial_coverage
Sampling points per radial pixel. Default 3.0.
float qi_angular_coverage
Factor of the sampling perimeter to cover with angular sampling steps. Between 0 and 1...
Structure for region of interest metadata.
float zlut_maxradius
Max radius in pixels of the sampling circle.
Do a ZLUT lookup with adjusted weights, for testing purposes.
void ApplyPoissonNoise(ImageData &img, float poissonMax, float maxval)