test_cv_utils.cpp
Go to the documentation of this file.
2 #include <opencv2/opencv.hpp>
3 #include <gtest/gtest.h>
4 
5 
6 TEST(CvUtils, testLabelToRGB){
7  cv::Mat label_image = cv::Mat::zeros(1, 2, CV_32SC1);
8  label_image.at<int>(0, 1) = 1;
9  cv::Mat rgb_image;
10  jsk_recognition_utils::labelToRGB(label_image, rgb_image);
11  // background label 0 -> [0, 0, 0]
12  EXPECT_EQ(0, cv::norm(rgb_image.at<cv::Vec3b>(0, 0)));
13  // label 1 -> not [0, 0, 0]
14  EXPECT_NE(0, cv::norm(rgb_image.at<cv::Vec3b>(0, 1)));
15 }
16 
17 int main(int argc, char **argv){
19  return RUN_ALL_TESTS();
20 }
EXPECT_NE
#define EXPECT_NE(expected, actual)
EXPECT_EQ
#define EXPECT_EQ(expected, actual)
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
testing::InitGoogleTest
void InitGoogleTest(int *argc, char **argv)
jsk_recognition_utils::labelToRGB
void labelToRGB(const cv::Mat src, cv::Mat &dst)
convert label image to rgb one.
Definition: cv_utils.cpp:179
argv
argv
cv_utils.h
TEST
TEST(CvUtils, testLabelToRGB)
Definition: test_cv_utils.cpp:6
main
int main(int argc, char **argv)
Definition: test_cv_utils.cpp:17
gtest.h


jsk_recognition_utils
Author(s):
autogenerated on Tue Jan 7 2025 04:04:52