Package-Identification-using-Turtlebot
Robots have been used to improve efficiency in a various tasks in warehouses such as package handling, identification and organization. This project aims to simulate the use of Turtlebot in identifying packages with QR codes, in a warehouse setting.
Functions
QReaderTest.cpp File Reference

file to test the class QReader.cpp More...

#include <gtest/gtest.h>
#include <ros/package.h>
#include <ros/ros.h>
#include <vector>
#include "package_identification_using_turtlebot/QReader.hpp"

Functions

 TEST (decodeQR, unsupportedEncoding)
 Testing if the decoder function handles unknown encoding properly. More...
 
 TEST (decodeQR, mask2)
 Testing if the decoder function can apply mask 2. More...
 
 TEST (decodeQR, mask0)
 Testing if the decoder function can apply mask 0. More...
 
 TEST (decodeQR, mask1)
 Testing if the decoder function can apply mask 1. More...
 
 TEST (decodeQR, unknownImage)
 Testing if the decoder function to check handling of unknown images. More...
 
 TEST (decodeQR, mask6)
 Testing if the decoder function can apply mask 6. More...
 
 TEST (decodeQR, mask3)
 Testing if the decoder function can apply mask 3. More...
 
 TEST (decodeQR, mask7)
 Testing if the decoder function can apply mask 7. More...
 

Detailed Description

file to test the class QReader.cpp

Author
RajendraMayavan, Adarsh Jagan

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

TEST ( decodeQR  ,
unsupportedEncoding   
)

Testing if the decoder function handles unknown encoding properly.

Parameters
[in]TESTSuite
[in]testService
Returns
none
54  {
55  std::string str;
56  std::string fileLocation =
57  ros::package::getPath("package_identification_using_turtlebot") +
58  "/data/numeric_encoding.png";
59  cv::Mat image = cv::imread(fileLocation);
60  QReader reader;
61  reader.setImage(image);
62  std::vector<uint8_t> result = reader.decodeQR();
63  str.assign(result.begin(), result.end());
64  ASSERT_STREQ("unknown", str.c_str());
65 }
void setImage(cv::Mat image)
Sets the value for the private value img.
Definition: QReader.cpp:732
std::vector< uint8_t > decodeQR()
A function to get the raw image, find the QR code, unmask the QR code and decode the QR code in the i...
Definition: QReader.cpp:154
Class QReader has methods to get the image and decode the QR code in the image to extract data of pac...
Definition: QReader.hpp:50
TEST ( decodeQR  ,
mask2   
)

Testing if the decoder function can apply mask 2.

Parameters
[in]TESTSuite
[in]testService
Returns
none
75  {
76  std::string str;
77  std::string fileLocation =
78  ros::package::getPath("package_identification_using_turtlebot") +
79  "/data/apple.png";
80  cv::Mat image = cv::imread(fileLocation);
81  QReader reader;
82  reader.setImage(image);
83  std::vector<uint8_t> result = reader.decodeQR();
84  str.assign(result.begin(), result.end());
85  ASSERT_STREQ("Apple", str.c_str());
86 }
void setImage(cv::Mat image)
Sets the value for the private value img.
Definition: QReader.cpp:732
std::vector< uint8_t > decodeQR()
A function to get the raw image, find the QR code, unmask the QR code and decode the QR code in the i...
Definition: QReader.cpp:154
Class QReader has methods to get the image and decode the QR code in the image to extract data of pac...
Definition: QReader.hpp:50
TEST ( decodeQR  ,
mask0   
)

Testing if the decoder function can apply mask 0.

Parameters
[in]TESTSuite
[in]testService
Returns
none
96  {
97  std::string str;
98  std::string fileLocation =
99  ros::package::getPath("package_identification_using_turtlebot") +
100  "/data/pack1.png";
101  cv::Mat image = cv::imread(fileLocation);
102  QReader reader;
103  reader.setImage(image);
104  std::vector<uint8_t> result = reader.decodeQR();
105  str.assign(result.begin(), result.end());
106  ASSERT_STREQ("pack#1", str.c_str());
107 }
void setImage(cv::Mat image)
Sets the value for the private value img.
Definition: QReader.cpp:732
std::vector< uint8_t > decodeQR()
A function to get the raw image, find the QR code, unmask the QR code and decode the QR code in the i...
Definition: QReader.cpp:154
Class QReader has methods to get the image and decode the QR code in the image to extract data of pac...
Definition: QReader.hpp:50
TEST ( decodeQR  ,
mask1   
)

Testing if the decoder function can apply mask 1.

