| [89] | 1 | /***************************************************************************
|
|---|
| 2 | *
|
|---|
| 3 | * Copyright 2000 by David Demirdjian. All rights reserved.
|
|---|
| 4 | *
|
|---|
| 5 | * Developed by David Demirdjian
|
|---|
| 6 | *
|
|---|
| 7 | * Permission to use, copy, or modify this software and its documentation
|
|---|
| 8 | * for educational and research purposes only and without fee is hereby
|
|---|
| 9 | * granted, provided that this copyright notice and the original authors's
|
|---|
| 10 | * names appear on all copies and supporting documentation. If individual
|
|---|
| 11 | * files are separated from this distribution directory structure, this
|
|---|
| 12 | * copyright notice must be included. For any other uses of this software,
|
|---|
| 13 | * in original or modified form, including but not limited to distribution
|
|---|
| 14 | * in whole or in part, specific prior permission must be obtained from
|
|---|
| 15 | * MIT. These programs shall not be used, rewritten, or adapted as the
|
|---|
| 16 | * basis of a commercial software or hardware product without first
|
|---|
| 17 | * obtaining appropriate licenses from David Demirdjian. The author makes
|
|---|
| 18 | * no representations about the suitability of this software for any purpose.
|
|---|
| 19 | * It is provided "as is" without express or implied warranty.
|
|---|
| 20 | *
|
|---|
| 21 | **************************************************************************/
|
|---|
| 22 | #ifndef _STEREOBUFFER_H
|
|---|
| 23 | #define _STEREOBUFFER_H
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 | // ********************************************************************
|
|---|
| 27 | // ********************************************************************
|
|---|
| 28 | // StereoBuffer: class containing all the buffers necessary for stereo
|
|---|
| 29 | // computation (at a fixed scale)
|
|---|
| 30 | class StereoBuffer {
|
|---|
| 31 | public:
|
|---|
| 32 | StereoBuffer();
|
|---|
| 33 | ~StereoBuffer();
|
|---|
| 34 |
|
|---|
| 35 | void setSize(int width, int height, int maxNbDepth);
|
|---|
| 36 | void alloc();
|
|---|
| 37 | void deAlloc();
|
|---|
| 38 | void allocTempBuffer16();
|
|---|
| 39 | void deAllocTempBuffer16();
|
|---|
| 40 |
|
|---|
| 41 | inline void filterSAD(int maskX, int maskY,
|
|---|
| 42 | unsigned char* ptBuff, unsigned short* ptBuff16,
|
|---|
| 43 | int backStep, int subImageSize, int offset);
|
|---|
| 44 |
|
|---|
| 45 | int width, height, maxNbDepth;
|
|---|
| 46 |
|
|---|
| 47 | // minimum disparity scores
|
|---|
| 48 | unsigned char* getCorrScores() const;
|
|---|
| 49 | // second minimum disparity scores
|
|---|
| 50 | unsigned char* getCorrScores_Sec() const;
|
|---|
| 51 |
|
|---|
| 52 | // buffers used for 8-bits use
|
|---|
| 53 | int buffStep;
|
|---|
| 54 | unsigned char** buff;
|
|---|
| 55 | unsigned char* bigBuffer, *bigBuffer_origin;
|
|---|
| 56 | unsigned short **buff16;
|
|---|
| 57 | unsigned short *bigBuffer16, *bigBuffer16_origin; // buffers used for 16-bits use
|
|---|
| 58 |
|
|---|
| 59 | // corr. scores associated with depth
|
|---|
| 60 | unsigned char* corrScore, *corrScoreSec;
|
|---|
| 61 | unsigned char* corrScore_origin, *corrScoreSec_origin; // corr. scores associated with depth
|
|---|
| 62 |
|
|---|
| 63 | // stereo grow
|
|---|
| 64 | unsigned char *imDepth_ref, *imDepth_ref_origin;
|
|---|
| 65 | unsigned short *Depth16, *Depth16_origin;
|
|---|
| 66 | unsigned short *buffTemp, *buffTemp_origin; // intermediate buffer used for 'sum_row' filtering (16-bits)
|
|---|
| 67 | unsigned char* count_non_null_pixels, *count_non_null_pixels_origin;
|
|---|
| 68 |
|
|---|
| 69 | };
|
|---|
| 70 |
|
|---|
| 71 | #include "stereobuffer.inl"
|
|---|
| 72 |
|
|---|
| 73 | #endif
|
|---|