#include <iostream>
#include <iomanip>
#include <Utils/Param.hh>
#include <Base/Image/ImageBase.hh>
#include <Base/Image/ImageConvert.hh>
#include <Base/Image/ImageIO.hh>
#include <Matcher2D/RegionMatcher.hh>
using namespace BIAS;
using namespace std;
int demo(unsigned int size) {
unsigned int chess_field_size=size/8;
unsigned int x=0, y=0, c=0, r=0;
unsigned char red=89,blue=127;
for (x=0;x<im.
GetWidth(); x+= chess_field_size) {
if (red==127) red=89; else red=127;
if (blue==127) blue=25; else blue=127;
for (y=0;y<im.
GetHeight(); y+= chess_field_size) {
if (red==127) red=89; else red=127;
if (blue==127) blue=25; else blue=127;
for (r=0; r<chess_field_size; r++)
for (c=0; c<chess_field_size; c++){
ida[y+r][(x+c)*3 + 0]=red;
ida[y+r][(x+c)*3 + 1]=255;
ida[y+r][(x+c)*3 + 2]=blue;
}
}
}
int n=1;
double result=0;
unsigned int p1[2], p2[2];
p1[0]=chess_field_size; p1[1]= chess_field_size;
for (x=chess_field_size-n;x<=chess_field_size+n;x++) {
for (y=chess_field_size-n;y<=chess_field_size+n;y++) {
p2[0]=x; p2[1]=y;
3, result);
cout<<"["<<p2[0]<<","<<p2[1]<<"]:"<<setprecision(2)<<result<<" ";
}
cout<<endl;
}
cout<<endl;
for (x=chess_field_size-n;x<=chess_field_size+n;x++) {
for (y=chess_field_size-n;y<=chess_field_size+n;y++) {
p2[0]=x; p2[1]=y;
3, result);
cout<<"["<<p2[0]<<","<<p2[1]<<"]:"<<setprecision(2)<<result<<" ";
}
cout<<endl;
}
BIASERR("error writing image ");
return -2;
}
BIASERR("error writing image ");
return -2;
}
BIASERR("error exporting image ");
return -2;
}
return 0;
}
int main(int argc, char *argv[])
{
"only writes colored chessboard image",false);
params.
AddParamInt(
"winSize",
"the odd half window size of the CNCC operator",
5,3,1001,'w');
params.
AddParamVecDbl(
"pos",
"the position in the image where the CNCC"
" is applied, if only a single image is given",
"10 10");
" second image","",'I');
cout<<argv[0]<<" [options] <file1> <file2>"<<endl;
cout<<"CNCC is applied to image1 at the given position(defualt is 10,10)."
<<endl<<" if a second image is given CNCC is applied at every pixel in"
" both images at the same position"<<endl;
exit(0);
}
unsigned int size=800;
exit(demo(size));
exit (-1);
}
imgColorRes.FillImageWithConstValue((unsigned char)0);
unsigned int winSizeNCC= *params.
GetParamInt(
"winSize");
unsigned char **idaRes=imgColorRes.GetImageDataArray();
unsigned int x,y,p1[2], p2[2];
double result=0;
exit (-1);
}
for (y=winSizeNCC;y<imHSV1.GetHeight()-winSizeNCC-1; y++) {
std::cerr << "Processing ColorNCC " <<
(int)((double)(y-winSizeNCC) /
(double)(imHSV1.GetHeight()-winSizeNCC-1)*100) << "%" << '\r';
for (x=winSizeNCC;x<imHSV1.GetWidth()-winSizeNCC-1; x++) {
p2[0]=x; p2[1]=y;
(const unsigned char**)imHSV1.GetImageDataArray(),
(const unsigned char**)imHSV2.GetImageDataArray(),
winSizeNCC, result);
if (result<0) result=0;
idaRes[y][x]=(unsigned char)(result*255.0);
}
}
BIASERR("error writing image resultCNCC");
return -2;
}
cout<<"result of Color NCC comparison bewtween image"<<
" resultCNCC.mip"<<endl;
for (y=winSizeNCC;y<imHSV1.GetHeight()-winSizeNCC-1; y++) {
std::cerr << "Processing Grey value NCC " <<
(int)((double)(y-winSizeNCC) /
(double)(imHSV1.GetHeight()-winSizeNCC-1)*100) << "%" << '\r';
for (x=winSizeNCC;x<imHSV1.GetWidth()-winSizeNCC-1; x++) {
p2[0]=x; p2[1]=y;
(const unsigned char**)imGrey2.GetImageDataArray(),
winSizeNCC, result);
if (result<0) result=0;
idaRes[y][x]=(unsigned char)(result*255.0);
}
}
BIASERR("error writing image resultNCC");
return -2;
}
cout<<"result of grey value NCC comparison bewtween image"<<
" resultNCC.mip"<<endl;
} else {
p1[0]=(unsigned int)pos[0]; p1[1]=(unsigned int)pos[1];
for (y=winSizeNCC;y<imHSV1.GetHeight()-winSizeNCC-1; y++) {
std::cerr << "Processing ColorNCC " <<
(int)((double)(y-winSizeNCC) /
(double)(imHSV1.GetHeight()-winSizeNCC-1)*100) << "%" << '\r';
for (x=winSizeNCC;x<imHSV1.GetWidth()-winSizeNCC-1; x++) {
p2[0]=x; p2[1]=y;
(const unsigned char**)imHSV1.GetImageDataArray(),
(const unsigned char**)imHSV1.GetImageDataArray(),
winSizeNCC, result);
if (result<0) result=0;
idaRes[y][x]=(unsigned char)(result*255.0);
}
}
BIASERR("error writing image resultCNCC");
return -2;
}
cout<<"result of Color NCC at "<<pos<<" written to resultCNCC.mip"<<endl;
for (y=winSizeNCC;y<imHSV1.GetHeight()-winSizeNCC-1; y++) {
std::cerr << "Processing Grey value NCC " <<
(int)((double)(y-winSizeNCC) /
(double)(imHSV1.GetHeight()-winSizeNCC-1)*100) << "%" << '\r';
for (x=winSizeNCC;x<imHSV1.GetWidth()-winSizeNCC-1; x++) {
p2[0]=x; p2[1]=y;
winSizeNCC, result);
if (result<0) result=0;
idaRes[y][x]=(unsigned char)(result*255.0);
}
}
BIASERR("error writing image resultNCC");
return -2;
}
cout<<"result of grey value NCC at "<<pos<<
" written to resultNCC.mip"<<endl;
}
return 0;
}