#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <numeric>
int main()
{
constexpr auto numHalfCols = NUM_COLS / 2;
for (
nc::uint32 row = 0; row < ncArray.numRows(); ++row)
{
auto begin = ncArray.begin(row);
std::iota(begin, begin + numHalfCols,
nc::uint8{ 0 });
auto rbegin = ncArray.rbegin(row);
std::iota(rbegin, rbegin + numHalfCols,
nc::uint8{ 0 });
}
auto cvArray = cv::Mat(ncArray.numRows(), ncArray.numCols(), CV_8SC1, ncArray.data());
cv::namedWindow("Display window", cv::WINDOW_AUTOSIZE);
cv::imshow("Display window", cvArray);
cv::waitKey(0);
auto transposedCvArray = cv::Mat(cvArray.cols, cvArray.rows, CV_8SC1);
cv::namedWindow("Display window", cv::WINDOW_AUTOSIZE);
cv::imshow("Display window", transposedCvArray);
cv::waitKey(0);
auto transposedNcArray =
{
std::cout << "Arrays are equal.\n";
}
else
{
std::cout << "Arrays are not equal.\n";
}
return 0;
}
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
bool array_equal(const NdArray< dtype > &inArray1, const NdArray< dtype > &inArray2) noexcept
Definition: array_equal.hpp:47
std::uint8_t uint8
Definition: Types.hpp:42
std::uint32_t uint32
Definition: Types.hpp:40
NdArray< dtype > transpose(const NdArray< dtype > &inArray)
Definition: transpose.hpp:45