OSDN Git Service

CUDA
[eos/hostdependX86LINUX64.git] / util / X86LINUX64 / cuda-6.5 / include / nppi_computer_vision.h
1  /* Copyright 2009-2014 NVIDIA Corporation.  All rights reserved. 
2   * 
3   * NOTICE TO LICENSEE: 
4   * 
5   * The source code and/or documentation ("Licensed Deliverables") are 
6   * subject to NVIDIA intellectual property rights under U.S. and 
7   * international Copyright laws. 
8   * 
9   * The Licensed Deliverables contained herein are PROPRIETARY and 
10   * CONFIDENTIAL to NVIDIA and are being provided under the terms and 
11   * conditions of a form of NVIDIA software license agreement by and 
12   * between NVIDIA and Licensee ("License Agreement") or electronically 
13   * accepted by Licensee.  Notwithstanding any terms or conditions to 
14   * the contrary in the License Agreement, reproduction or disclosure 
15   * of the Licensed Deliverables to any third party without the express 
16   * written consent of NVIDIA is prohibited. 
17   * 
18   * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE 
19   * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE 
20   * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE.  THEY ARE 
21   * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND. 
22   * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED 
23   * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, 
24   * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. 
25   * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE 
26   * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY 
27   * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY 
28   * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
29   * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
30   * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
31   * OF THESE LICENSED DELIVERABLES. 
32   * 
33   * U.S. Government End Users.  These Licensed Deliverables are a 
34   * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT 
35   * 1995), consisting of "commercial computer software" and "commercial 
36   * computer software documentation" as such terms are used in 48 
37   * C.F.R. 12.212 (SEPT 1995) and are provided to the U.S. Government 
38   * only as a commercial end item.  Consistent with 48 C.F.R.12.212 and 
39   * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all 
40   * U.S. Government End Users acquire the Licensed Deliverables with 
41   * only those rights set forth herein. 
42   * 
43   * Any use of the Licensed Deliverables in individual and commercial 
44   * software must include, in the user documentation and internal 
45   * comments to the code, the above Disclaimer and U.S. Government End 
46   * Users Notice. 
47   */ 
48 #ifndef NV_NPPI_COMPUTER_VISION_H
49 #define NV_NPPI_COMPUTER_VISION_H
50  
51 /**
52  * \file nppi_computer_vision.h
53  * NPP Image Processing Functionality.
54  */
55  
56 #include "nppdefs.h"
57
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62
63 /** @defgroup image_labeling_and_segmentation Labeling and Segmentation
64  *  @ingroup nppi
65  *
66  * Pixel labeling and image segementation operations.
67  *
68  * @{
69  *
70  */
71
72 #if defined (__cplusplus)
73 struct NppiGraphcutState;
74 #else
75 typedef struct NppiGraphcutState NppiGraphcutState;
76 #endif
77
78 /** @defgroup image_graphcut GraphCut
79  *
80  * @{
81  *
82  */
83
84 /** @name Graphcut
85  *
86  * @{
87  *
88  */
89
90 /**
91  * Calculates the size of the temporary buffer for graph-cut with 4 neighborhood labeling.
92  *
93  * \see nppiGraphcutInitAlloc(), nppiGraphcut_32s8u().
94  * 
95  * \param oSize Graph size.
96  * \param pBufSize Pointer to variable that returns the size of the
97  *        temporary buffer. 
98  *
99  * \return NPP_SUCCESS Indicates no error. Any other value indicates an error
100  *         or a warning
101  * \return NPP_SIZE_ERROR Indicates an error condition if any image dimension
102  *         has zero or negative value
103  * \return NPP_NULL_POINTER_ERROR Indicates an error condition if pBufSize
104  *         pointer is NULL
105  */
106 NppStatus nppiGraphcutGetSize(NppiSize oSize, int * pBufSize);
107
108 /**
109  * Calculates the size of the temporary buffer for graph-cut with 8 neighborhood labeling.
110  *
111  * \see nppiGraphcut8InitAlloc(), nppiGraphcut8_32s8u().
112  * 
113  * \param oSize Graph size.
114  * \param pBufSize Pointer to variable that returns the size of the
115  *        temporary buffer. 
116  *
117  * \return NPP_SUCCESS Indicates no error. Any other value indicates an error
118  *         or a warning
119  * \return NPP_SIZE_ERROR Indicates an error condition if any image dimension
120  *         has zero or negative value
121  * \return NPP_NULL_POINTER_ERROR Indicates an error condition if pBufSize
122  *         pointer is NULL
123  */
124 NppStatus nppiGraphcut8GetSize(NppiSize oSize, int * pBufSize);
125
126 /**
127  * Initializes graph-cut state structure and allocates additional resources for graph-cut with 8 neighborhood labeling.
128  *
129  * \see nppiGraphcut_32s8u(), nppiGraphcutGetSize().
130  * 
131  * \param oSize Graph size
132  * \param ppState Pointer to pointer to graph-cut state structure. 
133  * \param pDeviceMem pDeviceMem to the sufficient amount of device memory. The CUDA runtime or NPP memory allocators
134  *      must be used to allocate this memory. The minimum amount of device memory required
135  *      to run graph-cut on a for a specific image size is computed by nppiGraphcutGetSize().
136  *
137  * \return NPP_SUCCESS Indicates no error. Any other value indicates an error
138  *         or a warning
139  * \return NPP_SIZE_ERROR Indicates an error condition if any image dimension
140  *         has zero or negative value
141  * \return NPP_NULL_POINTER_ERROR Indicates an error condition if pBufSize
142  *         pointer is NULL
143  */
144 NppStatus nppiGraphcutInitAlloc(NppiSize oSize, NppiGraphcutState** ppState, Npp8u* pDeviceMem);
145
146 /**
147  * Allocates and initializes the graph-cut state structure and additional resources for graph-cut with 8 neighborhood labeling.
148  *
149  * \see nppiGraphcut8_32s8u(), nppiGraphcut8GetSize().
150  * 
151  * \param oSize Graph size
152  * \param ppState Pointer to pointer to graph-cut state structure. 
153  * \param pDeviceMem to the sufficient amount of device memory. The CUDA runtime or NPP memory allocators
154  *      must be used to allocate this memory. The minimum amount of device memory required
155  *      to run graph-cut on a for a specific image size is computed by nppiGraphcut8GetSize().
156  *
157  * \return NPP_SUCCESS Indicates no error. Any other value indicates an error
158  *         or a warning
159  * \return NPP_SIZE_ERROR Indicates an error condition if any image dimension
160  *         has zero or negative value
161  * \return NPP_NULL_POINTER_ERROR Indicates an error condition if pBufSize
162  *         pointer is NULL
163  */
164 NppStatus nppiGraphcut8InitAlloc(NppiSize oSize, NppiGraphcutState ** ppState, Npp8u * pDeviceMem);
165
166 /**
167  * Frees the additional resources of the graph-cut state structure.
168  *
169  * \see nppiGraphcutInitAlloc
170  * \see nppiGraphcut8InitAlloc
171  * 
172  * \param pState Pointer to graph-cut state structure. 
173  *
174  * \return NPP_SUCCESS Indicates no error. Any other value indicates an error
175  *         or a warning
176  * \return NPP_SIZE_ERROR Indicates an error condition if any image dimension
177  *         has zero or negative value
178  * \return NPP_NULL_POINTER_ERROR Indicates an error condition if pState
179  *         pointer is NULL
180  */
181 NppStatus nppiGraphcutFree(NppiGraphcutState * pState);
182
183 /**
184  * Graphcut of a flow network (32bit signed integer edge capacities). The
185  * function computes the minimal cut (graphcut) of a 2D regular 4-connected
186  * graph. 
187  * The inputs are the capacities of the horizontal (in transposed form),
188  * vertical and terminal (source and sink) edges. The capacities to source and
189  * sink 
190  * are stored as capacity differences in the terminals array 
191  * ( terminals(x) = source(x) - sink(x) ). The implementation assumes that the
192  * edge capacities 
193  * for boundary edges that would connect to nodes outside the specified domain
194  * are set to 0 (for example left(0,*) == 0). If this is not fulfilled the
195  * computed labeling may be wrong!
196  * The computed binary labeling is encoded as unsigned 8bit values (0 and >0).
197  *
198  * \see nppiGraphcutInitAlloc(), nppiGraphcutFree(), nppiGraphcutGetSize().
199  *
200  * \param pTerminals Pointer to differences of terminal edge capacities
201  *        (terminal(x) = source(x) - sink(x))
202  * \param pLeftTransposed Pointer to transposed left edge capacities
203  *        (left(0,*) must be 0)
204  * \param pRightTransposed Pointer to transposed right edge capacities
205  *        (right(width-1,*) must be 0)
206  * \param pTop Pointer to top edge capacities (top(*,0) must be 0)
207  * \param pBottom Pointer to bottom edge capacities (bottom(*,height-1)
208  *        must be 0)
209  * \param nStep Step in bytes between any pair of sequential rows of edge
210  *        capacities
211  * \param nTransposedStep Step in bytes between any pair of sequential
212  *        rows of tranposed edge capacities
213  * \param size Graph size
214  * \param pLabel Pointer to destination label image 
215  * \param nLabelStep Step in bytes between any pair of sequential rows of
216  *        label image
217  * \param pState Pointer to graph-cut state structure. This structure must be
218  *          initialized allocated and initialized using nppiGraphcutInitAlloc().
219  * \return \ref image_data_error_codes, \ref roi_error_codes
220  */
221 NppStatus nppiGraphcut_32s8u(Npp32s * pTerminals, Npp32s * pLeftTransposed, Npp32s * pRightTransposed, Npp32s * pTop, Npp32s * pBottom, int nStep, int nTransposedStep, NppiSize size, Npp8u * pLabel, int nLabelStep, NppiGraphcutState *pState);
222
223
224 /**
225  * Graphcut of a flow network (32bit signed integer edge capacities). The
226  * function computes the minimal cut (graphcut) of a 2D regular 8-connected
227  * graph. 
228  * The inputs are the capacities of the horizontal (in transposed form),
229  * vertical and terminal (source and sink) edges. The capacities to source and
230  * sink 
231  * are stored as capacity differences in the terminals array 
232  * ( terminals(x) = source(x) - sink(x) ). The implementation assumes that the
233  * edge capacities 
234  * for boundary edges that would connect to nodes outside the specified domain
235  * are set to 0 (for example left(0,*) == 0). If this is not fulfilled the
236  * computed labeling may be wrong!
237  * The computed binary labeling is encoded as unsigned 8bit values (0 and >0).
238  *
239  * \see nppiGraphcut8InitAlloc(), nppiGraphcutFree(), nppiGraphcut8GetSize().
240  *
241  * \param pTerminals Pointer to differences of terminal edge capacities
242  *        (terminal(x) = source(x) - sink(x))
243  * \param pLeftTransposed Pointer to transposed left edge capacities
244  *        (left(0,*) must be 0)
245  * \param pRightTransposed Pointer to transposed right edge capacities
246  *        (right(width-1,*) must be 0)
247  * \param pTop Pointer to top edge capacities (top(*,0) must be 0)
248  * \param pTopLeft Pointer to top left edge capacities (topleft(*,0) 
249  *        & topleft(0,*) must be 0)
250  * \param pTopRight Pointer to top right edge capacities (topright(*,0)
251  *        & topright(width-1,*) must be 0)
252  * \param pBottom Pointer to bottom edge capacities (bottom(*,height-1)
253  *        must be 0)
254  * \param pBottomLeft Pointer to bottom left edge capacities 
255  *        (bottomleft(*,height-1) && bottomleft(0,*) must be 0)
256  * \param pBottomRight Pointer to bottom right edge capacities 
257  *        (bottomright(*,height-1) && bottomright(width-1,*) must be 0)
258  * \param nStep Step in bytes between any pair of sequential rows of edge
259  *        capacities
260  * \param nTransposedStep Step in bytes between any pair of sequential
261  *        rows of tranposed edge capacities
262  * \param size Graph size
263  * \param pLabel Pointer to destination label image 
264  * \param nLabelStep Step in bytes between any pair of sequential rows of
265  *        label image
266  * \param pState Pointer to graph-cut state structure. This structure must be
267  *          initialized allocated and initialized using nppiGraphcut8InitAlloc().
268  * \return \ref image_data_error_codes, \ref roi_error_codes
269  */
270 NppStatus nppiGraphcut8_32s8u(Npp32s * pTerminals, Npp32s * pLeftTransposed, Npp32s * pRightTransposed, Npp32s * pTop, Npp32s * pTopLeft, Npp32s * pTopRight, Npp32s * pBottom, Npp32s * pBottomLeft, Npp32s * pBottomRight, int nStep, int nTransposedStep, NppiSize size, Npp8u * pLabel, int nLabelStep, NppiGraphcutState *pState);
271
272 /**
273  * Graphcut of a flow network (32bit float edge capacities). The
274  * function computes the minimal cut (graphcut) of a 2D regular 4-connected
275  * graph. 
276  * The inputs are the capacities of the horizontal (in transposed form),
277  * vertical and terminal (source and sink) edges. The capacities to source and
278  * sink 
279  * are stored as capacity differences in the terminals array 
280  * ( terminals(x) = source(x) - sink(x) ). The implementation assumes that the
281  * edge capacities 
282  * for boundary edges that would connect to nodes outside the specified domain
283  * are set to 0 (for example left(0,*) == 0). If this is not fulfilled the
284  * computed labeling may be wrong!
285  * The computed binary labeling is encoded as unsigned 8bit values (0 and >0).
286  *
287  * \see nppiGraphcutInitAlloc(), nppiGraphcutFree(), nppiGraphcutGetSize().
288  *
289  * \param pTerminals Pointer to differences of terminal edge capacities
290  *        (terminal(x) = source(x) - sink(x))
291  * \param pLeftTransposed Pointer to transposed left edge capacities
292  *        (left(0,*) must be 0)
293  * \param pRightTransposed Pointer to transposed right edge capacities
294  *        (right(width-1,*) must be 0)
295  * \param pTop Pointer to top edge capacities (top(*,0) must be 0)
296  * \param pBottom Pointer to bottom edge capacities (bottom(*,height-1)
297  *        must be 0)
298  * \param nStep Step in bytes between any pair of sequential rows of edge
299  *        capacities
300  * \param nTransposedStep Step in bytes between any pair of sequential
301  *        rows of tranposed edge capacities
302  * \param size Graph size
303  * \param pLabel Pointer to destination label image 
304  * \param nLabelStep Step in bytes between any pair of sequential rows of
305  *        label image
306  * \param pState Pointer to graph-cut state structure. This structure must be
307  *          initialized allocated and initialized using nppiGraphcutInitAlloc().
308  * \return \ref image_data_error_codes, \ref roi_error_codes
309  */
310 NppStatus nppiGraphcut_32f8u(Npp32f * pTerminals, Npp32f * pLeftTransposed, Npp32f * pRightTransposed, Npp32f * pTop, Npp32f * pBottom, int nStep, int nTransposedStep, NppiSize size, Npp8u * pLabel, int nLabelStep, NppiGraphcutState *pState);
311
312
313 /**
314  * Graphcut of a flow network (32bit float edge capacities). The
315  * function computes the minimal cut (graphcut) of a 2D regular 8-connected
316  * graph. 
317  * The inputs are the capacities of the horizontal (in transposed form),
318  * vertical and terminal (source and sink) edges. The capacities to source and
319  * sink 
320  * are stored as capacity differences in the terminals array 
321  * ( terminals(x) = source(x) - sink(x) ). The implementation assumes that the
322  * edge capacities 
323  * for boundary edges that would connect to nodes outside the specified domain
324  * are set to 0 (for example left(0,*) == 0). If this is not fulfilled the
325  * computed labeling may be wrong!
326  * The computed binary labeling is encoded as unsigned 8bit values (0 and >0).
327  *
328  * \see nppiGraphcut8InitAlloc(), nppiGraphcutFree(), nppiGraphcut8GetSize().
329  *
330  * \param pTerminals Pointer to differences of terminal edge capacities
331  *        (terminal(x) = source(x) - sink(x))
332  * \param pLeftTransposed Pointer to transposed left edge capacities
333  *        (left(0,*) must be 0)
334  * \param pRightTransposed Pointer to transposed right edge capacities
335  *        (right(width-1,*) must be 0)
336  * \param pTop Pointer to top edge capacities (top(*,0) must be 0)
337  * \param pTopLeft Pointer to top left edge capacities (topleft(*,0) 
338  *        & topleft(0,*) must be 0)
339  * \param pTopRight Pointer to top right edge capacities (topright(*,0)
340  *        & topright(width-1,*) must be 0)
341  * \param pBottom Pointer to bottom edge capacities (bottom(*,height-1)
342  *        must be 0)
343  * \param pBottomLeft Pointer to bottom left edge capacities 
344  *        (bottomleft(*,height-1) && bottomleft(0,*) must be 0)
345  * \param pBottomRight Pointer to bottom right edge capacities 
346  *        (bottomright(*,height-1) && bottomright(width-1,*) must be 0)
347  * \param nStep Step in bytes between any pair of sequential rows of edge
348  *        capacities
349  * \param nTransposedStep Step in bytes between any pair of sequential
350  *        rows of tranposed edge capacities
351  * \param size Graph size
352  * \param pLabel Pointer to destination label image 
353  * \param nLabelStep Step in bytes between any pair of sequential rows of
354  *        label image
355  * \param pState Pointer to graph-cut state structure. This structure must be
356  *          initialized allocated and initialized using nppiGraphcut8InitAlloc().
357  * \return \ref image_data_error_codes, \ref roi_error_codes
358  */
359 NppStatus nppiGraphcut8_32f8u(Npp32f * pTerminals, Npp32f * pLeftTransposed, Npp32f * pRightTransposed, Npp32f * pTop, Npp32f * pTopLeft, Npp32f * pTopRight, Npp32f * pBottom, Npp32f * pBottomLeft, Npp32f * pBottomRight, int nStep, int nTransposedStep, NppiSize size, Npp8u * pLabel, int nLabelStep, NppiGraphcutState *pState);
360
361
362 /** @} end of Graphcut */
363
364 /** @} image_graphcut */
365
366 /** @} image_labeling_and_segmentation */
367
368 #ifdef __cplusplus
369 } /* extern "C" */
370 #endif
371
372 #endif /* NV_NPPI_COMPUTER_VISION_H */