#include <iostream>
#include <visp3/core/vpImageTools.h>
namespace {
{
}
for (unsigned int b = 0; b < n; b++) {
}
}
{
"(%ux%u) and (%ux%u) have not the same size",
}
for (unsigned int b = 0; b < n; b++) {
}
}
}
int main()
{
unsigned int width = 501, height = 447;
vpImage<unsigned char> I1(height,width), I2(height,width), Idiff_regular(height,width), Idiff_sse(height,width);
vpImage<vpRGBa> I1_color(height, width), I2_color(height, width), Idiff_regular_color(height, width), Idiff_sse_color(height, width);
for (unsigned int i = 0; i < I1.getRows(); i++) {
for (unsigned int j = 0; j < I1.getCols(); j++) {
I1[i][j] = static_cast<unsigned char>(i*I1.getCols() + j);
I1_color[i][j] =
vpRGBa(static_cast<unsigned char>(i*I1.getCols() + j));
}
}
{
std::cout << "Grayscale:" << std::endl;
double t_regular = 0.0, t_sse = 0.0;
for (unsigned int cpt = 0; cpt < 256; cpt++) {
for (unsigned int i = 0; i < I2.getRows(); i++) {
for (unsigned int j = 0; j < I2.getCols(); j++) {
I2[i][j] = static_cast<unsigned char>(i*I2.getCols() + j + cpt);
}
}
regularImageDifference(I1, I2, Idiff_regular);
if (Idiff_regular != Idiff_sse) {
std::cerr << "Problem with vpImageTools::imageDifference()" << std::endl;
return EXIT_FAILURE;
}
}
std::cout << "(Idiff_regular == Idiff_sse)" << std::endl;
std::cout << "t_regular: " << t_regular << " ms ; mean t_regular: " << t_regular/256 << " ms" << std::endl;
std::cout << "t_sse: " << t_sse << " ms ; mean t_sse: " << t_sse/256 << " ms" << std::endl;
std::cout << "speed-up: " << t_regular / t_sse << " X" << std::endl;
}
{
std::cout << "\nColor:" << std::endl;
double t_regular = 0.0, t_sse = 0.0;
for (unsigned int cpt = 0; cpt < 256; cpt++) {
for (unsigned int i = 0; i < I2.getRows(); i++) {
for (unsigned int j = 0; j < I2.getCols(); j++) {
I2_color[i][j] =
vpRGBa(static_cast<unsigned char>(i*I2.getCols() + j + cpt));
}
}
regularImageDifference(I1_color, I2_color, Idiff_regular_color);
if (Idiff_regular_color != Idiff_sse_color) {
std::cerr << "Problem with vpImageTools::imageDifference()" << std::endl;
return EXIT_FAILURE;
}
}
std::cout << "(Idiff_regular_color == Idiff_sse_color)" << std::endl;
std::cout << "t_regular: " << t_regular << " ms ; mean t_regular: " << t_regular/256 << " ms" << std::endl;
std::cout << "t_sse: " << t_sse << " ms ; mean t_sse: " << t_sse/256 << " ms" << std::endl;
std::cout << "speed-up: " << t_regular / t_sse << " X" << std::endl;
}
return EXIT_SUCCESS;
}