-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
145 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace SamplesCore | ||
{ | ||
/// <summary> | ||
/// Paths | ||
/// </summary> | ||
internal static class FilePath | ||
{ | ||
public static class Image | ||
{ | ||
public const string Fruits = "Data/Image/fruits.jpg"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace SamplesCore.Windows | ||
{ | ||
interface ISample | ||
{ | ||
void Run(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
|
||
namespace SamplesCore.Windows | ||
{ | ||
class Program | ||
{ | ||
[STAThread] | ||
static void Main(string[] args) | ||
{ | ||
ISample sample = | ||
new MatToWriteableBitmap(); | ||
|
||
sample.Run(); | ||
} | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
SamplesCore/Samples/MatToWriteableBitmap.cs → ...e.Windows/Samples/MatToWriteableBitmap.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net5.0-windows</TargetFramework> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="OpenCvSharp4.runtime.win" Version="4.5.1.20201229" /> | ||
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.5.1.20201229" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Update="Data\Image\fruits.jpg"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using OpenCvSharp; | ||
|
||
namespace SamplesCore | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
class CameraCaptureSample : ISample | ||
{ | ||
public void Run() | ||
{ | ||
using var capture = new VideoCapture(0, VideoCaptureAPIs.DSHOW); | ||
if (!capture.IsOpened()) | ||
return; | ||
|
||
capture.FrameWidth = 1920; | ||
capture.FrameHeight = 1280; | ||
capture.AutoFocus = true; | ||
|
||
const int sleepTime = 10; | ||
|
||
using var window = new Window("capture"); | ||
var image = new Mat(); | ||
|
||
while (true) | ||
{ | ||
capture.Read(image); | ||
if (image.Empty()) | ||
break; | ||
|
||
window.ShowImage(image); | ||
int c = Cv2.WaitKey(sleepTime); | ||
if (c >= 0) | ||
{ | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters