00001 /* --------------------------------------------------------------------------- 00002 Phission : 00003 Realtime Vision Processing System 00004 00005 Copyright (C) 2002-2006 Philip D.S. Thoren (pthoren@cs.uml.edu) 00006 University of Massachusetts at Lowell, 00007 Laboratory for Artificial Intelligence and Robotics 00008 00009 Copyright (C) 2005 Mike Baker 00010 00011 This file is part of Phission. 00012 00013 Phission is free software; you can redistribute it and/or modify 00014 it under the terms of the GNU Lesser General Public License as published by 00015 the Free Software Foundation; either version 2 of the License, or 00016 (at your option) any later version. 00017 00018 Phission is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 GNU Lesser General Public License for more details. 00022 00023 You should have received a copy of the GNU Lesser General Public License 00024 along with Phission; if not, write to the Free Software 00025 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 00027 ---------------------------------------------------------------------------*/ 00028 #ifndef _DDIMAGE_FILTER_H 00029 #define _DDIMAGE_FILTER_H 00030 00036 #include <phFilter.h> 00037 00043 /* ------------------------------------------------------------------------ */ 00053 #define ddimage_BlockStandard 1 00054 00066 #define ddimage_BlockKernel 2 00067 /* ImageProcessing */ 00068 00074 /* ------------------------------------------------------------------------ */ 00243 PHAPI(class) ddimage_Filter : public phFilter 00244 { 00245 private: 00251 uint8_t **m_history; 00253 uint32_t *m_history_size; 00255 uint32_t m_history_count; 00256 00264 uint8_t *m_temp_frame; 00266 uint32_t m_temp_frame_size; 00267 00274 uint8_t **m_diff; 00278 uint32_t *m_diff_size; 00283 uint32_t m_diff_count; 00288 uint32_t m_diff_index; 00289 00294 uint32_t m_stride; 00295 00300 phImage *m_mask_image; 00302 uint8_t *m_mask; 00304 uint32_t m_mask_size; 00308 int m_domask; 00309 00314 uint32_t m_threshold; 00320 uint32_t m_pixel_threshold; 00326 uint32_t m_block_filter; 00327 00328 protected: 00329 int filter(); 00330 00331 public: 00364 ddimage_Filter( uint32_t threshold = 15, 00365 uint32_t stride = 2, 00366 uint32_t pixel_threshold= 0, 00367 uint32_t block_filter = ddimage_BlockKernel ); 00372 ~ddimage_Filter(); 00373 00401 int get(uint32_t *threshold, 00402 uint32_t *stride, 00403 uint32_t *pixel_threshold, 00404 uint32_t *block_filter ); 00405 00418 int setThreshold ( uint32_t threshold ); 00431 int setStride ( uint32_t stride ); 00446 int setPixelThreshold ( uint32_t pixel_threshold ); 00459 int setBlockFilter ( uint32_t block_filter ); 00460 00506 int set(uint32_t threshold, 00507 uint32_t stride, 00508 uint32_t pixel_threshold, 00509 uint32_t block_filter); 00510 00522 int enableMotionMask ( int enable = 1 ); 00534 int disableMotionMask ( int disable = 1); 00535 00546 phImage *getMaskImage(); 00547 00555 phFilter *cloneFilter(); 00556 00557 }; 00558 /* ImageProcessing */ 00560 00561 #endif /* _DDIMAGE_FILTER_H */ 00562 00563 /* Old documentation for when stride == 1 */ 00564 00565 /* We only need to do the difference once for each loop. 00566 * Since this is a series of streaming frames (3), 00567 * we've also a series of streaming difference frames (2) 00568 * of which we can use 1 during a future loop */ 00569 00570 /* Since we're saving the difference image from two future frames, 00571 * we no longer need 1 of the history frame buffers */ 00572 00573 /* Loop 0 00574 * Frames 0 1 2 00575 * DFrames X Y 00576 * 00577 * Save Y for the next loop around. 00578 * 00579 * Loop 1 00580 * Frames 1 2 3 00581 * DFrames Y Z 00582 * 00583 * Since we're using the saved Y values, we don't need #1. 00584 * 00585 * Also, #3 is the current frame, so we really only need to save 00586 * the frame from the last loop. 00587 */ 00588 00589
Copyright (C) 2002 - 2007 |
Philip D.S. Thoren ( pthoren@users.sourceforge.net ) University Of Massachusetts at Lowell Robotics Lab |