SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
JacobianTask.cpp
Go to the documentation of this file.
1
17/*
18 * JacobianTask.cpp
19 *
20 * Created on: Oct 08, 2018
21 * Author: Alejandro Alvarez Ayllon
22 */
23
24#include <iostream>
25
29
31
34
35namespace SourceXtractor {
36
38 auto measurement_frame_coordinates = group.begin()->getProperty<MeasurementFrameCoordinates>(m_instance).getCoordinateSystem();
39 auto reference_coordinates = group.begin()->getProperty<ReferenceCoordinates>().getCoordinateSystem();
40 auto& detection_group_stamp = group.getProperty<DetectionFrameGroupStamp>();
41
42 double x = detection_group_stamp.getTopLeft().m_x + detection_group_stamp.getStamp().getWidth() / 2.0;
43 double y = detection_group_stamp.getTopLeft().m_y + detection_group_stamp.getStamp().getHeight() / 2.0;
44
45 auto frame_origin = measurement_frame_coordinates->worldToImage(reference_coordinates->imageToWorld(ImageCoordinate(x, y)));
46 auto frame_dx = measurement_frame_coordinates->worldToImage(
47 reference_coordinates->imageToWorld(ImageCoordinate(x + 1.0, y)));
48 auto frame_dy = measurement_frame_coordinates->worldToImage(
49 reference_coordinates->imageToWorld(ImageCoordinate(x, y + 1.0)));
50
52 frame_dx.m_x - frame_origin.m_x, frame_dx.m_y - frame_origin.m_y,
53 frame_dy.m_x - frame_origin.m_x, frame_dy.m_y - frame_origin.m_y);
54}
55
57 auto measurement_frame_coordinates = source.getProperty<MeasurementFrameCoordinates>(m_instance).getCoordinateSystem();
58 auto reference_coordinates = source.getProperty<ReferenceCoordinates>().getCoordinateSystem();
59 auto world_centroid = source.getProperty<WorldCentroid>().getCentroid();
60
61 auto reference_centroid = reference_coordinates->worldToImage(world_centroid);
62 double x = reference_centroid.m_x;
63 double y = reference_centroid.m_y;
64
65 auto frame_origin = measurement_frame_coordinates->worldToImage(reference_coordinates->imageToWorld(ImageCoordinate(x, y)));
66 auto frame_dx = measurement_frame_coordinates->worldToImage(
67 reference_coordinates->imageToWorld(ImageCoordinate(x + 1.0, y)));
68 auto frame_dy = measurement_frame_coordinates->worldToImage(
69 reference_coordinates->imageToWorld(ImageCoordinate(x, y + 1.0)));
70
72 frame_dx.m_x - frame_origin.m_x, frame_dx.m_y - frame_origin.m_y,
73 frame_dy.m_x - frame_origin.m_x, frame_dy.m_y - frame_origin.m_y);
74}
75
76} // end SourceXtractor
void computeProperties(SourceGroupInterface &source) const override
Computes one or more properties for the SourceGroup and/or the Sources it contains.
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Defines the interface used to group sources.
void setIndexedProperty(std::size_t index, Args... args)
Convenience template method to call setProperty() with a more user-friendly syntax.
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
The SourceInterface is an abstract "source" that has properties attached to it.
void setIndexedProperty(std::size_t index, Args... args)
Convenience template method to call setProperty() with a more user-friendly syntax.
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.