Skip to content

Commit 759147c

Browse files
committed
Apply clang-format
1 parent aa6dc2b commit 759147c

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

tests/UnitTests/ImageProcessing/DIPCorr2DTest.cpp

+21-22
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,16 @@ void _mlir_ciface_corr_2d(MemRef<float, 2> *input, MemRef<float, 2> *kernel,
1616
unsigned int centerY, int boundaryOption);
1717
}
1818

19-
bool equalImages(const Mat &img1, const Mat &img2)
20-
{
19+
bool equalImages(const Mat &img1, const Mat &img2) {
2120
if (img1.rows != img2.rows || img1.cols != img2.cols) {
22-
std::cout << "Produced outputs by DIP and OpenCV differ. Image dimensions are not equal\n";
21+
std::cout << "Produced outputs by DIP and OpenCV differ. Image dimensions "
22+
"are not equal\n";
2323
return 0;
2424
}
2525

26-
for (unsigned int y = 0; y < img1.rows; ++y)
27-
{
28-
for (unsigned int x = 0; x < img1.cols; ++x)
29-
{
30-
if (abs(img1.at<float>(x, y) - img2.at<float>(x, y)) > 10e-3)
31-
{
26+
for (unsigned int y = 0; y < img1.rows; ++y) {
27+
for (unsigned int x = 0; x < img1.cols; ++x) {
28+
if (abs(img1.at<float>(x, y) - img2.at<float>(x, y)) > 10e-3) {
3229
std::cout << "Produced outputs by DIP and OpenCV differ.\n";
3330
return 0;
3431
}
@@ -37,9 +34,9 @@ bool equalImages(const Mat &img1, const Mat &img2)
3734
return 1;
3835
}
3936

40-
void testKernelImpl(const Mat& inputImage, unsigned int kernelRows, unsigned int kernelCols, float* kernelArray,
41-
unsigned int x, unsigned int y)
42-
{
37+
void testKernelImpl(const Mat &inputImage, unsigned int kernelRows,
38+
unsigned int kernelCols, float *kernelArray, unsigned int x,
39+
unsigned int y) {
4340
// Define container sizes.
4441
intptr_t sizesInput[2] = {inputImage.rows, inputImage.cols};
4542
intptr_t sizesKernel[2] = {kernelRows, kernelCols};
@@ -60,31 +57,33 @@ void testKernelImpl(const Mat& inputImage, unsigned int kernelRows, unsigned int
6057
_mlir_ciface_corr_2d(&input, &kernel, &output, x, y, 0);
6158

6259
filter2D(inputImage, opencvOutput, CV_32FC1, kernel1, cv::Point(x, y), 1.0,
63-
cv::BORDER_REPLICATE);
60+
cv::BORDER_REPLICATE);
6461

6562
// Define a cv::Mat with the output of corr_2d.
6663
Mat dipOutput(inputImage.rows, inputImage.cols, CV_32FC1, output.getData());
6764

68-
if (!equalImages(dipOutput, opencvOutput))
69-
{
70-
std::cout << "Different images produced by OpenCV and DIP for kernel :\n" << kernel1 << "\n"
71-
"when anchor point was : (" << x << ", " << y << ").\n";
65+
if (!equalImages(dipOutput, opencvOutput)) {
66+
std::cout << "Different images produced by OpenCV and DIP for kernel :\n"
67+
<< kernel1
68+
<< "\n"
69+
"when anchor point was : ("
70+
<< x << ", " << y << ").\n";
7271
return;
7372
}
7473
}
7574

76-
void testKernel(const Mat& inputImage, unsigned int kernelRows, unsigned int kernelCols, float* kernelArray)
77-
{
75+
void testKernel(const Mat &inputImage, unsigned int kernelRows,
76+
unsigned int kernelCols, float *kernelArray) {
7877
for (unsigned int y = 0; y < kernelRows; ++y)
7978
for (unsigned int x = 0; x < kernelCols; ++x)
8079
testKernelImpl(inputImage, kernelRows, kernelCols, kernelArray, x, y);
8180
}
8281

83-
int main(int argc, char **argv)
84-
{
82+
int main(int argc, char **argv) {
8583
// Read input image
8684
Mat inputImage = imread(argv[1], IMREAD_GRAYSCALE);
8785

8886
for (auto kernel : kernelMap)
89-
testKernel(inputImage, get<1>(kernel.second), get<2>(kernel.second), get<0>(kernel.second));
87+
testKernel(inputImage, get<1>(kernel.second), get<2>(kernel.second),
88+
get<0>(kernel.second));
9089
}

0 commit comments

Comments
 (0)