1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

samples: avoid using of legacy C-like API (part 2)

This commit is contained in:
Alexander Alekhin
2018-03-29 14:17:23 +03:00
parent 7dc88f26f2
commit e28cc973bf
11 changed files with 25 additions and 25 deletions
@@ -136,22 +136,22 @@ namespace PhoneXamlDirect3DApp1Comp
void Direct3DInterop::ApplyGrayFilter(cv::Mat* mat)
{
cv::Mat intermediateMat;
cv::cvtColor(*mat, intermediateMat, CV_RGBA2GRAY);
cv::cvtColor(intermediateMat, *mat, CV_GRAY2BGRA);
cv::cvtColor(*mat, intermediateMat, COLOR_RGBA2GRAY);
cv::cvtColor(intermediateMat, *mat, COLOR_GRAY2BGRA);
}
void Direct3DInterop::ApplyCannyFilter(cv::Mat* mat)
{
cv::Mat intermediateMat;
cv::Canny(*mat, intermediateMat, 80, 90);
cv::cvtColor(intermediateMat, *mat, CV_GRAY2BGRA);
cv::cvtColor(intermediateMat, *mat, COLOR_GRAY2BGRA);
}
void Direct3DInterop::ApplyBlurFilter(cv::Mat* mat)
{
cv::Mat intermediateMat;
// cv::Blur(image, intermediateMat, 80, 90);
cv::cvtColor(intermediateMat, *mat, CV_GRAY2BGRA);
cv::cvtColor(intermediateMat, *mat, COLOR_GRAY2BGRA);
}
void Direct3DInterop::ApplyFindFeaturesFilter(cv::Mat* mat)
@@ -160,7 +160,7 @@ namespace PhoneXamlDirect3DApp1Comp
cv::Ptr<cv::FastFeatureDetector> detector = cv::FastFeatureDetector::create(50);
std::vector<cv::KeyPoint> features;
cv::cvtColor(*mat, intermediateMat, CV_RGBA2GRAY);
cv::cvtColor(*mat, intermediateMat, COLOR_RGBA2GRAY);
detector->detect(intermediateMat, features);
for( unsigned int i = 0; i < std::min(features.size(), (size_t)50); i++ )
@@ -19,15 +19,15 @@ namespace PhoneXamlDirect3DApp1Comp
void Direct3DInterop::ApplyGrayFilter(const cv::Mat& image)
{
cv::Mat intermediateMat;
cv::cvtColor(image, intermediateMat, CV_RGBA2GRAY);
cv::cvtColor(intermediateMat, image, CV_GRAY2BGRA);
cv::cvtColor(image, intermediateMat, COLOR_RGBA2GRAY);
cv::cvtColor(intermediateMat, image, COLOR_GRAY2BGRA);
}
void Direct3DInterop::ApplyCannyFilter(const cv::Mat& image)
{
cv::Mat intermediateMat;
cv::Canny(image, intermediateMat, 80, 90);
cv::cvtColor(intermediateMat, image, CV_GRAY2BGRA);
cv::cvtColor(intermediateMat, image, COLOR_GRAY2BGRA);
}
void Direct3DInterop::ApplySepiaFilter(const cv::Mat& image)
@@ -31,10 +31,10 @@ IAsyncOperation<IVectorView<int>^>^ OpenCVLib::ProcessAsync(IVector<int>^ input,
{
// convert to grayscale
cv::Mat intermediateMat;
cv::cvtColor(mat, intermediateMat, CV_RGB2GRAY);
cv::cvtColor(mat, intermediateMat, COLOR_RGB2GRAY);
// convert to BGRA
cv::cvtColor(intermediateMat, mat, CV_GRAY2BGRA);
cv::cvtColor(intermediateMat, mat, COLOR_GRAY2BGRA);
std::vector<int> output;
CopyMatrixToVector(mat, output, size);