Skip to content

Commit

Permalink
add default matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
StRigaud committed Mar 29, 2024
1 parent ad1d8e2 commit eb92fb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion clic/include/tier7.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ namespace cle::tier7
* @brief Apply an affine transformation matrix to an array and return the result.
* The transformation matrix must be 3x3 or 4x4 stored as a 1D array.
* The matrix should be row-major, i.e. the first 3 elements are the first row of the matrix.
* If no matrix is given, the identity matrix will be used.
*
* @param device Device to perform the operation on. [const Device::Pointer &]
* @param src Input Array to be transformed. [const Array::Pointer &]
* @param dst Output Array. [Array::Pointer ( = None )]
* @param transform_matrix Affine transformation matrix (3x3 or 4x4). [std::vector<float> &]
* @param transform_matrix Affine transformation matrix (3x3 or 4x4). [std::vector<float> & ( = [] )]
* @param interpolate If true, bi/trilinear interpolation will be applied, if hardware allows. [bool ( = False )]
* @param resize Automatically determines the size of the output depending on the rotation angles. [bool ( = False )]
* @return Array::Pointer
Expand Down
4 changes: 4 additions & 0 deletions clic/src/tier7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ affine_transform_func(const Device::Pointer & device,
bool interpolate,
bool resize) -> Array::Pointer
{
if (transform_matrix.empty())
{
transform_matrix = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
}
if (transform_matrix.size() != 16 && transform_matrix.size() != 9)
{
throw std::runtime_error("Error: Transformation matrix size must be 9 or 16.");
Expand Down

0 comments on commit eb92fb7

Please sign in to comment.