struct TensorWrapper pyrUpCuda(struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper dst) { if (dst.isNull()) { cuda::GpuMat retval; cuda::pyrUp(src.toGpuMat(), retval, prepareStream(info)); return TensorWrapper(retval, info.state); } else if (dst.tensorPtr == src.tensorPtr) { // in-place cuda::GpuMat source = src.toGpuMat(); cuda::pyrUp(source, source, prepareStream(info)); } else { cuda::pyrUp(src.toGpuMat(), dst.toGpuMat(), prepareStream(info)); } return dst; }
bool RtspStreamWorker::setup() { ASSERT_WORKER_THREAD(); m_ctx = avformat_alloc_context(); m_ctx->interrupt_callback.callback = rtspStreamInterruptCallback; m_ctx->interrupt_callback.opaque = this; AVDictionary *options = createOptions(); bool prepared = prepareStream(&m_ctx, options); av_dict_free(&options); if (prepared) { m_frameFormatter.reset(new RtspStreamFrameFormatter(m_ctx->streams[m_videoStreamIndex])); m_frameFormatter->setAutoDeinterlacing(m_autoDeinterlacing); } else if (m_ctx) { avformat_close_input(&m_ctx); m_ctx = 0; } return prepared; }
struct TensorWrapper evenLevels(struct cutorchInfo info, struct TensorWrapper levels, int nLevels, int lowerLevel, int upperLevel) { cuda::GpuMat retval; if (!levels.isNull()) retval = levels.toGpuMat(); cuda::evenLevels(retval, nLevels, lowerLevel, upperLevel, prepareStream(info)); }
struct TensorWrapper DenseOpticalFlow_calcCuda(struct cutorchInfo info, struct DenseOpticalFlowPtr ptr, struct TensorWrapper I0, struct TensorWrapper I1, struct TensorWrapper flow) { cuda::GpuMat retval = flow.toGpuMat(); ptr->calc(I0.toGpuMat(), I1.toGpuMat(), retval, prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper HOG_compute( struct cutorchInfo info, struct HOGPtr ptr, struct TensorWrapper img, struct TensorWrapper descriptors) { GpuMatT descriptorsMat = descriptors.toGpuMatT(); ptr->compute(img.toGpuMat(), descriptorsMat, prepareStream(info)); return TensorWrapper(descriptorsMat, info.state); }
struct TensorWrapper gammaCorrection(struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper dst, bool forward) { cuda::GpuMat retval; if (!dst.isNull()) retval = dst.toGpuMat(); cuda::gammaCorrection(src.toGpuMat(), retval, forward, prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper Feature2DAsync_detectAsyncCuda( struct cutorchInfo info, struct Feature2DAsyncPtr ptr, struct TensorWrapper image, struct TensorWrapper keypoints, struct TensorWrapper mask) { cuda::GpuMat retval = keypoints.toGpuMat(); ptr->detectAsync(image.toGpuMat(), retval, TO_GPUMAT_OR_NOARRAY(mask), prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper calcHist( struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper hist) { cuda::GpuMat retval; if (!hist.isNull()) retval = hist.toGpuMat(); cuda::calcHist(src.toGpuMat(), retval, prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper cvtColor(struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper dst, int code, int dstCn) { cuda::GpuMat retval; if (!dst.isNull()) retval = dst.toGpuMat(); cuda::cvtColor(src.toGpuMat(), retval, code, dstCn, prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper CornernessCriteria_compute( struct cutorchInfo info, struct CornernessCriteriaPtr ptr, struct TensorWrapper src, struct TensorWrapper dst) { cuda::GpuMat retval; if (!dst.isNull()) retval = dst.toGpuMat(); ptr->compute(src.toGpuMat(), retval, prepareStream(info)); }
struct TensorWrapper TemplateMatching_match( struct cutorchInfo info, struct TemplateMatchingPtr ptr, struct TensorWrapper image, struct TensorWrapper templ, struct TensorWrapper result) { cuda::GpuMat retval; if (!result.isNull()) retval = result.toGpuMat(); ptr->match(image.toGpuMat(), templ.toGpuMat(), retval, prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper alphaComp(struct cutorchInfo info, struct TensorWrapper img1, struct TensorWrapper img2, struct TensorWrapper dst, int alpha_op) { cuda::GpuMat retval; if (!dst.isNull()) retval = dst.toGpuMat(); cuda::alphaComp(img1.toGpuMat(), img2.toGpuMat(), retval, alpha_op, prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper resizeCuda(struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper dst, struct SizeWrapper dsize, double fx, double fy, int interpolation) { GpuMatT dstMat = dst.toGpuMatT(); cuda::resize(src.toGpuMat(), dstMat, dsize, fx, fy, interpolation, prepareStream(info)); return TensorWrapper(dstMat, info.state); }
struct TensorWrapper rotateCuda( struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper dst, struct SizeWrapper dsize, double angle, double xShift, double yShift, int interpolation) { cuda::GpuMat dstMat = dst.toGpuMat(); cuda::rotate(src.toGpuMat(), dstMat, dsize, angle, xShift, yShift, interpolation, prepareStream(info)); return TensorWrapper(dstMat, info.state); }
struct TensorArray Feature2DAsync_computeAsyncCuda( struct cutorchInfo info, struct Feature2DAsyncPtr ptr, struct TensorWrapper image, struct TensorWrapper keypoints, struct TensorWrapper descriptors) { std::vector<cuda::GpuMat> retval(2); retval[0] = keypoints.toGpuMat(); retval[1] = descriptors.toGpuMat(); ptr->computeAsync(image.toGpuMat(), retval[0], retval[1], prepareStream(info)); return TensorArray(retval, info.state); }
struct TensorWrapper blendLinear(struct cutorchInfo info, struct TensorWrapper img1, struct TensorWrapper img2, struct TensorWrapper weights1, struct TensorWrapper weights2, struct TensorWrapper result) { cuda::GpuMat retval; if (!result.isNull()) retval = result.toGpuMat(); cuda::blendLinear( img1.toGpuMat(), img2.toGpuMat(), weights1.toGpuMat(), weights2.toGpuMat(), retval, prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper bilateralFilter(struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper dst, int kernel_size, float sigma_color, float sigma_spatial, int borderMode) { cuda::GpuMat retval; if (!dst.isNull()) retval = dst.toGpuMat(); cuda::bilateralFilter( src.toGpuMat(), retval, kernel_size, sigma_color, sigma_color, borderMode, prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper CascadeClassifier_detectMultiScale( struct cutorchInfo info, struct CascadeClassifierPtr ptr, struct TensorWrapper image, struct TensorWrapper objects) { GpuMatT objectsMat = objects.toGpuMatT(); cuda::GpuMat imageMat = image.toGpuMat(); cuda::GpuMat imageByte; imageMat.convertTo(imageByte, CV_8U, 255.0); // Sorry guys :( ptr->detectMultiScale(imageByte, objectsMat, prepareStream(info)); return TensorWrapper(objectsMat, info.state); }
struct TensorWrapper DescriptorMatcher_knnMatch_masksCuda( struct cutorchInfo info, struct DescriptorMatcherPtr ptr, struct TensorWrapper queryDescriptors, struct TensorWrapper trainDescriptors, struct TensorWrapper matches, int k, struct TensorArray masks) { cuda::GpuMat retval = matches.toGpuMat(); ptr->knnMatchAsync( queryDescriptors.toGpuMat(), trainDescriptors.toGpuMat(), retval, k, TO_GPUMAT_LIST_OR_NOARRAY(masks), prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper DescriptorMatcher_radiusMatchCuda( struct cutorchInfo info, struct DescriptorMatcherPtr ptr, struct TensorWrapper queryDescriptors, struct TensorWrapper trainDescriptors, struct TensorWrapper matches, float maxDistance, struct TensorWrapper mask) { cuda::GpuMat retval = matches.toGpuMat(); ptr->radiusMatchAsync( queryDescriptors.toGpuMat(), trainDescriptors.toGpuMat(), retval, maxDistance, TO_GPUMAT_OR_NOARRAY(mask), prepareStream(info)); return TensorWrapper(retval, info.state); }
struct TensorWrapper remapCuda(struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper map1, struct TensorWrapper map2, int interpolation, struct TensorWrapper dst, int borderMode, struct ScalarWrapper borderValue) { if (dst.isNull()) { cuda::GpuMat retval; cuda::remap(src.toGpuMat(), retval, map1.toGpuMat(), map2.toGpuMat(), interpolation, borderMode, borderValue, prepareStream(info)); return TensorWrapper(retval, info.state); } else if (dst.tensorPtr == src.tensorPtr) { // in-place cuda::GpuMat source = src.toGpuMat(); cuda::remap(source, source, map1.toGpuMat(), map2.toGpuMat(), interpolation, borderMode, borderValue, prepareStream(info)); } else { cuda::remap(src.toGpuMat(), dst.toGpuMat(), map1.toGpuMat(), map2.toGpuMat(), interpolation, borderMode, borderValue, prepareStream(info)); } return dst; }
struct TensorWrapper warpPerspectiveCuda(struct cutorchInfo info, struct TensorWrapper src, struct TensorWrapper dst, struct TensorWrapper M, struct SizeWrapper dsize, int flags, int borderMode, struct ScalarWrapper borderValue) { if (dst.isNull()) { cuda::GpuMat retval; cuda::warpPerspective(src.toGpuMat(), retval, M.toGpuMat(), dsize, flags, borderMode, borderValue, prepareStream(info)); return TensorWrapper(retval, info.state); } else if (dst.tensorPtr == src.tensorPtr) { // in-place cuda::GpuMat source = src.toGpuMat(); cuda::warpPerspective(source, source, M.toGpuMat(), dsize, flags, borderMode, borderValue, prepareStream(info)); } else { cuda::warpPerspective(src.toGpuMat(), dst.toGpuMat(), M.toGpuMat(), dsize, flags, borderMode, borderValue, prepareStream(info)); } return dst; }
struct TensorArray buildWarpPerspectiveMapsCuda( struct cutorchInfo info, struct TensorWrapper M, bool inverse, struct SizeWrapper dsize, struct TensorWrapper xmap, struct TensorWrapper ymap) { std::vector<cuda::GpuMat> retval(2); retval[0] = xmap.toGpuMat(); retval[1] = ymap.toGpuMat(); cuda::buildWarpPerspectiveMaps(M.toGpuMat(), inverse, dsize, retval[0], retval[1], prepareStream(info)); return TensorArray(retval, info.state); }
struct TensorArray SparseOpticalFlow_calcCuda(struct cutorchInfo info, struct SparseOpticalFlowPtr ptr, struct TensorWrapper prevImg, struct TensorWrapper nextImg, struct TensorWrapper prevPts, struct TensorWrapper nextPts, struct TensorWrapper status, bool outputErr, struct TensorWrapper err) { std::vector<cuda::GpuMat> retval(3); retval[0] = nextPts.toGpuMat(); retval[1] = status.toGpuMat(); retval[2] = err.toGpuMat(); ptr->calc(prevImg.toGpuMat(), nextImg.toGpuMat(), prevPts.toGpuMat(), retval[0], retval[1], outputErr ? retval[2] : cv::noArray(), prepareStream(info)); return TensorArray(retval, info.state); }
void swapChannels( struct cutorchInfo info, struct TensorWrapper image, struct Vec4iWrapper dstOrder) { cuda::swapChannels(image.toGpuMat(), &dstOrder.v0, prepareStream(info)); }