예제 #1
0
        /// <summary>
        /// Makes multi-channel array out of several single-channel arrays
        /// </summary>
        ///<param name="gpuMats">
        ///An array of single channel GpuMat where each item
        ///in the array represent a single channel of the GpuMat
        ///</param>
        /// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
        public void MergeFrom(GpuMat[] gpuMats, Stream stream = null)
        {
            //If single channel, perform a copy
            if (gpuMats.Length == 1)
            {
                gpuMats[0].CopyTo(this, null, stream);
            }

            //handle multiple channels
            using (VectorOfGpuMat vm = new VectorOfGpuMat(gpuMats))
            {
                CudaInvoke.Merge(vm, this, stream);
            }
        }
예제 #2
0
 /// <summary>
 /// Finds the best match for each descriptor from a query set (asynchronous version).
 /// </summary>
 /// <param name="queryDescriptors">Query set of descriptors.</param>
 /// <param name="matches">Matches array stored in GPU memory. Internal representation is not defined. Use DescriptorMatcher::matchConvert method to retrieve results in standard representation.</param>
 /// <param name="masks">Mask specifying permissible matches between an input query and train matrices of descriptors.</param>
 /// <param name="stream">CUDA stream.</param>
 public void MatchAsync(
     IInputArray queryDescriptors,
     IOutputArray matches,
     VectorOfGpuMat masks = null,
     Stream stream        = null)
 {
     using (InputArray iaQueryDesccriptor = queryDescriptors.GetInputArray())
         using (OutputArray oaMatches = matches.GetOutputArray())
             CudaInvoke.cveCudaDescriptorMatcherMatchAsync2(
                 _ptr,
                 iaQueryDesccriptor,
                 oaMatches,
                 masks == null ? IntPtr.Zero : masks.Ptr,
                 stream
                 );
 }
예제 #3
0
 /// <summary>
 /// For each query descriptor, finds the training descriptors not farther than the specified distance (blocking version).
 /// </summary>
 /// <param name="queryDescriptors">Query set of descriptors.</param>
 /// <param name="matches">Found matches.</param>
 /// <param name="maxDistance">Threshold for the distance between matched descriptors. Distance means here metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in Pixels)!</param>
 /// <param name="masks">Mask specifying permissible matches between an input query and train matrices of descriptors.</param>
 /// <param name="compactResult">Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.</param>
 public void RadiusMatch(
     IInputArray queryDescriptors,
     VectorOfVectorOfDMatch matches,
     float maxDistance,
     VectorOfGpuMat masks = null,
     bool compactResult   = false)
 {
     using (InputArray iaQueryDescriptors = queryDescriptors.GetInputArray())
         CudaInvoke.cveCudaDescriptorMatcherRadiusMatch2(
             _ptr,
             iaQueryDescriptors,
             matches,
             maxDistance,
             masks == null ? IntPtr.Zero : masks.Ptr,
             compactResult
             );
 }
예제 #4
0
 /// <summary>
 /// Find the k-nearest match
 /// </summary>
 /// <param name="queryDescriptors">An n x m matrix of descriptors to be query for nearest neighbors. n is the number of descriptor and m is the size of the descriptor</param>
 /// <param name="k">Number of nearest neighbors to search for</param>
 /// <param name="masks">Can be null if not needed. An n x 1 matrix. If 0, the query descriptor in the corresponding row will be ignored.</param>
 /// <param name="matches">Matches. Each matches[i] is k or less matches for the same query descriptor.</param>
 /// <param name="compactResult">Parameter used when the mask (or masks) is not empty. If compactResult is false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the matches vector does not contain matches for fully masked-out query descriptors.</param>
 public void KnnMatch(
     IInputArray queryDescriptors,
     VectorOfVectorOfDMatch matches,
     int k,
     VectorOfGpuMat masks = null,
     bool compactResult   = false)
 {
     using (InputArray iaQueryDescriptors = queryDescriptors.GetInputArray())
     {
         CudaInvoke.cveCudaDescriptorMatcherKnnMatch2(
             _ptr,
             iaQueryDescriptors,
             matches,
             k,
             masks == null ? IntPtr.Zero : masks.Ptr,
             compactResult);
     }
 }
예제 #5
0
파일: GpuMat.cs 프로젝트: virzak/emgucv
        ///<summary>
        ///Split current Image into an array of gray scale images where each element
        ///in the array represent a single color channel of the original image
        ///</summary>
        ///<param name="gpuMats">
        ///An array of single channel GpuMat where each item
        ///in the array represent a single channel of the original GpuMat
        ///</param>
        /// <param name="stream">Use a Stream to call the function asynchronously (non-blocking) or null to call the function synchronously (blocking).</param>
        private void SplitInto(GpuMat[] gpuMats, Stream stream)
        {
            Debug.Assert(NumberOfChannels == gpuMats.Length, "Number of channels does not agrees with the length of gpuMats");

            if (NumberOfChannels == 1)
            {
                //If single channel, return a copy
                CopyTo(gpuMats[0], null, stream);
            }
            else
            {
                //handle multiple channels

                Size size = Size;

                for (int i = 0; i < gpuMats.Length; i++)
                {
                    gpuMats[i].Create(size.Height, size.Width, Depth, 1);
                }

                using (VectorOfGpuMat vm = new VectorOfGpuMat(gpuMats))
                    CudaInvoke.Split(this, vm, stream);
            }
        }
예제 #6
0
 /// <summary>
 /// Push multiple values from the other vector into this vector
 /// </summary>
 /// <param name="other">The other vector, from which the values will be pushed to the current vector</param>
 public void Push(VectorOfGpuMat other)
 {
     VectorOfGpuMatPushVector(_ptr, other);
 }
예제 #7
0
 public DebuggerProxy(VectorOfGpuMat v)
 {
     _v = v;
 }