Parameters
[in]TESTSuite
[in]testService
Returns
none
117  {
118  std::string str;
119  std::string fileLocation =
120  ros::package::getPath("package_identification_using_turtlebot") +
121  "/data/pack5.png";
122  cv::Mat image = cv::imread(fileLocation);
123  QReader reader;
124  reader.setImage(image);
125  std::vector<uint8_t> result = reader.decodeQR();
126  str.assign(result.begin(), result.end());
127  ASSERT_STREQ("pack#5", str.c_str());
128 }
void setImage(cv::Mat image)
Sets the value for the private value img.
Definition: QReader.cpp:732
std::vector< uint8_t > decodeQR()
A function to get the raw image, find the QR code, unmask the QR code and decode the QR code in the i...
Definition: QReader.cpp:154
Class QReader has methods to get the image and decode the QR code in the image to extract data of pac...
Definition: QReader.hpp:50
TEST ( decodeQR  ,
unknownImage   
)

Testing if the decoder function to check handling of unknown images.

Parameters
[in]TESTSuite
[in]testService
Returns
none
139  {
140  std::string str;
141  std::string fileLocation =
142  ros::package::getPath("package_identification_using_turtlebot") +
143  "/data/unknown.png";
144  cv::Mat image = cv::imread(fileLocation);
145  QReader reader;
146  reader.setImage(image);
147  std::vector<uint8_t> result = reader.decodeQR();
148  str.assign(result.begin(), result.end());
149  ASSERT_STREQ("unknown", str.c_str());
150 }
void setImage(cv::Mat image)
Sets the value for the private value img.
Definition: QReader.cpp:732
std::vector< uint8_t > decodeQR()
A function to get the raw image, find the QR code, unmask the QR code and decode the QR code in the i...
Definition: QReader.cpp:154
Class QReader has methods to get the image and decode the QR code in the image to extract data of pac...
Definition: QReader.hpp:50
TEST ( decodeQR  ,
mask6   
)

Testing if the decoder function can apply mask 6.

Parameters
[in]TESTSuite
[in]testService
Returns
none
160  {
161  std::string str;
162  std::string fileLocation =
163  ros::package::getPath("package_identification_using_turtlebot") +
164  "/data/random.png";
165  cv::Mat image = cv::imread(fileLocation);
166  QReader reader;
167  reader.setImage(image);
168  std::vector<uint8_t> result = reader.decodeQR();
169  str.assign(result.begin(), result.end());
170  ASSERT_STREQ("gfgdWcvd", str.c_str());
171 }
void setImage(cv::Mat image)
Sets the value for the private value img.
Definition: QReader.cpp:732
std::vector< uint8_t > decodeQR()
A function to get the raw image, find the QR code, unmask the QR code and decode the QR code in the i...
Definition: QReader.cpp:154
Class QReader has methods to get the image and decode the QR code in the image to extract data of pac...
Definition: QReader.hpp:50
TEST ( decodeQR  ,
mask3   
)

Testing if the decoder function can apply mask 3.

Parameters
[in]TESTSuite
[in]testService
Returns
none
181  {
182  std::string str;
183  std::string fileLocation =
184  ros::package::getPath("package_identification_using_turtlebot") +
185  "/data/mask3.png";
186  cv::Mat image = cv::imread(fileLocation);
187  QReader reader;
188  reader.setImage(image);
189  std::vector<uint8_t> result = reader.decodeQR();
190  str.assign(result.begin(), result.end());
191  ASSERT_STREQ("unknown", str.c_str());
192 }
void setImage(cv::Mat image)
Sets the value for the private value img.
Definition: QReader.cpp:732
std::vector< uint8_t > decodeQR()
A function to get the raw image, find the QR code, unmask the QR code and decode the QR code in the i...
Definition: QReader.cpp:154
Class QReader has methods to get the image and decode the QR code in the image to extract data of pac...
Definition: QReader.hpp:50
TEST ( decodeQR  ,
mask7   
)

Testing if the decoder function can apply mask 7.

Parameters
[in]TESTSuite
[in]testService
Returns
none
202  {
203  std::string str;
204  std::string fileLocation =
205  ros::package::getPath("package_identification_using_turtlebot") +
206  "/data/mask7.png";
207  cv::Mat image = cv::imread(fileLocation);
208  QReader reader;
209  reader.setImage(image);
210  std::vector<uint8_t> result = reader.decodeQR();
211  str.assign(result.begin(), result.end());
212  ASSERT_STREQ("unknown", str.c_str());
213 }
void setImage(cv::Mat image)
Sets the value for the private value img.
Definition: QReader.cpp:732
std::vector< uint8_t > decodeQR()
A function to get the raw image, find the QR code, unmask the QR code and decode the QR code in the i...
Definition: QReader.cpp:154
Class QReader has methods to get the image and decode the QR code in the image to extract data of pac...
Definition: QReader.hpp:50