Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
c0d3adef
Commit
c0d3adef
authored
Aug 06, 2012
by
marina.kolpakova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
intervales for vector type support
parent
0bf10c9a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
13 deletions
+24
-13
ccomponetns.cu
modules/gpu/src/cuda/ccomponetns.cu
+24
-13
No files found.
modules/gpu/src/cuda/ccomponetns.cu
View file @
c0d3adef
...
...
@@ -39,7 +39,9 @@
// the use of this software, even if advised of the possibility of such damage.
//M*/
#include "opencv2/gpu/device/common.hpp"
#include <opencv2/gpu/device/common.hpp>
#include <opencv2/gpu/device/vec_traits.hpp>
#include <opencv2/gpu/device/vec_math.hpp>
#include <iostream>
#include <stdio.h>
...
...
@@ -84,7 +86,7 @@ namespace cv { namespace gpu { namespace device
template<> struct IntervalsTraits<uchar4>
{
typedef int
3
dist_type;
typedef int
4
dist_type;
enum {ch = 4};
};
...
...
@@ -130,30 +132,39 @@ namespace cv { namespace gpu { namespace device
template<typename I> __device__ __forceinline__ bool operator() (const I& a, const I& b) const
{
T
d = a - b;
I
d = a - b;
return lo <= d && d <= hi;
}
};
template<typename T> struct InInterval<T, 3>
{
__host__ __device__ __forceinline__ InInterval(const float4& _lo, const float4& _hi){};
__host__ __device__ __forceinline__ InInterval(const float4& _lo, const float4& _hi)
: lo (VecTraits<T>::make(-_lo.x, -_lo.y, -_lo.z)), hi (VecTraits<T>::make(_hi.x, _hi.y, _hi.z)){};
T lo, hi;
template<typename I> __device__ __forceinline__ bool operator() (const I& a, const I& b) const
{
return true;
I d = a - b;
return lo.x <= d.x && d.x <= hi.x &&
lo.y <= d.y && d.y <= hi.y &&
lo.z <= d.z && d.z <= hi.z;
}
};
template<typename T> struct InInterval<T, 4>
{
__host__ __device__ __forceinline__ InInterval(const float4& _lo, const float4& _hi){};
__host__ __device__ __forceinline__ InInterval(const float4& _lo, const float4& _hi)
: lo (VecTraits<T>::make(-_lo.x, -_lo.y, -_lo.z, -_lo.w)), hi (VecTraits<T>::make(_hi.x, _hi.y, _hi.z, -_hi.w)){};
T lo, hi;
template<typename I> __device__ __forceinline__ bool operator() (const I& a, const I& b) const
{
return true;
I d = a - b;
return lo.x <= d.x && d.x <= hi.x &&
lo.y <= d.y && d.y <= hi.y &&
lo.z <= d.z && d.z <= hi.z &&
lo.w <= d.w && d.w <= hi.w;
}
};
...
...
@@ -275,16 +286,16 @@ namespace cv { namespace gpu { namespace device
int label = new_labels[i][j];
if (c & UP)
label = min(label, labelsTile[yloc - 1][xloc]);
label =
::
min(label, labelsTile[yloc - 1][xloc]);
if (c & DOWN)
label = min(label, labelsTile[yloc + 1][xloc]);
label =
::
min(label, labelsTile[yloc + 1][xloc]);
if (c & LEFT)
label = min(label, labelsTile[yloc][xloc - 1]);
label =
::
min(label, labelsTile[yloc][xloc - 1]);
if (c & RIGHT)
label = min(label, labelsTile[yloc][xloc + 1]);
label =
::
min(label, labelsTile[yloc][xloc + 1]);
new_labels[i][j] = label;
}
...
...
@@ -366,8 +377,8 @@ namespace cv { namespace gpu { namespace device
if (r1 == r2) return;
int mi = min(r1, r2);
int ma = max(r1, r2);
int mi =
::
min(r1, r2);
int ma =
::
max(r1, r2);
int y = ma / comps.cols;
int x = ma - y * comps.cols;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment