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
e28cc973
Commit
e28cc973
authored
Mar 29, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
samples: avoid using of legacy C-like API (part 2)
parent
7dc88f26
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
25 additions
and
25 deletions
+25
-25
d3d10_interop.cpp
samples/directx/d3d10_interop.cpp
+1
-1
d3d11_interop.cpp
samples/directx/d3d11_interop.cpp
+3
-3
d3d9_interop.cpp
samples/directx/d3d9_interop.cpp
+1
-1
d3d9ex_interop.cpp
samples/directx/d3d9ex_interop.cpp
+1
-1
opengl_interop.cpp
samples/opengl/opengl_interop.cpp
+1
-1
MainPage.xaml.cpp
samples/winrt/FaceDetection/FaceDetection/MainPage.xaml.cpp
+1
-1
MainPage.xaml.cpp
...t/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp
+5
-5
MainPage.xaml.cpp
samples/winrt_universal/PhoneTutorial/MainPage.xaml.cpp
+2
-2
Direct3DInterop.cpp
...irect3DApp1/PhoneXamlDirect3DApp1Comp/Direct3DInterop.cpp
+5
-5
Direct3DInterop.cpp
...irect3DApp1/PhoneXamlDirect3DApp1Comp/Direct3DInterop.cpp
+3
-3
OpenCVComponent.cpp
samples/wp8/OpenCVXaml/OpenCVComponent/OpenCVComponent.cpp
+2
-2
No files found.
samples/directx/d3d10_interop.cpp
View file @
e28cc973
...
...
@@ -135,7 +135,7 @@ public:
if
(
!
m_cap
.
read
(
m_frame_bgr
))
return
-
1
;
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
V
_BGR2RGBA
);
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
OLOR
_BGR2RGBA
);
UINT
subResource
=
::
D3D10CalcSubresource
(
0
,
0
,
1
);
...
...
samples/directx/d3d11_interop.cpp
View file @
e28cc973
...
...
@@ -202,7 +202,7 @@ public:
if
(
use_nv12
)
{
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_i420
,
C
V
_BGR2YUV_I420
);
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_i420
,
C
OLOR
_BGR2YUV_I420
);
convert_I420_to_NV12
(
m_frame_i420
,
m_frame_nv12
,
m_width
,
m_height
);
...
...
@@ -210,7 +210,7 @@ public:
}
else
{
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
V
_BGR2RGBA
);
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
OLOR
_BGR2RGBA
);
// process video frame on CPU
UINT
subResource
=
::
D3D11CalcSubresource
(
0
,
0
,
1
);
...
...
@@ -336,7 +336,7 @@ public:
}
cv
::
Mat
frame_nv12
(
m_height
+
(
m_height
/
2
),
m_width
,
CV_8UC1
,
mappedTex
.
pData
,
mappedTex
.
RowPitch
);
cv
::
cvtColor
(
frame_nv12
,
m_frame_rgba
,
C
V
_YUV2RGBA_NV12
);
cv
::
cvtColor
(
frame_nv12
,
m_frame_rgba
,
C
OLOR
_YUV2RGBA_NV12
);
m_pD3D11Ctx
->
Unmap
(
m_pSurfaceNV12_cpu_copy
,
subResource
);
}
...
...
samples/directx/d3d9_interop.cpp
View file @
e28cc973
...
...
@@ -108,7 +108,7 @@ public:
if
(
!
m_cap
.
read
(
m_frame_bgr
))
return
-
1
;
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
V
_BGR2BGRA
);
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
OLOR
_BGR2BGRA
);
D3DLOCKED_RECT
memDesc
=
{
0
,
NULL
};
RECT
rc
=
{
0
,
0
,
m_width
,
m_height
};
...
...
samples/directx/d3d9ex_interop.cpp
View file @
e28cc973
...
...
@@ -108,7 +108,7 @@ public:
if
(
!
m_cap
.
read
(
m_frame_bgr
))
return
-
1
;
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
V
_BGR2BGRA
);
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
OLOR
_BGR2BGRA
);
D3DLOCKED_RECT
memDesc
=
{
0
,
NULL
};
RECT
rc
=
{
0
,
0
,
m_width
,
m_height
};
...
...
samples/opengl/opengl_interop.cpp
View file @
e28cc973
...
...
@@ -207,7 +207,7 @@ public:
if
(
!
m_cap
.
read
(
m_frame_bgr
))
return
-
1
;
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
V
_RGB2RGBA
);
cv
::
cvtColor
(
m_frame_bgr
,
m_frame_rgba
,
C
OLOR
_RGB2RGBA
);
if
(
do_buffer
)
buffer
.
copyFrom
(
m_frame_rgba
,
cv
::
ogl
::
Buffer
::
PIXEL_UNPACK_BUFFER
,
true
);
...
...
samples/winrt/FaceDetection/FaceDetection/MainPage.xaml.cpp
View file @
e28cc973
...
...
@@ -47,7 +47,7 @@ void FaceDetection::MainPage::InitBtn_Click(Platform::Object^ sender, Windows::U
// load Image and Init recognizer
cv
::
Mat
image
=
cv
::
imread
(
"Assets/group1.jpg"
);
groupFaces
=
cv
::
Mat
(
image
.
rows
,
image
.
cols
,
CV_8UC4
);
cv
::
cvtColor
(
image
,
groupFaces
,
C
V
_BGR2BGRA
);
cv
::
cvtColor
(
image
,
groupFaces
,
C
OLOR
_BGR2BGRA
);
cv
::
winrt_initContainer
(
cvContainer
);
cv
::
imshow
(
window_name
,
groupFaces
);
...
...
samples/winrt/OcvImageProcessing/OcvImageProcessing/MainPage.xaml.cpp
View file @
e28cc973
...
...
@@ -47,7 +47,7 @@ MainPage::MainPage()
// Image loading OpenCV way ... way more simple
cv
::
Mat
image
=
cv
::
imread
(
"Assets/Lena.png"
);
Lena
=
cv
::
Mat
(
image
.
rows
,
image
.
cols
,
CV_8UC4
);
cvtColor
(
image
,
Lena
,
C
V
_BGR2BGRA
);
cvtColor
(
image
,
Lena
,
C
OLOR
_BGR2BGRA
);
UpdateImage
(
Lena
);
#else
...
...
@@ -184,8 +184,8 @@ cv::Mat OcvImageProcessing::MainPage::ApplyGrayFilter(const cv::Mat& image)
{
cv
::
Mat
result
;
cv
::
Mat
intermediateMat
;
cv
::
cvtColor
(
image
,
intermediateMat
,
C
V
_RGBA2GRAY
);
cv
::
cvtColor
(
intermediateMat
,
result
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
image
,
intermediateMat
,
C
OLOR
_RGBA2GRAY
);
cv
::
cvtColor
(
intermediateMat
,
result
,
C
OLOR
_GRAY2BGRA
);
return
result
;
}
...
...
@@ -194,7 +194,7 @@ cv::Mat OcvImageProcessing::MainPage::ApplyCannyFilter(const cv::Mat& image)
cv
::
Mat
result
;
cv
::
Mat
intermediateMat
;
cv
::
Canny
(
image
,
intermediateMat
,
80
,
90
);
cv
::
cvtColor
(
intermediateMat
,
result
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
intermediateMat
,
result
,
C
OLOR
_GRAY2BGRA
);
return
result
;
}
...
...
@@ -213,7 +213,7 @@ cv::Mat OcvImageProcessing::MainPage::ApplyFindFeaturesFilter(const cv::Mat& ima
std
::
vector
<
cv
::
KeyPoint
>
features
;
image
.
copyTo
(
result
);
cv
::
cvtColor
(
image
,
intermediateMat
,
C
V
_RGBA2GRAY
);
cv
::
cvtColor
(
image
,
intermediateMat
,
C
OLOR
_RGBA2GRAY
);
detector
->
detect
(
intermediateMat
,
features
);
for
(
unsigned
int
i
=
0
;
i
<
std
::
min
(
features
.
size
(),
(
size_t
)
50
);
i
++
)
...
...
samples/winrt_universal/PhoneTutorial/MainPage.xaml.cpp
View file @
e28cc973
...
...
@@ -84,10 +84,10 @@ void PhoneTutorial::MainPage::Process_Click(Platform::Object^ sender, Windows::U
// convert to grayscale
cv
::
Mat
intermediateMat
;
cv
::
cvtColor
(
mat
,
intermediateMat
,
C
V
_RGB2GRAY
);
cv
::
cvtColor
(
mat
,
intermediateMat
,
C
OLOR
_RGB2GRAY
);
// convert to BGRA
cv
::
cvtColor
(
intermediateMat
,
mat
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
intermediateMat
,
mat
,
C
OLOR
_GRAY2BGRA
);
// copy processed image back to the WriteableBitmap
memcpy
(
pPixels
,
mat
.
data
,
4
*
height
*
width
);
...
...
samples/wp8/OcvImageManipulation/PhoneXamlDirect3DApp1/PhoneXamlDirect3DApp1Comp/Direct3DInterop.cpp
View file @
e28cc973
...
...
@@ -136,22 +136,22 @@ namespace PhoneXamlDirect3DApp1Comp
void
Direct3DInterop
::
ApplyGrayFilter
(
cv
::
Mat
*
mat
)
{
cv
::
Mat
intermediateMat
;
cv
::
cvtColor
(
*
mat
,
intermediateMat
,
C
V
_RGBA2GRAY
);
cv
::
cvtColor
(
intermediateMat
,
*
mat
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
*
mat
,
intermediateMat
,
C
OLOR
_RGBA2GRAY
);
cv
::
cvtColor
(
intermediateMat
,
*
mat
,
C
OLOR
_GRAY2BGRA
);
}
void
Direct3DInterop
::
ApplyCannyFilter
(
cv
::
Mat
*
mat
)
{
cv
::
Mat
intermediateMat
;
cv
::
Canny
(
*
mat
,
intermediateMat
,
80
,
90
);
cv
::
cvtColor
(
intermediateMat
,
*
mat
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
intermediateMat
,
*
mat
,
C
OLOR
_GRAY2BGRA
);
}
void
Direct3DInterop
::
ApplyBlurFilter
(
cv
::
Mat
*
mat
)
{
cv
::
Mat
intermediateMat
;
// cv::Blur(image, intermediateMat, 80, 90);
cv
::
cvtColor
(
intermediateMat
,
*
mat
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
intermediateMat
,
*
mat
,
C
OLOR
_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
,
C
V
_RGBA2GRAY
);
cv
::
cvtColor
(
*
mat
,
intermediateMat
,
C
OLOR
_RGBA2GRAY
);
detector
->
detect
(
intermediateMat
,
features
);
for
(
unsigned
int
i
=
0
;
i
<
std
::
min
(
features
.
size
(),
(
size_t
)
50
);
i
++
)
...
...
samples/wp8/OcvRotatingCube/PhoneXamlDirect3DApp1/PhoneXamlDirect3DApp1Comp/Direct3DInterop.cpp
View file @
e28cc973
...
...
@@ -19,15 +19,15 @@ namespace PhoneXamlDirect3DApp1Comp
void
Direct3DInterop
::
ApplyGrayFilter
(
const
cv
::
Mat
&
image
)
{
cv
::
Mat
intermediateMat
;
cv
::
cvtColor
(
image
,
intermediateMat
,
C
V
_RGBA2GRAY
);
cv
::
cvtColor
(
intermediateMat
,
image
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
image
,
intermediateMat
,
C
OLOR
_RGBA2GRAY
);
cv
::
cvtColor
(
intermediateMat
,
image
,
C
OLOR
_GRAY2BGRA
);
}
void
Direct3DInterop
::
ApplyCannyFilter
(
const
cv
::
Mat
&
image
)
{
cv
::
Mat
intermediateMat
;
cv
::
Canny
(
image
,
intermediateMat
,
80
,
90
);
cv
::
cvtColor
(
intermediateMat
,
image
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
intermediateMat
,
image
,
C
OLOR
_GRAY2BGRA
);
}
void
Direct3DInterop
::
ApplySepiaFilter
(
const
cv
::
Mat
&
image
)
...
...
samples/wp8/OpenCVXaml/OpenCVComponent/OpenCVComponent.cpp
View file @
e28cc973
...
...
@@ -31,10 +31,10 @@ IAsyncOperation<IVectorView<int>^>^ OpenCVLib::ProcessAsync(IVector<int>^ input,
{
// convert to grayscale
cv
::
Mat
intermediateMat
;
cv
::
cvtColor
(
mat
,
intermediateMat
,
C
V
_RGB2GRAY
);
cv
::
cvtColor
(
mat
,
intermediateMat
,
C
OLOR
_RGB2GRAY
);
// convert to BGRA
cv
::
cvtColor
(
intermediateMat
,
mat
,
C
V
_GRAY2BGRA
);
cv
::
cvtColor
(
intermediateMat
,
mat
,
C
OLOR
_GRAY2BGRA
);
std
::
vector
<
int
>
output
;
CopyMatrixToVector
(
mat
,
output
,
size
);
...
...
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