|
@@ -38,9 +38,10 @@ void CachedExample::init ()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-CachedExample::CachedExample ( const std::string & _imgfn,
|
|
|
- int _newWidth,
|
|
|
- int _newHeight )
|
|
|
+CachedExample::CachedExample (
|
|
|
+ const std::string & _imgfn,
|
|
|
+ int _newWidth,
|
|
|
+ int _newHeight )
|
|
|
{
|
|
|
imgfn.push_back(_imgfn);
|
|
|
newWidth = _newWidth;
|
|
@@ -105,7 +106,9 @@ CachedExample::CachedExample (
|
|
|
hasColorInformation = false;
|
|
|
}
|
|
|
|
|
|
-CachedExample::CachedExample ( const NICE::ColorImage & img, bool disableGrayConversion )
|
|
|
+CachedExample::CachedExample (
|
|
|
+ const NICE::ColorImage & img,
|
|
|
+ bool disableGrayConversion )
|
|
|
{
|
|
|
imgfn.push_back("");
|
|
|
oxsize = img.width();
|
|
@@ -239,24 +242,22 @@ void CachedExample::readImageData ()
|
|
|
else
|
|
|
imggray = orig;
|
|
|
|
|
|
+ // FIXME: gray values are saved twice (ichannels and ichannels3)
|
|
|
+ // for compatibility with all 2D programs that refer to ichannels
|
|
|
+ // which is of type MultiChannelImageT instead of MultiChannelImage3DT
|
|
|
if ( z == 0 )
|
|
|
{
|
|
|
oxsize = imggray.width();
|
|
|
oysize = imggray.height();
|
|
|
|
|
|
- if ( ozsize > 1 )
|
|
|
- ichannels3[I_GRAYVALUES].reInit( oxsize, oysize, ozsize, 1);
|
|
|
- else
|
|
|
- {
|
|
|
- ichannels[I_GRAYVALUES].freeData();
|
|
|
- ichannels[I_GRAYVALUES].addChannel(imggray);
|
|
|
- }
|
|
|
+ ichannels3[I_GRAYVALUES].reInit( oxsize, oysize, ozsize, 1);
|
|
|
+ ichannels[I_GRAYVALUES].freeData();
|
|
|
+ ichannels[I_GRAYVALUES].addChannel(imggray);
|
|
|
}
|
|
|
|
|
|
- if ( ozsize > 1 )
|
|
|
- for ( int y = 0; y < oysize; y++ )
|
|
|
- for ( int x = 0; x < oxsize; x++ )
|
|
|
- ichannels3[I_GRAYVALUES](x,y,z,0) = imggray.getPixel(x,y);
|
|
|
+ for ( int y = 0; y < oysize; y++ )
|
|
|
+ for ( int x = 0; x < oxsize; x++ )
|
|
|
+ ichannels3[I_GRAYVALUES](x,y,z,0) = imggray.getPixel(x,y);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -285,27 +286,20 @@ void CachedExample::readImageDataRGB ()
|
|
|
|
|
|
hasColorInformation = true;
|
|
|
|
|
|
- if ( ozsize > 1 )
|
|
|
- ichannels3[I_COLOR].reInit ( oxsize, oysize, ozsize, 3);
|
|
|
- else
|
|
|
- ichannels[I_COLOR].reInit ( oxsize, oysize, 3);
|
|
|
+ // FIXME: see readImageData issue
|
|
|
+ ichannels3[I_COLOR].reInit ( oxsize, oysize, ozsize, 3);
|
|
|
+ ichannels[I_COLOR].reInit ( oxsize, oysize, 3);
|
|
|
}
|
|
|
|
|
|
for ( int y = 0; y < oysize; y++ )
|
|
|
for ( int x = 0; x < oxsize; x++ )
|
|
|
{
|
|
|
- if ( ozsize > 1 )
|
|
|
- {
|
|
|
- ichannels3[I_COLOR](x,y,z,0) = img.getPixel(x,y,0);
|
|
|
- ichannels3[I_COLOR](x,y,z,1) = img.getPixel(x,y,1);
|
|
|
- ichannels3[I_COLOR](x,y,z,2) = img.getPixel(x,y,2);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ichannels[I_COLOR](x,y,0) = img.getPixel ( x, y, 0 );
|
|
|
- ichannels[I_COLOR](x,y,1) = img.getPixel ( x, y, 1 );
|
|
|
- ichannels[I_COLOR](x,y,2) = img.getPixel ( x, y, 2 );
|
|
|
- }
|
|
|
+ ichannels3[I_COLOR](x,y,z,0) = img.getPixel(x,y,0);
|
|
|
+ ichannels3[I_COLOR](x,y,z,1) = img.getPixel(x,y,1);
|
|
|
+ ichannels3[I_COLOR](x,y,z,2) = img.getPixel(x,y,2);
|
|
|
+ ichannels[I_COLOR](x,y,0) = img.getPixel ( x, y, 0 );
|
|
|
+ ichannels[I_COLOR](x,y,1) = img.getPixel ( x, y, 1 );
|
|
|
+ ichannels[I_COLOR](x,y,2) = img.getPixel ( x, y, 2 );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -371,9 +365,10 @@ void CachedExample::calcIntegralImage ()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void CachedExample::buildIntegralSV ( int svchannel,
|
|
|
- NICE::SparseVector *_map,
|
|
|
- int xsize_s, int ysize_s )
|
|
|
+void CachedExample::buildIntegralSV (
|
|
|
+ int svchannel,
|
|
|
+ NICE::SparseVector *_map,
|
|
|
+ int xsize_s, int ysize_s )
|
|
|
{
|
|
|
NICE::SparseVector *map = _map;
|
|
|
svmap[svchannel] = _map;
|
|
@@ -401,9 +396,10 @@ void CachedExample::buildIntegralSV ( int svchannel,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void CachedExample::setSVMap ( int svchannel,
|
|
|
- NICE::SparseVector *_map,
|
|
|
- int xsize_s, int ysize_s )
|
|
|
+void CachedExample::setSVMap (
|
|
|
+ int svchannel,
|
|
|
+ NICE::SparseVector *_map,
|
|
|
+ int xsize_s, int ysize_s )
|
|
|
{
|
|
|
svmap[svchannel] = _map;
|
|
|
svmap_xsize[svchannel] = xsize_s;
|