Commit 51884d9a authored by jaco's avatar jaco

wip windows BYTE type error

parent 73b6dcd8
...@@ -82,7 +82,7 @@ typedef void *HANDLE; ...@@ -82,7 +82,7 @@ typedef void *HANDLE;
#endif #endif
#ifndef _MSC_VER #ifndef _MSC_VER
typedef unsigned char byte; typedef unsigned char BYTE;
#endif #endif
typedef std::vector<int> vecI; typedef std::vector<int> vecI;
......
...@@ -88,12 +88,12 @@ Mat FilterTIG::matchTemplate( const Mat &mag1u ) ...@@ -88,12 +88,12 @@ Mat FilterTIG::matchTemplate( const Mat &mag1u )
const Size sz( W + 1, H + 1 ); // Expand original size to avoid dealing with boundary conditions const Size sz( W + 1, H + 1 ); // Expand original size to avoid dealing with boundary conditions
Mat_<int64_t> Tig1 = Mat_<int64_t>::zeros( sz ), Tig2 = Mat_<int64_t>::zeros( sz ); Mat_<int64_t> Tig1 = Mat_<int64_t>::zeros( sz ), Tig2 = Mat_<int64_t>::zeros( sz );
Mat_<int64_t> Tig4 = Mat_<int64_t>::zeros( sz ), Tig8 = Mat_<int64_t>::zeros( sz ); Mat_<int64_t> Tig4 = Mat_<int64_t>::zeros( sz ), Tig8 = Mat_<int64_t>::zeros( sz );
Mat_<byte> Row1 = Mat_<byte>::zeros( sz ), Row2 = Mat_<byte>::zeros( sz ); Mat_<BYTE> Row1 = Mat_<BYTE>::zeros( sz ), Row2 = Mat_<BYTE>::zeros( sz );
Mat_<byte> Row4 = Mat_<byte>::zeros( sz ), Row8 = Mat_<byte>::zeros( sz ); Mat_<BYTE> Row4 = Mat_<BYTE>::zeros( sz ), Row8 = Mat_<BYTE>::zeros( sz );
Mat_<float> scores( sz ); Mat_<float> scores( sz );
for ( int y = 1; y <= H; y++ ) for ( int y = 1; y <= H; y++ )
{ {
const byte* G = mag1u.ptr<byte>( y - 1 ); const BYTE* G = mag1u.ptr<BYTE>( y - 1 );
int64_t* T1 = Tig1.ptr<int64_t>( y ); // Binary TIG of current row int64_t* T1 = Tig1.ptr<int64_t>( y ); // Binary TIG of current row
int64_t* T2 = Tig2.ptr<int64_t>( y ); int64_t* T2 = Tig2.ptr<int64_t>( y );
int64_t* T4 = Tig4.ptr<int64_t>( y ); int64_t* T4 = Tig4.ptr<int64_t>( y );
...@@ -102,14 +102,14 @@ Mat FilterTIG::matchTemplate( const Mat &mag1u ) ...@@ -102,14 +102,14 @@ Mat FilterTIG::matchTemplate( const Mat &mag1u )
int64_t* Tu2 = Tig2.ptr<int64_t>( y - 1 ); int64_t* Tu2 = Tig2.ptr<int64_t>( y - 1 );
int64_t* Tu4 = Tig4.ptr<int64_t>( y - 1 ); int64_t* Tu4 = Tig4.ptr<int64_t>( y - 1 );
int64_t* Tu8 = Tig8.ptr<int64_t>( y - 1 ); int64_t* Tu8 = Tig8.ptr<int64_t>( y - 1 );
byte* R1 = Row1.ptr<byte>( y ); BYTE* R1 = Row1.ptr<BYTE>( y );
byte* R2 = Row2.ptr<byte>( y ); BYTE* R2 = Row2.ptr<BYTE>( y );
byte* R4 = Row4.ptr<byte>( y ); BYTE* R4 = Row4.ptr<BYTE>( y );
byte* R8 = Row8.ptr<byte>( y ); BYTE* R8 = Row8.ptr<BYTE>( y );
float *s = scores.ptr<float>( y ); float *s = scores.ptr<float>( y );
for ( int x = 1; x <= W; x++ ) for ( int x = 1; x <= W; x++ )
{ {
byte g = G[x - 1]; BYTE g = G[x - 1];
R1[x] = ( R1[x - 1] << 1 ) | ( ( g >> 4 ) & 1 ); R1[x] = ( R1[x - 1] << 1 ) | ( ( g >> 4 ) & 1 );
R2[x] = ( R2[x - 1] << 1 ) | ( ( g >> 5 ) & 1 ); R2[x] = ( R2[x - 1] << 1 ) | ( ( g >> 5 ) & 1 );
R4[x] = ( R4[x - 1] << 1 ) | ( ( g >> 6 ) & 1 ); R4[x] = ( R4[x - 1] << 1 ) | ( ( g >> 6 ) & 1 );
......
...@@ -230,7 +230,7 @@ void ObjectnessBING::nonMaxSup( CMat &matchCost1f, ValStructVec<float, Point> &m ...@@ -230,7 +230,7 @@ void ObjectnessBING::nonMaxSup( CMat &matchCost1f, ValStructVec<float, Point> &m
for ( int i = 0; i < valPnt.size(); i++ ) for ( int i = 0; i < valPnt.size(); i++ )
{ {
Point &pnt = valPnt[i]; Point &pnt = valPnt[i];
if( isMax1u.at<byte>( pnt ) ) if( isMax1u.at<BYTE>( pnt ) )
{ {
matchCost.pushBack( valPnt( i ), pnt ); matchCost.pushBack( valPnt( i ), pnt );
for ( int dy = -NSS; dy <= NSS; dy++ ) for ( int dy = -NSS; dy <= NSS; dy++ )
...@@ -239,7 +239,7 @@ void ObjectnessBING::nonMaxSup( CMat &matchCost1f, ValStructVec<float, Point> &m ...@@ -239,7 +239,7 @@ void ObjectnessBING::nonMaxSup( CMat &matchCost1f, ValStructVec<float, Point> &m
Point neighbor = pnt + Point( dx, dy ); Point neighbor = pnt + Point( dx, dy );
if( !CHK_IND( neighbor ) ) if( !CHK_IND( neighbor ) )
continue; continue;
isMax1u.at<byte>( neighbor ) = false; isMax1u.at<BYTE>( neighbor ) = false;
} }
} }
if( matchCost.size() >= maxPoint ) if( matchCost.size() >= maxPoint )
...@@ -311,24 +311,24 @@ void ObjectnessBING::gradientGray( CMat &bgr3u, Mat &mag1u ) ...@@ -311,24 +311,24 @@ void ObjectnessBING::gradientGray( CMat &bgr3u, Mat &mag1u )
// Left/right most column Ix // Left/right most column Ix
for ( int y = 0; y < H; y++ ) for ( int y = 0; y < H; y++ )
{ {
Ix.at<int>( y, 0 ) = abs( g1u.at<byte>( y, 1 ) - g1u.at<byte>( y, 0 ) ) * 2; Ix.at<int>( y, 0 ) = abs( g1u.at<BYTE>( y, 1 ) - g1u.at<BYTE>( y, 0 ) ) * 2;
Ix.at<int>( y, W - 1 ) = abs( g1u.at<byte>( y, W - 1 ) - g1u.at<byte>( y, W - 2 ) ) * 2; Ix.at<int>( y, W - 1 ) = abs( g1u.at<BYTE>( y, W - 1 ) - g1u.at<BYTE>( y, W - 2 ) ) * 2;
} }
// Top/bottom most column Iy // Top/bottom most column Iy
for ( int x = 0; x < W; x++ ) for ( int x = 0; x < W; x++ )
{ {
Iy.at<int>( 0, x ) = abs( g1u.at<byte>( 1, x ) - g1u.at<byte>( 0, x ) ) * 2; Iy.at<int>( 0, x ) = abs( g1u.at<BYTE>( 1, x ) - g1u.at<BYTE>( 0, x ) ) * 2;
Iy.at<int>( H - 1, x ) = abs( g1u.at<byte>( H - 1, x ) - g1u.at<byte>( H - 2, x ) ) * 2; Iy.at<int>( H - 1, x ) = abs( g1u.at<BYTE>( H - 1, x ) - g1u.at<BYTE>( H - 2, x ) ) * 2;
} }
// Find the gradient for inner regions // Find the gradient for inner regions
for ( int y = 0; y < H; y++ ) for ( int y = 0; y < H; y++ )
for ( int x = 1; x < W - 1; x++ ) for ( int x = 1; x < W - 1; x++ )
Ix.at<int>( y, x ) = abs( g1u.at<byte>( y, x + 1 ) - g1u.at<byte>( y, x - 1 ) ); Ix.at<int>( y, x ) = abs( g1u.at<BYTE>( y, x + 1 ) - g1u.at<BYTE>( y, x - 1 ) );
for ( int y = 1; y < H - 1; y++ ) for ( int y = 1; y < H - 1; y++ )
for ( int x = 0; x < W; x++ ) for ( int x = 0; x < W; x++ )
Iy.at<int>( y, x ) = abs( g1u.at<byte>( y + 1, x ) - g1u.at<byte>( y - 1, x ) ); Iy.at<int>( y, x ) = abs( g1u.at<BYTE>( y + 1, x ) - g1u.at<BYTE>( y - 1, x ) );
gradientXY( Ix, Iy, mag1u ); gradientXY( Ix, Iy, mag1u );
} }
...@@ -372,7 +372,7 @@ void ObjectnessBING::gradientXY( CMat &x1i, CMat &y1i, Mat &mag1u ) ...@@ -372,7 +372,7 @@ void ObjectnessBING::gradientXY( CMat &x1i, CMat &y1i, Mat &mag1u )
for ( int r = 0; r < H; r++ ) for ( int r = 0; r < H; r++ )
{ {
const int *x = x1i.ptr<int>( r ), *y = y1i.ptr<int>( r ); const int *x = x1i.ptr<int>( r ), *y = y1i.ptr<int>( r );
byte* m = mag1u.ptr<byte>( r ); BYTE* m = mag1u.ptr<BYTE>( r );
for ( int c = 0; c < W; c++ ) for ( int c = 0; c < W; c++ )
m[c] = min( x[c] + y[c], 255 ); //((int)sqrt(sqr(x[c]) + sqr(y[c])), 255); m[c] = min( x[c] + y[c], 255 ); //((int)sqrt(sqr(x[c]) + sqr(y[c])), 255);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment