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
de9f659f
Commit
de9f659f
authored
Jun 10, 2013
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Several transforms added to sample IMFTransform.
parent
9e062871
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
43 deletions
+40
-43
AdvancedCapture.xaml
samples/winrt/ImageManipulations/C++/AdvancedCapture.xaml
+2
-1
AdvancedCapture.xaml.cpp
...les/winrt/ImageManipulations/C++/AdvancedCapture.xaml.cpp
+25
-20
AdvancedCapture.xaml.h
samples/winrt/ImageManipulations/C++/AdvancedCapture.xaml.h
+1
-0
MainPage.xaml
samples/winrt/ImageManipulations/C++/MainPage.xaml
+1
-11
Grayscale.cpp
...Manipulations/C++/MediaExtensions/Grayscale/Grayscale.cpp
+0
-0
Grayscale.h
...geManipulations/C++/MediaExtensions/Grayscale/Grayscale.h
+11
-11
No files found.
samples/winrt/ImageManipulations/C++/AdvancedCapture.xaml
View file @
de9f659f
...
...
@@ -40,7 +40,8 @@
<Button x:Name="btnTakePhoto2" Click="btnTakePhoto_Click" IsEnabled="false" Margin="0,0,10,0">TakePhoto</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="2" Margin="0,10,0,0">
<CheckBox x:Name="chkAddRemoveEffect" Margin="0,0,10,0" Content="Grayscale Effect" IsEnabled="False" Checked="chkAddRemoveEffect_Checked" Unchecked="chkAddRemoveEffect_Unchecked"/>
<CheckBox x:Name="chkAddRemoveEffect" Margin="0,0,10,0" Content="Add Effect" IsEnabled="False" Checked="chkAddRemoveEffect_Checked" Unchecked="chkAddRemoveEffect_Unchecked"/>
<ComboBox Width="120"/>
</StackPanel>
</Grid>
...
...
samples/winrt/ImageManipulations/C++/AdvancedCapture.xaml.cpp
View file @
de9f659f
...
...
@@ -122,7 +122,7 @@ void AdvancedCapture::ScenarioReset()
void
AdvancedCapture
::
SoundLevelChanged
(
Object
^
sender
,
Object
^
e
)
{
create_task
(
Dispatcher
->
RunAsync
(
Windows
::
UI
::
Core
::
CoreDispatcherPriority
::
High
,
ref
new
Windows
::
UI
::
Core
::
DispatchedHandler
([
this
]()
{
{
if
(
Windows
::
Media
::
MediaControl
::
SoundLevel
!=
Windows
::
Media
::
SoundLevel
::
Muted
)
{
ScenarioReset
();
...
...
@@ -220,7 +220,7 @@ void AdvancedCapture::RecordLimitationExceeded(Windows::Media::Capture::MediaCap
void
AdvancedCapture
::
Failed
(
Windows
::
Media
::
Capture
::
MediaCapture
^
currentCaptureObject
,
Windows
::
Media
::
Capture
::
MediaCaptureFailedEventArgs
^
currentFailure
)
{
String
^
message
=
"Fatal error"
+
currentFailure
->
Message
;
create_task
(
Dispatcher
->
RunAsync
(
Windows
::
UI
::
Core
::
CoreDispatcherPriority
::
High
,
create_task
(
Dispatcher
->
RunAsync
(
Windows
::
UI
::
Core
::
CoreDispatcherPriority
::
High
,
ref
new
Windows
::
UI
::
Core
::
DispatchedHandler
([
this
,
message
]()
{
ShowStatusMessage
(
message
);
...
...
@@ -325,7 +325,7 @@ void AdvancedCapture::btnTakePhoto_Click(Platform::Object^ sender, Windows::UI::
EnableButton
(
false
,
"TakePhoto"
);
auto
currentRotation
=
GetCurrentPhotoRotation
();
task
<
StorageFile
^>
(
KnownFolders
::
PicturesLibrary
->
CreateFileAsync
(
TEMP_PHOTO_FILE_NAME
,
Windows
::
Storage
::
CreationCollisionOption
::
GenerateUniqueName
)).
then
([
this
,
currentRotation
](
task
<
StorageFile
^>
getFileTask
)
task
<
StorageFile
^>
(
KnownFolders
::
PicturesLibrary
->
CreateFileAsync
(
TEMP_PHOTO_FILE_NAME
,
Windows
::
Storage
::
CreationCollisionOption
::
GenerateUniqueName
)).
then
([
this
,
currentRotation
](
task
<
StorageFile
^>
getFileTask
)
{
try
{
...
...
@@ -520,7 +520,7 @@ void AdvancedCapture::lstEnumedDevices_SelectionChanged(Platform::Object^ sender
}
});
}
btnStartDevice2
->
IsEnabled
=
true
;
btnStartPreview2
->
IsEnabled
=
false
;
btnStartStopRecord2
->
IsEnabled
=
false
;
...
...
@@ -581,12 +581,12 @@ void AdvancedCapture::EnumerateWebcamsAsync()
}
void
AdvancedCapture
::
AddEffectToImageStream
()
{
{
auto
mediaCapture
=
m_mediaCaptureMgr
.
Get
();
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
charecteristic
=
mediaCapture
->
MediaCaptureSettings
->
VideoDeviceCharacteristic
;
if
((
charecteristic
!=
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
::
AllStreamsIdentical
)
&&
(
charecteristic
!=
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
::
PreviewPhotoStreamsIdentical
)
&&
(
charecteristic
!=
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
::
PreviewPhotoStreamsIdentical
)
&&
(
charecteristic
!=
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
::
RecordPhotoStreamsIdentical
))
{
Windows
::
Media
::
MediaProperties
::
IMediaEncodingProperties
^
props
=
mediaCapture
->
VideoDeviceController
->
GetMediaStreamProperties
(
Windows
::
Media
::
Capture
::
MediaStreamType
::
Photo
);
...
...
@@ -596,13 +596,13 @@ void AdvancedCapture::AddEffectToImageStream()
Windows
::
Foundation
::
Collections
::
IVectorView
<
Windows
::
Media
::
MediaProperties
::
IMediaEncodingProperties
^>^
supportedPropsList
=
mediaCapture
->
VideoDeviceController
->
GetAvailableMediaStreamProperties
(
Windows
::
Media
::
Capture
::
MediaStreamType
::
Photo
);
{
unsigned
int
i
=
0
;
while
(
i
<
supportedPropsList
->
Size
)
while
(
i
<
supportedPropsList
->
Size
)
{
Windows
::
Media
::
MediaProperties
::
IMediaEncodingProperties
^
props
=
supportedPropsList
->
GetAt
(
i
);
String
^
s
=
props
->
Type
;
if
(
props
->
Type
->
Equals
(
"Video"
))
{
{
task
<
void
>
(
mediaCapture
->
VideoDeviceController
->
SetMediaStreamPropertiesAsync
(
Windows
::
Media
::
Capture
::
MediaStreamType
::
Photo
,
props
)).
then
([
this
](
task
<
void
>
changeTypeTask
)
{
try
...
...
@@ -616,7 +616,7 @@ void AdvancedCapture::AddEffectToImageStream()
{
effectTask3
.
get
();
m_bEffectAddedToPhoto
=
true
;
ShowStatusMessage
(
"Adding effect to photo stream successful"
);
ShowStatusMessage
(
"Adding effect to photo stream successful"
);
chkAddRemoveEffect
->
IsEnabled
=
true
;
}
...
...
@@ -633,8 +633,7 @@ void AdvancedCapture::AddEffectToImageStream()
{
ShowExceptionMessage
(
e
);
chkAddRemoveEffect
->
IsEnabled
=
true
;
chkAddRemoveEffect
->
IsChecked
=
false
;
chkAddRemoveEffect
->
IsChecked
=
false
;
}
});
...
...
@@ -686,8 +685,8 @@ void AdvancedCapture::chkAddRemoveEffect_Checked(Platform::Object^ sender, Windo
auto
mediaCapture
=
m_mediaCaptureMgr
.
Get
();
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
charecteristic
=
mediaCapture
->
MediaCaptureSettings
->
VideoDeviceCharacteristic
;
ShowStatusMessage
(
"Add effect successful to preview stream successful"
);
if
((
charecteristic
!=
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
::
AllStreamsIdentical
)
&&
ShowStatusMessage
(
"Add effect successful to preview stream successful"
);
if
((
charecteristic
!=
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
::
AllStreamsIdentical
)
&&
(
charecteristic
!=
Windows
::
Media
::
Capture
::
VideoDeviceCharacteristic
::
PreviewRecordStreamsIdentical
))
{
Windows
::
Media
::
MediaProperties
::
IMediaEncodingProperties
^
props
=
mediaCapture
->
VideoDeviceController
->
GetMediaStreamProperties
(
Windows
::
Media
::
Capture
::
MediaStreamType
::
VideoRecord
);
...
...
@@ -703,14 +702,14 @@ void AdvancedCapture::chkAddRemoveEffect_Checked(Platform::Object^ sender, Windo
m_bEffectAddedToRecord
=
true
;
AddEffectToImageStream
();
chkAddRemoveEffect
->
IsEnabled
=
true
;
}
}
catch
(
Exception
^
e
)
{
ShowExceptionMessage
(
e
);
chkAddRemoveEffect
->
IsEnabled
=
true
;
chkAddRemoveEffect
->
IsChecked
=
false
;
}
});
});
}
else
{
...
...
@@ -718,7 +717,7 @@ void AdvancedCapture::chkAddRemoveEffect_Checked(Platform::Object^ sender, Windo
chkAddRemoveEffect
->
IsEnabled
=
true
;
}
}
}
else
{
AddEffectToImageStream
();
...
...
@@ -777,7 +776,7 @@ void AdvancedCapture::chkAddRemoveEffect_Unchecked(Platform::Object^ sender, Win
{
ShowExceptionMessage
(
e
);
chkAddRemoveEffect
->
IsEnabled
=
true
;
chkAddRemoveEffect
->
IsChecked
=
true
;
chkAddRemoveEffect
->
IsChecked
=
true
;
}
});
...
...
@@ -791,7 +790,7 @@ void AdvancedCapture::chkAddRemoveEffect_Unchecked(Platform::Object^ sender, Win
{
ShowExceptionMessage
(
e
);
chkAddRemoveEffect
->
IsEnabled
=
true
;
chkAddRemoveEffect
->
IsChecked
=
true
;
chkAddRemoveEffect
->
IsChecked
=
true
;
}
...
...
@@ -813,7 +812,7 @@ void AdvancedCapture::chkAddRemoveEffect_Unchecked(Platform::Object^ sender, Win
{
ShowExceptionMessage
(
e
);
chkAddRemoveEffect
->
IsEnabled
=
true
;
chkAddRemoveEffect
->
IsChecked
=
true
;
chkAddRemoveEffect
->
IsChecked
=
true
;
}
});
...
...
@@ -821,7 +820,7 @@ void AdvancedCapture::chkAddRemoveEffect_Unchecked(Platform::Object^ sender, Win
else
{
chkAddRemoveEffect
->
IsEnabled
=
true
;
chkAddRemoveEffect
->
IsChecked
=
true
;
chkAddRemoveEffect
->
IsChecked
=
true
;
}
}
catch
(
Exception
^
e
)
...
...
@@ -1032,3 +1031,9 @@ Windows::Media::Capture::VideoRotation AdvancedCapture::VideoRotationLookup(
}
}
void
SDKSample
::
MediaCapture
::
AdvancedCapture
::
EffectType_SelectionChanged
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Controls
::
SelectionChangedEventArgs
^
e
)
{
}
samples/winrt/ImageManipulations/C++/AdvancedCapture.xaml.h
View file @
de9f659f
...
...
@@ -98,6 +98,7 @@ namespace SDKSample
bool
m_bRotateVideoOnOrientationChange
;
bool
m_bReversePreviewRotation
;
Windows
::
Foundation
::
EventRegistrationToken
m_orientationChangedEventToken
;
void
EffectType_SelectionChanged
(
Platform
::
Object
^
sender
,
Windows
::
UI
::
Xaml
::
Controls
::
SelectionChangedEventArgs
^
e
);
};
}
}
samples/winrt/ImageManipulations/C++/MainPage.xaml
View file @
de9f659f
...
...
@@ -116,17 +116,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Row="0" Source="Assets/microsoft-sdk.png" AutomationProperties.Name="Microsoft Logo" Stretch="None" HorizontalAlignment="Left"/>
<TextBlock Style="{StaticResource FooterStyle}" Text="© Microsoft Corporation. All rights reserved." TextWrapping="Wrap" Grid.Row="1" HorizontalAlignment="Left"/>
<StackPanel x:Name="FooterPanel" Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right">
<HyperlinkButton Content="Terms of use" Tag="http://www.microsoft.com/About/Legal/EN/US/IntellectualProperty/Copyright/default.aspx"
Click="Footer_Click" FontSize="12" Style="{StaticResource HyperlinkStyle}"/>
<TextBlock Text="|" Style="{StaticResource SeparatorStyle}" VerticalAlignment="Center"/>
<HyperlinkButton Content="Trademarks" Tag="http://www.microsoft.com/About/Legal/EN/US/IntellectualProperty/Trademarks/EN-US.aspx"
Click="Footer_Click" FontSize="12" Style="{StaticResource HyperlinkStyle}"/>
<TextBlock Text="|" Style="{StaticResource SeparatorStyle}" VerticalAlignment="Center"/>
<HyperlinkButton Content="Privacy Statement" Tag="http://privacy.microsoft.com" Click="Footer_Click" FontSize="12" Style="{StaticResource HyperlinkStyle}"/>
</StackPanel>
<StackPanel x:Name="FooterPanel" Orientation="Horizontal" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right"/>
</Grid>
...
...
samples/winrt/ImageManipulations/C++/MediaExtensions/Grayscale/Grayscale.cpp
View file @
de9f659f
This diff is collapsed.
Click to expand it.
samples/winrt/ImageManipulations/C++/MediaExtensions/Grayscale/Grayscale.h
View file @
de9f659f
...
...
@@ -37,18 +37,18 @@ DEFINE_GUID(CLSID_GrayscaleMFT,
// Configuration attributes
// {698649BE-8EAE-4551-A4CB-3EC98FBD3D86}
DEFINE_GUID
(
MFT_IMAGE_EFFECT
,
0x698649be
,
0x8eae
,
0x4551
,
0xa4
,
0xcb
,
0x3e
,
0xc9
,
0x8f
,
0xbd
,
0x3d
,
0x86
);
// {7BBBB051-133B-41F5-B6AA-5AFF9B33A2CB}
DEFINE_GUID
(
MFT_GRAYSCALE_DESTINATION_RECT
,
0x7bbbb051
,
0x133b
,
0x41f5
,
0xb6
,
0xaa
,
0x5a
,
0xff
,
0x9b
,
0x33
,
0xa2
,
0xcb
);
enum
ProcessingType
{
Preview
,
GrayScale
,
Canny
,
Zoo
m
,
Sepia
GrayScale
,
Canny
,
Sobel
,
Histogra
m
,
InvalidEffect
};
template
<
class
T
>
void
SafeRelease
(
T
**
ppT
)
...
...
@@ -63,9 +63,9 @@ template <class T> void SafeRelease(T **ppT)
// CGrayscale class:
// Implements a grayscale video effect.
class
CGrayscale
class
CGrayscale
:
public
Microsoft
::
WRL
::
RuntimeClass
<
Microsoft
::
WRL
::
RuntimeClassFlags
<
Microsoft
::
WRL
::
RuntimeClassType
::
WinRtClassicComMix
>
,
Microsoft
::
WRL
::
RuntimeClassFlags
<
Microsoft
::
WRL
::
RuntimeClassType
::
WinRtClassicComMix
>
,
ABI
::
Windows
::
Media
::
IMediaExtension
,
IMFTransform
>
{
...
...
@@ -231,7 +231,7 @@ private:
CRITICAL_SECTION
m_critSec
;
// Transformation parameters
ProcessingType
m_TransformType
;
ProcessingType
m_TransformType
;
D2D_RECT_U
m_rcDest
;
// Destination rectangle for the effect.
// Streaming
...
...
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