Commit 462891fa authored by kirov's avatar kirov
Browse files

First implementation of binning in the fillData() template function



git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@33 45c4679d-1946-429d-baad-37912b19538b
parent 1a0f66c6
......@@ -85,7 +85,9 @@ double FrameBuilder::dataXY( int x, int y )
template <class depth>
void FrameBuilder::fillData( unsigned char *ptr )
{
int x, y;
int x, bx, y, by;
int binX = m_bin.getX();
int binY = m_bin.getY();
int width = m_frame_dim.getSize().getWidth();
int height = m_frame_dim.getSize().getHeight();
depth *p = (depth *) ptr;
......@@ -93,9 +95,14 @@ void FrameBuilder::fillData( unsigned char *ptr )
max = (double) ((depth) -1);
for( y=0; y<height; y++ ) {
for( x=0; x<width; x++ ) {
data = dataXY(x, y);
for( by=0; by<height/binY; by++ ) {
for( bx=0; bx<width/binX; bx++ ) {
data = 0.0;
for( y=by*binY; y<by*binY+binY; y++ ) {
for( x=bx*binX; x<bx*binX+binX; x++ ) {
data += dataXY(x, y);
}
}
if( data > max ) data = max; // ???
*p++ = (depth) data;
}
......
......@@ -11,10 +11,17 @@ using namespace lima;
int main( void )
{
FrameBuilder fb;
FrameDim fd = fb.m_frame_dim;
int width = fd.getSize().getWidth();
int height = fd.getSize().getHeight();
int depth = fd.getDepth();
Bin bin = Bin(2,2);
fb.m_bin = bin;
int binX = bin.getX();
int binY = bin.getY();
BufferSave bs("boza", FMT_EDF);
unsigned char *buffer;
FrameInfoType finfo;
......@@ -33,8 +40,8 @@ int main( void )
finfo.acq_frame_nb = fb.getFrameNr();
finfo.frame_ptr = buffer;
finfo.width = width;
finfo.height = height;
finfo.width = width/binX;
finfo.height = height/binY;
finfo.depth = depth;
finfo.frame_time_stamp = 0; /* XXX */
......
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