Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added missing cuda imgproc standalone functions #1227

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,24 +273,24 @@ Your pull requests will be greatly appreciated!
- [ ] [cv::cuda::createSeparableLinearFilter](https://docs.opencv.org/master/dc/d66/group__cudafilters.html#gaf7b79a9a92992044f328dad07a52c4bf)

- [ ] **cudaimgproc. Image Processing - WORK STARTED** The following functions still need implementation:
- [ ] [cv::cuda::alphaComp](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#ga08a698700458d9311390997b57fbf8dc)
- [ ] [cv::cuda::gammaCorrection](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#gaf4195a8409c3b8fbfa37295c2b2c4729)
- [ ] [cv::cuda::swapChannels](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#ga75a29cc4a97cde0d43ea066b01de927e)
- [ ] [cv::cuda::calcHist](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#gaaf3944106890947020bb4522a7619c26)
- [X] [cv::cuda::alphaComp](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#ga08a698700458d9311390997b57fbf8dc)
- [X] [cv::cuda::gammaCorrection](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#gaf4195a8409c3b8fbfa37295c2b2c4729)
- [X] [cv::cuda::swapChannels](https://docs.opencv.org/master/db/d8c/group__cudaimgproc__color.html#ga75a29cc4a97cde0d43ea066b01de927e)
- [X] [cv::cuda::calcHist](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#gaaf3944106890947020bb4522a7619c26)
- [ ] [cv::cuda::CLAHE](https://docs.opencv.org/master/db/d79/classcv_1_1cuda_1_1CLAHE.html)
- [ ] [cv::cuda::equalizeHist](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga2384be74bd2feba7e6c46815513f0060)
- [ ] [cv::cuda::evenLevels](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga2f2cbd21dc6d7367a7c4ee1a826f389d)
- [ ] [cv::cuda::histEven](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#gacd3b14279fb77a57a510cb8c89a1856f)
- [ ] [cv::cuda::histRange](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga87819085c1059186d9cdeacd92cea783)
- [X] [cv::cuda::equalizeHist](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga2384be74bd2feba7e6c46815513f0060)
- [X] [cv::cuda::evenLevels](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga2f2cbd21dc6d7367a7c4ee1a826f389d)
- [X] [cv::cuda::histEven](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#gacd3b14279fb77a57a510cb8c89a1856f)
- [X] [cv::cuda::histRange](https://docs.opencv.org/master/d8/d0e/group__cudaimgproc__hist.html#ga87819085c1059186d9cdeacd92cea783)
- [ ] [cv::cuda::HoughCirclesDetector](https://docs.opencv.org/master/da/d80/classcv_1_1cuda_1_1HoughCirclesDetector.html)
- [ ] [cv::cuda::createGoodFeaturesToTrackDetector](https://docs.opencv.org/master/dc/d6d/group__cudaimgproc__feature.html#ga478b474a598ece101f7e706fee2c8e91)
- [ ] [cv::cuda::createHarrisCorner](https://docs.opencv.org/master/dc/d6d/group__cudaimgproc__feature.html#ga3e5878a803e9bba51added0c10101979)
- [ ] [cv::cuda::createMinEigenValCorner](https://docs.opencv.org/master/dc/d6d/group__cudaimgproc__feature.html#ga7457fd4b53b025f990b1c1dd1b749915)
- [ ] [cv::cuda::bilateralFilter](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga6abeaecdd4e7edc0bd1393a04f4f20bd)
- [ ] [cv::cuda::blendLinear](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga4793607e5729bcc15b27ea33d9fe335e)
- [ ] [cv::cuda::meanShiftFiltering](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#gae13b3035bc6df0e512d876dbb8c00555)
- [ ] [cv::cuda::meanShiftProc](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga6039dc8ecbe2f912bc83fcc9b3bcca39)
- [ ] [cv::cuda::meanShiftSegmentation](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga70ed80533a448829dc48cf22b1845c16)
- [X] [cv::cuda::bilateralFilter](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga6abeaecdd4e7edc0bd1393a04f4f20bd)
- [X] [cv::cuda::blendLinear](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga4793607e5729bcc15b27ea33d9fe335e)
- [X] [cv::cuda::meanShiftFiltering](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#gae13b3035bc6df0e512d876dbb8c00555)
- [X] [cv::cuda::meanShiftProc](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga6039dc8ecbe2f912bc83fcc9b3bcca39)
- [X] [cv::cuda::meanShiftSegmentation](https://docs.opencv.org/master/d0/d05/group__cudaimgproc.html#ga70ed80533a448829dc48cf22b1845c16)

- [X] **cudaobjdetect. Object Detection**

Expand Down
5 changes: 5 additions & 0 deletions core.go
Original file line number Diff line number Diff line change
Expand Up @@ -1985,6 +1985,11 @@ func NewTermCriteria(typ TermCriteriaType, maxCount int, epsilon float64) TermCr
return TermCriteria{p: C.TermCriteria_New(C.int(typ), C.int(maxCount), C.double(epsilon))}
}

// Ptr returns the underlying C.TermCriteria
func (tc *TermCriteria) Ptr() C.TermCriteria {
return tc.p
}

// Scalar is a 4-element vector widely used in OpenCV to pass pixel values.
//
// For further details, please see:
Expand Down
114 changes: 114 additions & 0 deletions cuda/imgproc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,118 @@ void TemplateMatching_Match(TemplateMatching tm, GpuMat img, GpuMat tmpl, GpuMat
(*tm)->match(*img, *tmpl, *dst, *s);
}
return;
}

void AlphaComp(GpuMat img1, GpuMat img2, GpuMat dst, int alpha_op, Stream s) {
if(s == NULL) {
cv::cuda::alphaComp(*img1, *img2, *dst, alpha_op);
} else {
cv::cuda::alphaComp(*img1, *img2, *dst, alpha_op, *s);
}
}

void GammaCorrection(GpuMat src, GpuMat dst, bool forward, Stream s) {
if(s == NULL) {
cv::cuda::gammaCorrection(*src, *dst, forward);
} else {
cv::cuda::gammaCorrection(*src, *dst, forward, *s);
}
}

void SwapChannels(GpuMat image, int dstOrder[4], Stream s) {
if(s == NULL) {
cv::cuda::swapChannels(*image, dstOrder);
} else {
cv::cuda::swapChannels(*image, dstOrder, *s);
}
}

void Cuda_CalcHist(GpuMat src, GpuMat dst, Stream s) {
if(s == NULL) {
cv::cuda::calcHist(*src, *dst);
}else{
cv::cuda::calcHist(*src, *dst, *s);
}
}

void Cuda_CalcHist_WithParams(GpuMat src, GpuMat mask, GpuMat dst, Stream s) {
if(s == NULL) {
cv::cuda::calcHist(*src, *mask, *dst);
}else{
cv::cuda::calcHist(*src, *mask, *dst, *s);
}
}

void Cuda_EqualizeHist(GpuMat src, GpuMat dst, Stream s) {
if(s == NULL) {
cv::cuda::equalizeHist(*src, *dst);
}else{
cv::cuda::equalizeHist(*src, *dst, *s);
}
}

void Cuda_EvenLevels(GpuMat levels, int nLevels, int lowerLevel, int upperLevel, Stream s) {
if(s == NULL) {
cv::cuda::evenLevels(*levels, nLevels, lowerLevel, upperLevel);
}else{
cv::cuda::evenLevels(*levels, nLevels, lowerLevel, upperLevel, *s);
}
}

void Cuda_HistEven(GpuMat src, GpuMat hist, int histSize, int lowerLevel, int upperLevel, Stream s) {
if(s == NULL) {
cv::cuda::histEven(*src, *hist, histSize, lowerLevel, upperLevel);
}else{
cv::cuda::histEven(*src, *hist, histSize, lowerLevel, upperLevel, *s);
}
}


void Cuda_HistRange(GpuMat src, GpuMat hist, GpuMat levels, Stream s){
if(s == NULL) {
cv::cuda::histRange(*src, *hist, *levels);
} else {
cv::cuda::histRange(*src, *hist, *levels, *s);
}
}

void Cuda_BilateralFilter(GpuMat src, GpuMat dst, int kernel_size, float sigma_color, float sigma_spatial, int borderMode, Stream s) {
if(s == NULL) {
cv::cuda::bilateralFilter(*src, *dst, kernel_size, sigma_color, sigma_spatial, borderMode);
} else {
cv::cuda::bilateralFilter(*src, *dst, kernel_size, sigma_color, sigma_spatial, borderMode, *s);
}
}

void Cuda_BlendLinear(GpuMat img1, GpuMat img2, GpuMat weights1, GpuMat weights2, GpuMat result, Stream s) {
if(s == NULL) {
cv::cuda::blendLinear(*img1, *img2, *weights1, *weights2, *result);
} else {
cv::cuda::blendLinear(*img1, *img2, *weights1, *weights2, *result, *s);
}
}

void Cuda_MeanShiftFiltering(GpuMat src, GpuMat dst, int sp, int sr, TermCriteria criteria, Stream s) {
if(s == NULL) {
cv::cuda::meanShiftFiltering(*src, *dst, sp, sr, *criteria);
} else {
cv::cuda::meanShiftFiltering(*src, *dst, sp, sr, *criteria, *s);
}
}

void Cuda_MeanShiftProc(GpuMat src, GpuMat dstr, GpuMat dstsp, int sp, int sr, TermCriteria criteria, Stream s) {
if(s == NULL) {
cv::cuda::meanShiftProc(*src, *dstr, *dstsp, sp, sr, *criteria);
} else {
cv::cuda::meanShiftProc(*src, *dstr, *dstsp, sp, sr, *criteria, *s);
}
}


void Cuda_MeanShiftSegmentation(GpuMat src, GpuMat dst, int sp, int sr, int minSize, TermCriteria criteria, Stream s) {
if(s == NULL) {
cv::cuda::meanShiftSegmentation(*src, *dst, sp, sr, minSize, *criteria);
} else {
cv::cuda::meanShiftSegmentation(*src, *dst, sp, sr, minSize, *criteria, *s);
}
}
Loading
Loading