From: Dominic L. <ma...@us...> - 2004-08-16 19:35:45
|
Update of /cvsroot/robotflow/RobotFlow/Vision/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16101 Modified Files: Components.cc Log Message: fixed wrong index if image is not of RGB15 value, throw exception when wrong image format Index: Components.cc =================================================================== RCS file: /cvsroot/robotflow/RobotFlow/Vision/src/Components.cc,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Components.cc 13 Aug 2004 15:52:45 -0000 1.8 --- Components.cc 16 Aug 2004 19:35:35 -0000 1.9 *************** *** 159,165 **** ! ! get_components(data); ! --- 159,165 ---- ! if (data) { ! get_components(data); ! } *************** *** 307,311 **** ////////////////////////////////////////////////////////////////////*/ void Components::initialize (int width, int height, int num_colors) { ! //creating data structures if (!m_rect_array) { --- 307,311 ---- ////////////////////////////////////////////////////////////////////*/ void Components::initialize (int width, int height, int num_colors) { ! //creating data structures if (!m_rect_array) { *************** *** 353,357 **** //color lookup ! value = m_color_table[*image_ptr++]; // if (i < 3 || i > m_height -3) continue; --- 353,357 ---- //color lookup ! value = m_color_table[(*image_ptr++) & 0x7FFF]; // if (i < 3 || i > m_height -3) continue; *************** *** 361,366 **** if (value >> index & 0x1) { - - if (m_cell_list[index][i].empty()) { my_cell = &m_cell_array[m_cell_count++]; --- 361,364 ---- *************** *** 368,374 **** my_cell->set_color(index); m_cell_list[index][i].push_back(my_cell); - } - else { old_cell = m_cell_list[index][i].back(); --- 366,370 ---- *************** *** 385,397 **** } - if (m_cell_count == MAX_CELLS) { cerr<<"Too many cells!"<<endl; return; ! } ! ! } - } } --- 381,389 ---- } if (m_cell_count == MAX_CELLS) { cerr<<"Too many cells!"<<endl; return; ! } } } } *************** *** 468,471 **** --- 460,467 ---- Image &image = object_cast<Image>(getInput(m_imageID,count)); + if (image.get_pixelsize() != 2) { + throw new GeneralException("Must have a RGB15 image format",__FILE__,__LINE__); + } + //cerr<<"getting lookup"<<endl; ColorLookup &lookup = object_cast<ColorLookup>(getInput(m_lookupID,count)); |