41 #include <visp3/core/vpImageTools.h> 59 for (
unsigned int b = 0; b < n; b++) {
69 "(%ux%u) and (%ux%u) have not the same size",
77 for (
unsigned int b = 0; b < n; b++) {
92 const unsigned int width = 501, height = 447;
93 vpImage<unsigned char> I1(height,width), I2(height,width), Idiff_regular(height,width), Idiff_sse(height,width);
94 vpImage<vpRGBa> I1_color(height, width), I2_color(height, width), Idiff_regular_color(height, width), Idiff_sse_color(height, width);
95 for (
unsigned int i = 0; i < I1.
getRows(); i++) {
96 for (
unsigned int j = 0; j < I1.
getCols(); j++) {
97 I1[i][j] =
static_cast<unsigned char>(i*I1.
getCols() + j);
98 I1_color[i][j] =
vpRGBa(static_cast<unsigned char>(i*I1.
getCols() + j));
103 std::cout <<
"Grayscale:" << std::endl;
105 double t_regular = 0.0, t_sse = 0.0;
106 for (
unsigned int cpt = 0; cpt < 256; cpt++) {
107 for (
unsigned int i = 0; i < I2.
getRows(); i++) {
108 for (
unsigned int j = 0; j < I2.
getCols(); j++) {
109 I2[i][j] =
static_cast<unsigned char>(i*I2.
getCols() + j + cpt);
114 regularImageDifference(I1, I2, Idiff_regular);
121 bool same_result = Idiff_regular == Idiff_sse;
122 std::cout <<
"(Idiff_regular == Idiff_sse)? " << same_result << std::endl;
124 std::cerr <<
"Problem with vpImageTools::imageDifference()" << std::endl;
129 std::cout <<
"t_regular: " << t_regular <<
" ms ; mean t_regular: " << t_regular/256 <<
" ms" << std::endl;
130 std::cout <<
"t_sse: " << t_sse <<
" ms ; mean t_sse: " << t_sse/256 <<
" ms" << std::endl;
131 std::cout <<
"speed-up: " << t_regular / t_sse <<
" X" << std::endl;
135 std::cout <<
"\nColor:" << std::endl;
137 double t_regular = 0.0, t_sse = 0.0;
138 for (
unsigned int cpt = 0; cpt < 256; cpt++) {
139 for (
unsigned int i = 0; i < I2.
getRows(); i++) {
140 for (
unsigned int j = 0; j < I2.
getCols(); j++) {
141 I2_color[i][j] =
vpRGBa(static_cast<unsigned char>(i*I2.
getCols() + j + cpt));
146 regularImageDifference(I1_color, I2_color, Idiff_regular_color);
153 bool same_result = Idiff_regular_color == Idiff_sse_color;
154 std::cout <<
"(Idiff_regular_color == Idiff_sse_color)? " << same_result << std::endl;
156 std::cerr <<
"Problem with vpImageTools::imageDifference()" << std::endl;
161 std::cout <<
"t_regular: " << t_regular <<
" ms ; mean t_regular: " << t_regular/256 <<
" ms" << std::endl;
162 std::cout <<
"t_sse: " << t_sse <<
" ms ; mean t_sse: " << t_sse/256 <<
" ms" << std::endl;
163 std::cout <<
"speed-up: " << t_regular / t_sse <<
" X" << std::endl;
unsigned int getCols() const
unsigned int getWidth() const
unsigned char B
Blue component.
Type * bitmap
points toward the bitmap
error that can be emited by ViSP classes.
unsigned char G
Green component.
VISP_EXPORT double measureTimeMs()
static Type maximum(const Type &a, const Type &b)
unsigned int getRows() const
unsigned char A
Additionnal component.
void resize(const unsigned int h, const unsigned int w)
resize the image : Image initialization
static Type minimum(const Type &a, const Type &b)
unsigned char R
Red component.
unsigned int getHeight() const