Extracting images from a video:

ffmpeg -i input.mp4 -r {frames/second} -s {WxH} -f image2 out-%06d.jpeg

1분당 1장, HD(1280x720) 크기로 이미지 추출:

ffmpeg -i input.mp4 -r 1/60 -s 1280x720 -f image2 out-%06d.jpeg

'C, C++ > FFmepg' 카테고리의 다른 글

Cutting Videos Based on Time Range using FFmpeg  (0) 2022.11.23
FFmpeg CLI  (0) 2021.08.15

원문: https://docs.microsoft.com/en-us/archive/msdn-magazine/2018/january/csharp-all-about-span-exploring-a-new-net-mainstay

 

C# - All About Span: Exploring a New .NET Mainstay

01/04/2019 23 minutes to read In this article --> January 2018 Volume 33 Number 1 [C#] All About Span: Exploring a New .NET Mainstay By Stephen Toub | January 2018 This article has been updated to reflect technical changes following its publication. Imagin

docs.microsoft.com

 

From To Mechanism
ArraySegment<T> Memory<T> Implicit cast, AsMemory method
ReadOnlyMemory<T> Implicit cast, AsMemory method
ReadOnlySpan<T> Implicit cast, AsSpan method
Span<T> Implicit cast, AsSpan method
T[] Array property
Memory<T> ArraySegment<T> MemoryMarshal.TryGetArray method
ReadOnlyMemory<T> Implicit cast, AsMemory method
Span<T> Span property
ReadOnlyMemory<T> ArraySegment<T> MemoryMarshal.TryGetArray method
ReadOnlySpan<T> Span property
ReadOnlySpan<T> ref readonly T Indexer get accessor, marshaling methods
Span<T> ReadOnlySpan<T> Implicit cast, AsSpan method
ref T Indexer get accessor, marshaling methods
String ReadOnlyMemory<char> AsMemory method
ReadOnlySpan<char> Implicit cast, AsSpan method
T[] ArraySegment<T> Ctor, Implicit cast
Memory<T> Ctor, Implicit cast, AsMemory method
ReadOnlyMemory<T> Ctor, Implicit cast, AsMemory method
ReadOnlySpan<T> Ctor, Implicit cast, AsSpan method
Span<T> Ctor, Implicit cast, AsSpan method
void* ReadOnlySpan<T> Ctor
Span<T> Ctor

'.NET' 카테고리의 다른 글

.NET 설치 확인  (0) 2021.09.01
TFM(Target Framework Moniker)  (0) 2021.08.31

SDK 버전 확인

Visual Studio Menu > View > Terminal

PS D:\Dev> dotnet --list-sdks
3.1.404 [C:\Program Files\dotnet\sdk]
5.0.100 [C:\Program Files\dotnet\sdk]
5.0.400 [C:\Program Files\dotnet\sdk]

런타임 버전 확인

PS D:\Dev\ETRI\ActiveEMSv2> dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

 

PS D:\Dev\MyProject> dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.404
 Commit:    470f6754b3

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19042
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.404\

Host (useful for support):
  Version: 5.0.9
  Commit:  208e377a53

.NET SDKs installed:
  3.1.404 [C:\Program Files\dotnet\sdk]
  5.0.100 [C:\Program Files\dotnet\sdk]
  5.0.400 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.9 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

'.NET' 카테고리의 다른 글

Non-Allocating/Non-Copying Conversions Between Span-Related Types  (0) 2021.09.01
TFM(Target Framework Moniker)  (0) 2021.08.31

원문: https://docs.microsoft.com/ko-kr/dotnet/standard/frameworks

 

SDK 스타일 프로젝트의 대상 프레임워크 - .NET

.NET 앱 및 라이브러리의 대상 프레임워크에 대해 알아봅니다.

docs.microsoft.com

최신 버전

대상 프레임워크 최신안정적인 버전 TFM 구현된.NET Standard 버전
.NET 5 5.0 net5.0 해당 없음
.NET Standard 2.1 netstandard2.1 해당 없음
.NET Core 3.1 netcoreapp3.1 2.1
.NET Framework 4.8 net48 2.0

지원되는 대상 프레임워크

대상 프레임워크 TFM
.NET 5 이상(및 .NET Core) netcoreapp1.0
netcoreapp1.1
netcoreapp2.0
netcoreapp2.1
netcoreapp2.2
netcoreapp3.0
netcoreapp3.1
net5.0
net6.0
.NET 표준 netstandard1.0
netstandard1.1
netstandard1.2
netstandard1.3
netstandard1.4
netstandard1.5
netstandard1.6
netstandard2.0
netstandard2.1
.NET Framework net11
net20
net35
net40
net403
net45
net451
net452
net46
net461
net462
net47
net471
net472
net48
Windows 스토어 netcore [netcore45]
netcore45 [win] [win8]
netcore451 [win81]
.NET Micro Framework netmf
Silverlight sl4
sl5
Windows Phone wp [wp7]
wp7
wp75
wp8
wp81
wpa81
유니버설 Windows 플랫폼 uap [uap10.0]
uap10.0 [win10] [netcore50]

.NET 5+ OS별 TFM

TFM 호환 가능
net5.0 net1..4(NU1701 경고 포함)
netcoreapp1..3.1(WinForms 또는 WPF가 참조되는 경우 경고)
netstandard1..2.1
net5.0-windows netcoreapp1..3.1(net5.0에서 상속되는 다른 모든 항목 포함)
net6.0 (net5.0의 후속 버전)
net6.0-android xamarin.android(+net6.0에서 상속된 다른 모든 항목)
net6.0-ios xamarin.ios(+net6.0에서 상속된 다른 모든 항목)
net6.0-macos xamarin.mac(+net6.0에서 상속된 다른 모든 항목)
net6.0-maccatalyst xamarin.ios(+net6.0에서 상속된 다른 모든 항목)
net6.0-tvos xamarin.tvos(+net6.0에서 상속된 다른 모든 항목)
net6.0-windows (net5.0-windows의 후속 버전)

 

C# 언어 버전 관리

원문: https://docs.microsoft.com/ko-kr/dotnet/csharp/language-reference/configure-language-version#defaults

 

C# 언어 버전 관리 - C# 가이드

C# 언어 버전은 프로젝트에 따라 결정된다는 사실과 그 이유를 알아봅니다. 기본값을 수동으로 재정의하는 방법을 알아봅니다.

docs.microsoft.com

C# 8.0은 .NET Core 3.x 이상 버전에서만 지원

C# 9.0은 .NET 5 이상 버전에서만 지원

 

기본값

대상 프레임워크 버전 C# 언어 버전 기본값
.NET 6.x C# 10.0
.NET 5.x C# 9.0
.NET Core 3.x C# 8.0
.NET Core 2.x C# 7.3
.NET Standard 2.1 C# 8.0
.NET Standard 2.0 C# 7.3
.NET Standard 1.x C# 7.3
.NET Framework 모두 C# 7.3

기본값 재정의

<PropertyGroup>
   <LangVersion>latest</LangVersion>
</PropertyGroup>
의미
preview 컴파일러가 최신 미리 보기 버전의 유효한 언어 구문을 모두 허용합니다.
lastest 컴파일러가 최신 릴리스 버전(부 버전 포함)의 구문을 허용합니다.
latestMajor (default) 컴파일러가 최신 릴리스 주 버전의 구문을 허용합니다.

'.NET' 카테고리의 다른 글

Non-Allocating/Non-Copying Conversions Between Span-Related Types  (0) 2021.09.01
.NET 설치 확인  (0) 2021.09.01

원문: https://www.espressoenglish.net/food-dish-meal-or-cuisine/

Food

Food is the most general word, referring to anything you can eat.

Simple things (like a piece of bread) and complex things (like a seafood stew with many ingredients)

are all in the general category of food.

In everyday English, you'll often hear sentences like:

  • What's your favorite food?
  • Let's go get some food.

The word food is usually singular - so you should say

"I ate a lot of food (not foods) last night."

But there are some exceptions - we use foods, plural,

when specifically talking about multiple distinct types, for example,

"At the international festival, I tries foods from around the world."

Dish

The word dish has two meanings.

One is a physical object used to hold, cook, and serve food.

When we talk about washing the dishes,

we are washing the plates, bowls, pots, pans, spoons, forks, etc.

 

The word dish can also refer to one prepared item of food, like a lasagna or a fruit salad.

If you go to a type of social event called a potluck, each person who attends brings a dish

- one person brings a salad, another person brings an apple pie, another person brings beef stew, etc.

Each of these prepared items of food is a dish.

 

At a restaurant, you might encounter the terms main dish (a large amount of food - like a steak)

and side dish (a small amount of food that accompanies the main dish - like a small bowl of broccoli).

Meal

The word meal refers to the customary time/occasion of eating food.

Most people eat 3 meals - breakfast, lunch, and dinner.

Meal also refers to all the food eaten during one of these occasions

- so one meal can include multiple dishes.

Dinner is one meal, but you might have chicken, rice, salad, and ice cream.

Each of those is one dish, and when eaten all together on one occasion,

they are a meal.

 

You might have a big/heavy meal (with a lot of food)

or a light meal (with little food).

A meal can be elaborate (with many different and complicated dishes)

or simple (with just a few easy-to-make dishes).

Cuisine

The word cuisine describes a typical manner/style of preparing food.

We usually use this word with country adjectives (Italian cuisine, Brazilian cuisine, Moroccan cuisine)

or ethanic or regional adjectives (Cajun cuisine, Jewish cuisine, South Indian cuisine).

In everyday Enghlish, however, many people simply say "food" when talking about getting something to eat:

  • I love Chinese food.
  • Do you want to try some Ethiopian food?

When talking more specifially about the techniques and traditions,

then we would say cuisine:

  • Palm oil is used prominently in West African cuisine.
  • The chef specializes in French cuisine.

윈도우키 + R > secpol.msc 입력 > 보안 설정 > 로컬 정책 > 보안 옵션> 네트워크 보안: LAN Manager 인증 수준
"NTLMv2 응답만 보냅니다. LM 및 NTLM은 거부합니다." 선택

 

  • Visual Studio 2019
  • NVIDIA CUDA (cuda-toolkit-archive)
  • NVIDIA cuDNN (cudnn-archive)
  • OpenCV 2.4 이상 (4.1)

Darknet project

darknet github

 

GitHub - AlexeyAB/darknet: YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Da

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet ) - GitHub - AlexeyAB/darknet: YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object ...

github.com

Visual Studio 설정

darknet-master\build\darknet\darknet.vcxproj 파일 수정

    :
    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
    :
    <PlatformToolset>v142</PlatformToolset>
    :
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
    <ImportGroup Label="ExtensionSettings">
    <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 10.1.props" />
  </ImportGroup>
    :
    <AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(SolutionDir)..\..\include;$(SolutionDir)..\..\3rdparty\stb\include;$(SolutionDir)..\..\3rdparty\pthreads\include;$(CUDA_PATH_V10_1)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
    :
    <AdditionalLibraryDirectories>$(OPENCV_DIR)\x64\vc15\lib;$(CUDA_PATH)\lib\$(PlatformName);$(CUDNN)\lib\x64;$(cudnn)\lib\x64;..\..\3rdparty\pthreads\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
    :
    <PostBuildEvent>
      <Command>xcopy /d /y "$(OpenCV_DIR)\x64\vc15\opencv_ffmpeg???_64.dll" "$(OutDir)"
xcopy /d /y "$(OpenCV_DIR)\x64\vc15\opencv_world???.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cublas64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cudart64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cusolver64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\curand64_*.dll" "$(OutDir)"
</Command>
    </PostBuildEvent>
    :
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
    <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 10.1.targets" />
  </ImportGroup>
    :
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectGuid>{4CF5694F-12A5-4012-8D94-9A0915E9FEB5}</ProjectGuid>
    <RootNamespace>darknet</RootNamespace>
    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v142</PlatformToolset>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v142</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>MultiByte</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
    <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 10.1.props" />
  </ImportGroup>
  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <OutDir>$(SolutionDir)$(Platform)\</OutDir>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <OutDir>$(SolutionDir)$(Platform)\</OutDir>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>Disabled</Optimization>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(SolutionDir)..\..\include;$(SolutionDir)..\..\3rdparty\stb\include;$(SolutionDir)..\..\3rdparty\pthreads\include;$(CUDA_PATH_V10_1)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>CUDNN_HALF;CUDNN;_CRTDBG_MAP_ALLOC;_MBCS;_TIMESPEC_DEFINED;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_RAND_S;GPU;WIN32;DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <UndefinePreprocessorDefinitions>OPENCV;</UndefinePreprocessorDefinitions>
      <MultiProcessorCompilation>true</MultiProcessorCompilation>
      <ForcedIncludeFiles>stdlib.h;crtdbg.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
    </ClCompile>
    <Link>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AdditionalLibraryDirectories>$(OPENCV_DIR)\x64\vc15\lib;$(CUDA_PATH)\lib\$(PlatformName);$(CUDNN)\lib\x64;$(cudnn)\lib\x64;..\..\3rdparty\pthreads\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <OutputFile>$(OutDir)\$(TargetName)$(TargetExt)</OutputFile>
      <AdditionalDependencies>pthreadVC2.lib;cublas.lib;curand.lib;cudart.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <AssemblyDebug>true</AssemblyDebug>
    </Link>
    <CudaCompile>
      <CodeGeneration>compute_30,sm_30;compute_75,sm_75</CodeGeneration>
      <TargetMachinePlatform>64</TargetMachinePlatform>
    </CudaCompile>
    <PostBuildEvent>
      <Command>xcopy /d /y "$(OpenCV_DIR)\x64\vc15\opencv_ffmpeg???_64.dll" "$(OutDir)"
xcopy /d /y "$(OpenCV_DIR)\x64\vc15\opencv_world???.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cublas64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cudart64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cusolver64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\curand64_*.dll" "$(OutDir)"
</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <AdditionalIncludeDirectories>$(OPENCV_DIR)\include;$(SolutionDir)..\..\include;$(SolutionDir)..\..\3rdparty\stb\include;$(SolutionDir)..\..\3rdparty\pthreads\include;$(CUDA_PATH_V10_1)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>OPENCV;CUDNN_HALF;CUDNN;_TIMESPEC_DEFINED;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_RAND_S;GPU;WIN32;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <CLanguageStandard>c11</CLanguageStandard>
      <CppLanguageStandard>c++1y</CppLanguageStandard>
      <PrecompiledHeaderCompileAs>CompileAsCpp</PrecompiledHeaderCompileAs>
      <CompileAs>Default</CompileAs>
      <UndefinePreprocessorDefinitions>NDEBUG</UndefinePreprocessorDefinitions>
      </AdditionalUsingDirectories>
    </ClCompile>
    <Link>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <AdditionalLibraryDirectories>$(OPENCV_DIR)\x64\vc15\lib;$(CUDA_PATH)\lib\$(PlatformName);$(CUDNN)\lib\x64;$(cudnn)\lib\x64;..\..\3rdparty\pthreads\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
      <AdditionalDependencies>pthreadVC2.lib;cublas.lib;curand.lib;cudart.lib;%(AdditionalDependencies)</AdditionalDependencies>
      <OutputFile>$(OutDir)\$(TargetName)$(TargetExt)</OutputFile>
    </Link>
    <CudaCompile>
      <TargetMachinePlatform>64</TargetMachinePlatform>
      <CodeGeneration>compute_30,sm_30;compute_75,sm_75</CodeGeneration>
    </CudaCompile>
    <PostBuildEvent>
      <Command>xcopy /d /y "$(OpenCV_DIR)\x64\vc15\opencv_ffmpeg???_64.dll" "$(OutDir)"
xcopy /d /y "$(OpenCV_DIR)\x64\vc15\opencv_world???.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cublas64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cudart64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cusolver64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\curand64_*.dll" "$(OutDir)"
</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemGroup>
    <CudaCompile Include="..\..\src\activation_kernels.cu" />
    <CudaCompile Include="..\..\src\avgpool_layer_kernels.cu" />
    <CudaCompile Include="..\..\src\blas_kernels.cu" />
    <CudaCompile Include="..\..\src\col2im_kernels.cu" />
    <ClInclude Include="..\..\src\upsample_layer.h" />
    <ClInclude Include="..\..\src\utils.h" />
    <ClInclude Include="..\..\src\yolo_layer.h" />
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
    <Import Project="$(VCTargetsPath)\BuildCustomizations\CUDA 10.1.targets" />
  </ImportGroup>
</Project>

OpenCV, cuDNN, GPU architecture 설정

$(OPENCV_DIR)\include
$(SolutionDir)..\..\include
$(SolutionDir)..\..\3rdparty\stb\include
$(SolutionDir)..\..\3rdparty\pthreads\include
$(CUDA_PATH_V10_1)\include
$(OPENCV_DIR)\x64\vc15\lib
$(CUDA_PATH)\lib\$(PlatformName)
$(CUDNN)\lib\x64;$(cudnn)\lib\x64
$(SolutionDir)..\..\3rdparty\pthreads\lib;

관련 DLL 복사

xcopy /d /y "$(OpenCV_DIR)\x64\vc15\opencv_ffmpeg???_64.dll" "$(OutDir)"
xcopy /d /y "$(OpenCV_DIR)\x64\vc15\opencv_world???.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cublas64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cudart64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\cusolver64_*.dll" "$(OutDir)"
xcopy /d /y "$(CUDA_PATH_V10_1)\bin\curand64_*.dll" "$(OutDir)"

테스트 실행

미리 훈련된 weight 값 다운로드

...\build\darknet\x64>darknet detector test ./cfg/coco.data ./cfg/yolov3.cfg ./yolov3.weights ./data/dog.jpg
 CUDA-version: 10010 (10020), cuDNN: 7.6.1, CUDNN_HALF=1, GPU count: 1
 OpenCV version: 4.1.0
 compute_capability = 610, cudnn_half = 0
net.optimized_memory = 0
batch = 1, time_steps = 1, train = 0
   layer   filters  size/strd(dil)      input                output
   0 conv     32       3 x 3/ 1    416 x 416 x   3 ->  416 x 416 x  32 0.299 BF
   1 conv     64       3 x 3/ 2    416 x 416 x  32 ->  208 x 208 x  64 1.595 BF
   2 conv     32       1 x 1/ 1    208 x 208 x  64 ->  208 x 208 x  32 0.177 BF
   3 conv     64       3 x 3/ 1    208 x 208 x  32 ->  208 x 208 x  64 1.595 BF
   4 Shortcut Layer: 1,  wt = 0, wn = 0, outputs: 208 x 208 x  64 0.003 BF
   5 conv    128       3 x 3/ 2    208 x 208 x  64 ->  104 x 104 x 128 1.595 BF
   6 conv     64       1 x 1/ 1    104 x 104 x 128 ->  104 x 104 x  64 0.177 BF
   7 conv    128       3 x 3/ 1    104 x 104 x  64 ->  104 x 104 x 128 1.595 BF
   8 Shortcut Layer: 5,  wt = 0, wn = 0, outputs: 104 x 104 x 128 0.001 BF
   9 conv     64       1 x 1/ 1    104 x 104 x 128 ->  104 x 104 x  64 0.177 BF
  10 conv    128       3 x 3/ 1    104 x 104 x  64 ->  104 x 104 x 128 1.595 BF
  11 Shortcut Layer: 8,  wt = 0, wn = 0, outputs: 104 x 104 x 128 0.001 BF
  12 conv    256       3 x 3/ 2    104 x 104 x 128 ->   52 x  52 x 256 1.595 BF
  13 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
  14 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
  15 Shortcut Layer: 12,  wt = 0, wn = 0, outputs:  52 x  52 x 256 0.001 BF
  16 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
  17 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
  18 Shortcut Layer: 15,  wt = 0, wn = 0, outputs:  52 x  52 x 256 0.001 BF
  19 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
  20 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
  21 Shortcut Layer: 18,  wt = 0, wn = 0, outputs:  52 x  52 x 256 0.001 BF
  22 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
  23 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
  24 Shortcut Layer: 21,  wt = 0, wn = 0, outputs:  52 x  52 x 256 0.001 BF
  25 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
  26 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
  27 Shortcut Layer: 24,  wt = 0, wn = 0, outputs:  52 x  52 x 256 0.001 BF
  28 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
  29 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
  30 Shortcut Layer: 27,  wt = 0, wn = 0, outputs:  52 x  52 x 256 0.001 BF
  31 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
  32 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
  33 Shortcut Layer: 30,  wt = 0, wn = 0, outputs:  52 x  52 x 256 0.001 BF
  34 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
  35 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
  36 Shortcut Layer: 33,  wt = 0, wn = 0, outputs:  52 x  52 x 256 0.001 BF
  37 conv    512       3 x 3/ 2     52 x  52 x 256 ->   26 x  26 x 512 1.595 BF
  38 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  39 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  40 Shortcut Layer: 37,  wt = 0, wn = 0, outputs:  26 x  26 x 512 0.000 BF
  41 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  42 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  43 Shortcut Layer: 40,  wt = 0, wn = 0, outputs:  26 x  26 x 512 0.000 BF
  44 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  45 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  46 Shortcut Layer: 43,  wt = 0, wn = 0, outputs:  26 x  26 x 512 0.000 BF
  47 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  48 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  49 Shortcut Layer: 46,  wt = 0, wn = 0, outputs:  26 x  26 x 512 0.000 BF
  50 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  51 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  52 Shortcut Layer: 49,  wt = 0, wn = 0, outputs:  26 x  26 x 512 0.000 BF
  53 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  54 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  55 Shortcut Layer: 52,  wt = 0, wn = 0, outputs:  26 x  26 x 512 0.000 BF
  56 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  57 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  58 Shortcut Layer: 55,  wt = 0, wn = 0, outputs:  26 x  26 x 512 0.000 BF
  59 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  60 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  61 Shortcut Layer: 58,  wt = 0, wn = 0, outputs:  26 x  26 x 512 0.000 BF
  62 conv   1024       3 x 3/ 2     26 x  26 x 512 ->   13 x  13 x1024 1.595 BF
  63 conv    512       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 512 0.177 BF
  64 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  65 Shortcut Layer: 62,  wt = 0, wn = 0, outputs:  13 x  13 x1024 0.000 BF
  66 conv    512       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 512 0.177 BF
  67 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  68 Shortcut Layer: 65,  wt = 0, wn = 0, outputs:  13 x  13 x1024 0.000 BF
  69 conv    512       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 512 0.177 BF
  70 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  71 Shortcut Layer: 68,  wt = 0, wn = 0, outputs:  13 x  13 x1024 0.000 BF
  72 conv    512       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 512 0.177 BF
  73 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  74 Shortcut Layer: 71,  wt = 0, wn = 0, outputs:  13 x  13 x1024 0.000 BF
  75 conv    512       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 512 0.177 BF
  76 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  77 conv    512       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 512 0.177 BF
  78 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  79 conv    512       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 512 0.177 BF
  80 conv   1024       3 x 3/ 1     13 x  13 x 512 ->   13 x  13 x1024 1.595 BF
  81 conv    255       1 x 1/ 1     13 x  13 x1024 ->   13 x  13 x 255 0.088 BF
  82 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00
  83 route  79                                     ->   13 x  13 x 512
  84 conv    256       1 x 1/ 1     13 x  13 x 512 ->   13 x  13 x 256 0.044 BF
  85 upsample                 2x    13 x  13 x 256 ->   26 x  26 x 256
  86 route  85 61                                  ->   26 x  26 x 768
  87 conv    256       1 x 1/ 1     26 x  26 x 768 ->   26 x  26 x 256 0.266 BF
  88 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  89 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  90 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  91 conv    256       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 256 0.177 BF
  92 conv    512       3 x 3/ 1     26 x  26 x 256 ->   26 x  26 x 512 1.595 BF
  93 conv    255       1 x 1/ 1     26 x  26 x 512 ->   26 x  26 x 255 0.177 BF
  94 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00
  95 route  91                                     ->   26 x  26 x 256
  96 conv    128       1 x 1/ 1     26 x  26 x 256 ->   26 x  26 x 128 0.044 BF
  97 upsample                 2x    26 x  26 x 128 ->   52 x  52 x 128
  98 route  97 36                                  ->   52 x  52 x 384
  99 conv    128       1 x 1/ 1     52 x  52 x 384 ->   52 x  52 x 128 0.266 BF
 100 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
 101 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
 102 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
 103 conv    128       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 128 0.177 BF
 104 conv    256       3 x 3/ 1     52 x  52 x 128 ->   52 x  52 x 256 1.595 BF
 105 conv    255       1 x 1/ 1     52 x  52 x 256 ->   52 x  52 x 255 0.353 BF
 106 yolo
[yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00
Total BFLOPS 65.879
avg_outputs = 532444
 Allocate additional workspace_size = 52.43 MB
Loading weights from ./yolov3.weights...
 seen 64, trained: 32013 K-images (500 Kilo-batches_64)
Done! Loaded 107 layers from weights-file
./data/dog.jpg: Predicted in 57.593000 milli-seconds.
bicycle: 99%
dog: 100%
truck: 94%

 

Docker 사용하기

$ docker pull votiethuy/tensorflow1.12-base
$ docker run -it --rm -v /c/TensorFlow/DW2TF:/dw2tf votiethuy/tensorflow1.12-base
# python main.py --cfg 'data/yolov3.cfg' --weights 'data/yolov3.weights' --output 'data/'

 

'ML' 카테고리의 다른 글

COCO Dataset  (0) 2023.08.16
Pascal VOC(Visual Object Classes) Challenges  (0) 2023.08.15
분류 모델의 성능평가지표 Accuracy, Recall, Precision, F1-score  (0) 2022.12.19

Anaconda3 > Anaconda Prompt

(base) C:\Users\user>conda update -n base conda
    :
(base) C:\Users\user>conda update --all
    :
(py39-tf-cpu) C:\Users\user>pip install tensorflow
    :
(py39-tf-cpu) C:\Users\user>pip install keras
    :

Anaconda Navigator

  • beautifulsoup4
  • imageio
  • matplotlib
  • opencv
  • scikit-image
  • scikit-learn
  • scipy
  • tqdm

'Python' 카테고리의 다른 글

설치된 패키지 목록 저장 및 복원  (0) 2022.08.25
How To Update All Python Packages  (0) 2021.10.13
Fibonacci series  (0) 2021.08.16
Array/List  (0) 2021.08.16
Number, String  (0) 2021.08.15
>>> # Fibonacci series:
>>> a, b = 0, 1
>>> while a < 10:
...     print(a, end=',')
...     a, b = b, a+b
...
0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610,987

'Python' 카테고리의 다른 글

설치된 패키지 목록 저장 및 복원  (0) 2022.08.25
How To Update All Python Packages  (0) 2021.10.13
Anaconda3  (0) 2021.08.16
Array/List  (0) 2021.08.16
Number, String  (0) 2021.08.15
values = [ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ]

Slicing

print(values[0])   # 10
print(values[-1])  # 19
print(values[-3:]) # [ 17, 18, 19 ] 
print(values[7:])  # [ 17, 18, 19 ]
print(values[:3])  # [ 10, 11, 12 ]
print(values[a:b]) # a <= LIST < b
>>> letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g']

>>> letters[2:5] = ['C', 'D', 'E']   # replace
>>> letters
['a', 'b', 'C', 'D', 'E', 'f', 'g']

>>> letters[2:5] = []    # remove
>>> letters[:] = []      # clear

Operation

list1 = [ 1, 2, 3 ]
list2 = [ 4, 5, 6 ]
list3 = list1 + list2   # [ 1, 2, 3, 4, 5, 6 ]

list1.append(10)   # [ 1, 2, 3, 10 ]
print(len(list1))  # 4

Nested

중첩 가능, 새로운 리스트를 한 리스트의 요소에 포함 가능

>>> a = [ 'a', 'b', 'c' ]
>>> b = [ 1, 2, 3 ]
>>> x = [ a, n ]
>>> x
[['a', 'b', 'c'], [1, 2, 3]]
>>> x[0]
['a', 'b', 'c']
>>> x[0][1]
'b'

'Python' 카테고리의 다른 글

설치된 패키지 목록 저장 및 복원  (0) 2022.08.25
How To Update All Python Packages  (0) 2021.10.13
Anaconda3  (0) 2021.08.16
Fibonacci series  (0) 2021.08.16
Number, String  (0) 2021.08.15

Numbers

  • Division (/) always returns a float.
  • The equal sign (=) is used to assign a value to variable.
  • If a variable is not 'defined' (assigned a value), trying to use it will give you an error.
  • In interactive mode, the last printed expression is assigned to the variable _.
  • supports types of numbers, such as int, float, Decimal and Fraction.
  • also has built-in support for complex numbers, and uses the j or J suffix to indicate the imaginary part (e.g. 3+5j).
>>> 8 / 5   # division always returns a floating number
1.6

>>> 17 // 3  # floor division discards the fractional part
5

>>> 17 % 3   # the % operator returns the remainder of the division
2

>>> 5 ** 2   # 5 squared
25

>>> 2 ** 7   # 2 to the power of 7
128

Strings

  • can be enclosed in single quotes('…') or double quotes (“…”)
  • \ can be used to escape quotes:
  • String literals can span multiple lines.
    • “”“…”“” or '…'
    • it's possible to prevent including end of lines by adding a \ at the end of the line
  • Python strings cannot be changed – they are immutable.
>>> 3 * 'a' + 'bcd'
'aaabcd'
>>> 'Py' 'thon'
'Python'

>>> text = ('Put several strings within parentheses '
...         'to have them joined together.')
>>> text
'Put several strings within parentheses to have them joined together.'

>>> prefix = 'Py'
>>> prefix 'thon'  # can't concatenate a variable and a string literal
  File "<stdin>", line 1
    prefix 'thon'
                ^
SyntaxError: invalid syntax

>>> ('a' * 3) 'bcd' # SyntaxError

>>> prefix + 'thon'
'Python'

>>> word = 'python'
>>> word[0]
'p'
>>> word[5]
'o'
>>> word[-1]
'n'
>>> word[0:2]
'py'
>>> word[2:5]
'tho'
>>> word[:2] + word[2:]
'python'

>>> word[100] # IndexError
>>> word[4:100]
'on'
>>> word[100:]
''
>>> len(word)
6

 

'Python' 카테고리의 다른 글

설치된 패키지 목록 저장 및 복원  (0) 2022.08.25
How To Update All Python Packages  (0) 2021.10.13
Anaconda3  (0) 2021.08.16
Fibonacci series  (0) 2021.08.16
Array/List  (0) 2021.08.16

원본: 경로 표현식

온라인 테스트: https://codebeautify.org/Xpath-Tester

 

위치경로(location path) 대표적인 경로 연산자

경로 연산자 설명
노드 이름 해당 '노드 이름'과 일치하는 모든 노드 선택
/ 루트 노드부터 순서대로 탐색
// 현재 노드의 위치와 상관없이 지정된 노드에서부터 순서대로 탐색
. 현재 노드 선택
.. 현재 노드의 부모 노드 선택
@ 속성 노드 선택

검색 방향 설정

검색 방향 설명
self 현재 노드를 선택
attribute 현재 노드의 속성 노드를 모두 선택
namespace 현재 노드의 네임스페이스 노드를 모두 선택
child 현재 노드의 자식 노드를 모두 선택
descendant 현재 노드의 자손 노드를 모두 선택
descendant-or-self 현재 노드와 현재 노드의 자손 노드를 모두 선택
following XML 문서에서 현재 노드의 종료 태그 이후에 등장하는 모든 노드를 선택
following-sibling 현재 노드 이후에 위치하는 형제 노드를 모두 선택
parent 현재 노드의 부모 노드를 선택
ancestor 현재 노드의 조상 노드를 모두 선택
ancestor-or-self 현재 노드와 현재 노드의 조상 노드를 모두 선택
preceding XML 문서에서 현재 노드 이전에 등장하는 모든 노드 선택
(조상 노드, 속성 노드, 네임스페이스 노드는 제외함)
preceding-sibling 현재 노드 이전에 위치하는 형제 노드를 모두 선택

경로 표현식(path expression)

검색방향::노드테스트[필터표현식]

 

H.264 + MP4 container, no audio

ffmpeg -i in.avi -vcodec h264 out.mp4
ffmpeg -i in.avi -ss 00:12:34 -t 01:23:45 out.mp4

-ss : the starting timecode, hh:mm:ss.xxx -t : the duration to transcode after the starting timecode, If omitted, will encode to the end.

-vcodec copy -acodec copy -vn : ignore video -an : ignore audio


To encode an image sequence to a video file:

ffmpeg -framerate 25 -i “image_%03d.png” -vcodec h264 -b:v 10485760 out.mp4
ffmpeg -framerate 24 -start_number 12 -i “image_%03d.png” -vcodec h264 -b:v 10485760 out.mp4

-b:v : the video bitrate of the output file


Transcode a video to an image sequence:

ffmpeg -i in.mp4 -vocdec png -an “image_%03d.png”

 


Rotate video

0 = 90CounterClockwise and Vertical Flip (default)

1 = 90Clockwise

2 = 90CounterClockwise

3 = 90Clockwise and Vertical Flip

To rotate 180 degress, instead use “transpose=2,transpose=2”

ffmpeg -i in.mp4 -vf “transpose=1” -codec:a copy out.mp4

 

'C, C++ > FFmepg' 카테고리의 다른 글

Cutting Videos Based on Time Range using FFmpeg  (0) 2022.11.23
FFmpeg CLI Tips  (0) 2021.09.01

ContextMenu.PlacementTarget (DependencyProperty)

 

ContextMenu가 열리는 위치의 기준이 되는 UIElement를 가져오거나 설정함

'.NET > WPF' 카테고리의 다른 글

ObjectDataProvider  (0) 2022.05.28
Calendar  (0) 2021.12.24
WPF CustomControl  (0) 2021.08.15
Adorner  (0) 2021.08.15
WPF Graphics Rendering  (0) 2021.08.15

Choose the right base class

UIElement Layout, Input, Focus and Events
FrameworkElement Style, ToolTip, ContextMenu, and etc.
Control Template, Foreground, Background, FontSize
ContentControl ContentProperty
HeaderedContentControl HeaderProperty
TabControl, Expander, GroupBox
ItemsControl ItemCollection
Selector ComboBox, ListBox, ListView, TabControl
RangeBase Slider, ProgressBar
MinimumProperty, MaximumProperty

Override the Default Style

static MyCustomControl()
{
    DefaultStyleKeyProperty.OverrideMetadata(
        typeof(MyCustomControl),
        new FrameworkPropertyMetadata(typeof(MyCustomControl));
}

Create a default Style

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:sd="clr-namespace:System.Drawing;assembly=System.Drawing"
    xmlns:swm="clr-namespace:System.Windows.Media;assembly=PresentationCore">
 
    <Style TargetType="{x:Type local:MyCustomControl}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:MyCustomControl}">
                    ...
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
 
</ResourceDictionary>
public static readonly DependencyProperty MyContentProperty =
    DependencyProperty.Register(
        nameof(MyContent),
        typeof(object),
        typeof(MyCustomControl),
        new FrameworkPropertyMetadata(
            null,
            FrameworkPropertyMetadataOptions.AffectsRender |
            FrameworkPropertyMetadataOptions.AffectsParentMeasure));
 
public object MyContent
{
    get => GetValue(MyContentProperty);
    set => SetValue(MyContentProperty, value);
}

'.NET > WPF' 카테고리의 다른 글

Calendar  (0) 2021.12.24
WPF ContextMenu Tips  (0) 2021.08.15
Adorner  (0) 2021.08.15
WPF Graphics Rendering  (0) 2021.08.15
Routed Event  (0) 2021.08.15

UIElement 위에 정보, 기능 등을 표시하기 위해 사용하는 사용자 지정 FrameworkElement

Adorner는 UIElement 내에 AdornerLayer를 생성하여 그 위에 객체를 배치하므로 어떤 객체들보다 상위에 나타난다.

(Z-inddex 등을 조절하는 것보다 편한 방법)

 

Adorner 모든 구체적인 표시기 구현이 상속받는 추상 기본 클래스
AdornerLayer 하나 이상의 표시한 요소의 표시기에 대한 렌더링 계층을 나타내는 클래스
AdornerDecorator 표시기 계층이 요소 컬렉션에 연결될 수 있도록 하는 클래스

MSDN

// Adorners must subclass the abstract base class Adorner.
public class SimpleCircleAdorner : Adorner
{
    // Be sure to call the base class constructor.
    public SimpleCircleAdorner(UIElement adornedElement)
        : base(adornedElement) 
    { 
    }
 
    // A common way to implement an adorner's rendering behavior is to override the OnRender
    // method, which is called by the layout system as part of a rendering pass.
    protected override void OnRender(DrawingContext dc)
    {
        Rect adornedElementRect = new Rect(this.AdornedElement.DesiredSize);
 
        // Some arbitrary drawing implements.
        var renderBrush = new SolidColorBrush(Colors.Green);
        renderBrush.Opacity = 0.2;
        Pen renderPen = new Pen(new SolidColorBrush(Colors.Navy), 1.5);
        double renderRadius = 5.0;
 
        // Draw a circle at each corner.
        dc.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopLeft, renderRadius, renderRadius);
        dc.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopRight, renderRadius, renderRadius);
        dc.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomLeft, renderRadius, renderRadius);
        dc.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomRight, renderRadius, renderRadius);
    }
}
myAdornerLayer = AdornerLayer.GetAdornerLayer(myTextBox);
myAdornerLayer.Add(new SimpleCircleAdorner(myTextBox));

SimpleCircleAdorner

 

★마우스 이벤트를 받지 않고 통과시키려면

myAdorner.IsHitTestVisible = false;

'.NET > WPF' 카테고리의 다른 글

WPF ContextMenu Tips  (0) 2021.08.15
WPF CustomControl  (0) 2021.08.15
WPF Graphics Rendering  (0) 2021.08.15
Routed Event  (0) 2021.08.15
ScrollViewer Tips  (0) 2021.08.15

Role of the Visual Object

Provides support for:

  • Output display
    • Rendering the persisted, serialzied drawing content of a visual.
  • Transformations
  • Clipping
  • Hit testing
    • Detemining whether a coordinate or geometry is contained within the bounds of a visual.
  • Bounding box calculations

Not include support for non-rendering features:

  • Event handling
  • Layout
  • Styles
  • Data binding
  • Globalization

시각적 개체 클래스 계층 구조

DrawingVisual Class

A lightweight drawing class that is used to render shapes, images, or text.

It does not provide layout or event handling, which improves its runtime performance.

Ideal for backgrounds and clip art.

 

Viewport3DVisual class

 

ContainerVisual class

Used as a container for a collection of Visual Objects.

Drawing Content in Visual Objects

Drawing Content at the Visual Layer

You never directly instantiate a DrawingContext;

you can, however, acquire a drawing context from certain methods, such as:

  • DrawingOpen.Open
  • DrawingVisual.RenderOpen
// Create a DrawingVisual that contains a rectangle.
private DrawingVisual CreateDrawingVisualRectangle()
{
    var dv = new DrawingVisual();
 
    // Retrieve the DrawingContext in order to create new drawing content.
    DrawingContext dc = dv.RenderOpen();
 
    // Create a rectangle and draw it in the DrawingContext.
    Rect rect = new Rect(new Point(160, 100), new Size(320, 80));
    dc.DrawRectangle(Brushes.LightBlue, (System.Windows.Media.Pen)null, rect);
 
    // Persist the drawing content.
    dc.Close();
 
    return dv;
}

Enumerating Drawing Content at the Visual Layer

public void RetrieveDrawing(Visual v)
{
    DrawingGroup dg = VisualTreeHelper.GetDrawing(v);
    EnumDrawingGroup(dg);
}
 
// Enumerate the drawings in the DrawingGroup.
public void EnumDrawingGroup(DrawingGroup dg)
{
    DrawingCollection dc = dg.Children;
 
    // Enumerate the drawings in the DrawingCollection.
    foreach (Drawing drawing in dc)
    {
        // If the drawing is a DrawingGroup, call the function recursively.
        if (drawing is DrawingGroup group)
        {
            EnumDrawingGroup(group);
        }
        else if (drawing is GeometryDrawing)
        {
            // Perform action based on drawing type.  
        }
        else if (drawing is ImageDrawing)
        {
            // Perform action based on drawing type.
        }
        else if (drawing is GlyphRunDrawing)
        {
            // Perform action based on drawing type.
        }
        else if (drawing is VideoDrawing)
        {
            // Perform action based on drawing type.
        }
    }
}

 

How Visual Objects are Used to Build Controls

 

Visual Tree

 

Visual Rendering Behavior

 

VisualTreeHelper Class

 

Hit Testing

 

Enumerating the Visual Tree

// Enumerate all the descendants of the visual object.
static public void EnumVisual(Visual myVisual)
{
    for (int i = 0; i < VisualTreeHelper.GetChildrenCount(myVisual); ++i)
    {
        // Retrieve child visual at specified index value.
        var childVisual = VisualTreeHelper.GetChild(myVisual, i) as Visual;
 
        // Do processing of the child visual object.
 
        // Enumerate children of the child visual object.
        EnumVisual(childVisual);
    }
}
// Returns the cached bounding box rectangle for the the specified Visual.
Rect rcBounds = VisualTreeHelper.GetContentBounds(myVisual);
 
// Return the bounding rectangle of the parent visual object and all of its descendants.
Rect rcBounds = VisualTreeHelper.GetDescendantBounds(parentVisual);

 

'.NET > WPF' 카테고리의 다른 글

WPF CustomControl  (0) 2021.08.15
Adorner  (0) 2021.08.15
Routed Event  (0) 2021.08.15
ScrollViewer Tips  (0) 2021.08.15
Save Canvas as an Image  (0) 2021.08.15

Bubbling & Tunneling

Bubbling: 일반적으로 사용되는 방식, from Child to Parent until Root!

Tunneling: 접두사로 Preview가 붙는 이벤트, from Root to Child.

 

input event routing

 

더이상 이벤트가 전파되지 않도록 막는 방법

void MyEventHandler(object sender, RoutedEventArgs e)
{
    e.Handled = true;
}

 

Custom Routed Event

MSDN

public class MyButtonSimple: Button
{
    // Create a custom routed event by first registering a RoutedEventID
    // This event uses the bubbling routing strategy
    public static readonly RoutedEvent TapEvent = EventManager.RegisterRoutedEvent(
        "Tap",
        RoutingStrategy.Bubble,
        typeof(RoutedEventHandler),
        typeof(MyButtonSimple));
 
    // Provide CLR accessors for the event
    public event RoutedEventHandler Tap
    {
        add { AddHandler(TapEvent, value); } 
        remove { RemoveHandler(TapEvent, value); }
    }
 
    // This method raises the Tap event
    void RaiseTapEvent()
    {
        var newEventArgs = new RoutedEventArgs(MyButtonSimple.TapEvent);
        RaiseEvent(newEventArgs);
    }
 
    // For demonstration purposes we raise the event when the MyButtonSimple is clicked
    protected override void OnClick()
    {
        RaiseTapEvent();
    }
}

 

'.NET > WPF' 카테고리의 다른 글

Adorner  (0) 2021.08.15
WPF Graphics Rendering  (0) 2021.08.15
ScrollViewer Tips  (0) 2021.08.15
Save Canvas as an Image  (0) 2021.08.15
LayoutTransform vs. RenderTransform  (0) 2021.08.15

RequestBringIntoView

ScrollViewer에는 내부 객체에 Focus가 되었을 때

자동으로 해당 객체를 향해 스크롤되도록 하는 기능이 있다.

이 기능을 막기 위해선 Focus될 객체에서 RequestBringIntoView라는 이벤트를 잡아

e.Handled = true;

로 처리해주면 된다.

'.NET > WPF' 카테고리의 다른 글

WPF Graphics Rendering  (0) 2021.08.15
Routed Event  (0) 2021.08.15
Save Canvas as an Image  (0) 2021.08.15
LayoutTransform vs. RenderTransform  (0) 2021.08.15
ListBox: background of selected item when not focused  (0) 2021.08.09
var rtbmp = new RenderTargetBitmap(
    (int)myCanvas.ActualWidth,
    (int)myCanvas.ActualHeight,
    96d, 96d,
    PixelFormats.Default);

rtbmp.Render(myCanvas);

using (var fs = new FileStream(sFilePath, FileMode.Create, FileAccess.Write, FileShare.None))
{
    var encoder = new JpegBitmapEncoder();
    encoder.Frames.Add(BitmapFrame.Create(rtbmp));
    encoder.Save(fs);
}

'.NET > WPF' 카테고리의 다른 글

WPF Graphics Rendering  (0) 2021.08.15
Routed Event  (0) 2021.08.15
ScrollViewer Tips  (0) 2021.08.15
LayoutTransform vs. RenderTransform  (0) 2021.08.15
ListBox: background of selected item when not focused  (0) 2021.08.09

WPF에서 레이아웃을 렌더링할 때

  • Measure: 각 엘리먼트의 DesiredSize 연산
  • Arrange: 자식 엘리먼트의 위치를 부모 엘리먼트를 기준으로 연산
  • Render: 연산된 UI를 화면에 렌더링

Transform의 이루어지는 시점

  • LayoutTransform
  • Measure
  • Arrange
  • RenderTransform
  • Render

'.NET > WPF' 카테고리의 다른 글

WPF Graphics Rendering  (0) 2021.08.15
Routed Event  (0) 2021.08.15
ScrollViewer Tips  (0) 2021.08.15
Save Canvas as an Image  (0) 2021.08.15
ListBox: background of selected item when not focused  (0) 2021.08.09

※ 행렬 데이터 생성 = 메모리를 새로 생성하지 않고 공유함

// y-행에 대한 행렬 헤더 생성

cv::row(int y)

 

// x-열에 대한 행렬 헤더 생성

cv:col(int x)

 

// y-행에 대한 행렬 헤더 생성
cv::row(int y)

// x-열에 대한 행렬 헤더 생성
cv:col(int x)

// 부분 행렬 헤더 생성
cv::Mat cv::colRange(int startcol, int endcol) const
cv::Mat cv::rowRange(int startrow, int endrow) const
 
 
// 전치 행렬 변환
cv::MatExpr cv::Mat::t() const

 

// 이미지 파일 읽기
cv::Mat image_color = cv::imread("image.jpg");
cv::Mat image_gray  = cv::imread("image.jpg", 0);

// 생성

// 1채널 unsigned char
cv::Mat mat(h, w, CV_8UC1);
// 3채널 unsigned char
cv::Mat mat(h, w, CV_8UC3);

cv::Mat mat = cv::Mat::zeros(h, w, CV_32FC1);
cv::Mat mat = cv::Mat::ones(h, w, CV_64FC3);

unsigned char *pbBuffer; // 이미지 버퍼
cv::Mat mat(h, w, CV_8UC3, pbBuffer); // 메모리 공유

// 원소 초기화
cv::Mat mat(h, w, CV_8UC1);
// 모든 원소값을 3으로 초기화
mat = cv::Scalar(3);

cv::Mat mat2 = mat;	// 메모리 공유
cv::Mat mat3 = mat.clone();	// 별도 메모리
cv::Mat mat4;
mat.copyTo(mat4);	// 별도 메모리

// 형변환 복사
cv::Mat matf(h, w, CV_32FC1);
cv::Mat matb;
matf.convertTo(matb, CV_8U);

// color-gray 변환
cv::cvtColor(color, gray, CV_BGR2GRAY);
cv::cvtColor(gray, color, CV_GRAY2BGR);

// ROI
cv::Rect roi;
cv::Mat mat_roi = mat(roi);
cv::Mat mat_roi = mat(roi).clone();

// Resize
cv::resize(src, dst, cv::Size(w2, h2));
// Scale(sx, sy)
cv::resize(src, dst, cv::Size(), sx, sy);

// Flip
cv::flip(src, dst, 0);	// vertical flip
cv::flip(src, dst, 1);	// horizontal flip
cv::flip(src, dst, -1);	// vertical & horizontal flip

// Drawing
cv::Rect rc(x, y, w, h);
cv::Scalar color(B, G, R);
int thickness = 1;

cv::line(img, cv::Point(x1, y1), cv::Point(x2, y2), color, thickness);

cv::Rectangle(img, rc, color, thickness);
cv::Rectangle(img, rc.tl(), rc.br(), color, thickness);
cv::Rectangle(img, rc, color, CV_FILLED);

cv::Point center(rc.x + rc.width / 2, rc.y + rc.height / 2);
cv::Size radius(rc.width / 2, rc.height / 2);

double rot_deg = 0;		// rotation of ellipse
double s_deg = 0;		// start angle of arc
double e_deg = 360;		// end angle of arc
cv::ellipse(img, center, radius, rot_deg, s_deg, e_deg, color, thickness);
cv::ellipse(img, center, radius, rot_deg, s_deg, e_deg, color, CV_FILLED);

int circle_radius = 10;
cv::circle(img, center, circle_radius, color, thickness);
cv::circle(img, center, circle_radius, color, CV_FILLED);

cv::putText(img, "text", cv::Point(x, y), FONT_HERSHEY_SIMPLEX, 1, color, thickness);
cv::putText(img, "text", cv::Point(x, y), FONT_HERSHEY_DUPLEX, 1, color, thickness);

// display
cv::namedWindow("name");	// auto resized
cv::namedWindow("name", CV_WINDOW_NORMAL);	// manual resize

cv::imshow("name", img);
char ch = cv::waitKey();	// 무한대기
char ch = cv::waitKey(10);	// 10 ms 대기

cv::destroyWindow("name");
cv::destroyAllWindows();

 

cv::VideoCapture vc(0);           // webcam
cv::VideoCapture vc("video.mp4"); // video file

if (!vc.isOpened())
    return; // failed

vc.set(CV_CAP_PROP_FRAME_WIDTH, 640);
vc.set(CV_CAP_PROP_FRAME_HEIGHT, 480);

cv::Mat img;
for (;;)
{
    vc >> img;
    if (img.empty())
        break;

    cv::imshow("image", img);
    if (cv::waitKey(10) == 27) // ESC
        break;
}

cv::destroyAllWindows();

 

double fps = 30;
int fourcc = CV_FOURCC('X', 'V', 'I', 'D'); // XVID codec
bool isColor = true;

cv::VideoWriter* video = new cv::VideoWriter;
if (!video->open("video.avi", fourcc, fps, cv::Size(w, h), isColor))
{
    delete video;
    return;
}

cv::Mat img;
for (;;)
{
    ;
    *video << img;
    ;
}

delete video;

 

// cv::Mat -> cv::IplImage
cv::Mat img;
cv::IplImage* pIplImg = &IplImage(img);

// cv::IplImage -> cv::Mat
IplImage* pIplImg;
cv::Mat img(pIplImg);

// 3 channels image
for (int r = 0; r < img.rows; ++r)
{
    for (int c = 0; c < img.cols; ++c)
    {
        img.at<Vec3b>(r, c)[0] += 10;
        img.at<Vec3b>(r, c)[1] += 20;
        img.at<Vec3b>(r, c)[2] += 30;
    }
}

// cv::Mat_<T>
cv::Mat_<unsigned char> img2 = img;
img2(r, c) = v;
UPDATE [테이블명] SET 컬럼명 = REPLACE(적용할컬럼명, '원래문자열', '변경할문자열');

'DB' 카테고리의 다른 글

DBeaver: 한국어 깨짐 현상 해결하기  (0) 2021.08.15

설정파일: C:\Program Files\DBeaver\dbeaver.ini

옵션추가: -Dfile.encoding=UTF-8

-startup
plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1100.v20190907-0426
-vmargs
-XX:+IgnoreUnrecognizedVMOptions
--add-modules=ALL-SYSTEM
-Xms64m
-Xmx1024m
-Dfile.encoding=UTF-8

'DB' 카테고리의 다른 글

MySQL에서 특정 문자만 변경하기  (0) 2021.08.15

RTSP(Real Time Streaming Protocol)은 스트리밍 미디어 서버를 컨트롤 하기위한 통신시스템등을 위해 고안된 네트워크 프로토콜입니다. (참고 문서 : RFC2326) 이 프로토콜은 비디오 혹은 오디오 기능을 가진 클라이언트와 실시간으로 미디어 스트리밍하는 시스템에 사용되며, 미디어 서버를 원격으로 제어할 때 씁니다. 명령어는 “PLAY”, “PAUSE” 같이 VCR 동작과 비슷하며 시간 정보를 바탕으로 서버에 접근하게 됩니다.

실제 미디어 스트리밍 데이터를 전송하지 않습니다. 대부분의 RTSP 서버는 RTP 규약을 사용해서 전송 계층으로 실제 오디오/비디오 데이터를 전송합니다.

RTSP 명령어


RTSP 규약은 HTTP 규약하고 비교해볼때, 문법이나 동작이 비슷합니다. 하지만 HTTP가 stateless인 반면에 RTSP는 stateful 규약입니다. 임의의 세션 ID는 세션을 추적할 때마다 사용되는데, 이 방법은 영구 TCP 연결을 필요로 합니다. RTSP 메시지는 클라이언트에서 서버로 갑니다. 만약, 서버에서 오류가 발생한다면 서버는 오류에 대한 응답 코드를 클라이언트로 보내줍니다. 기본적인 RTSP 요청 메시지는 아래와 같으며, 기본 포트는 554번입니다.

편집

OPTIONS

OPTIONS 요청은 서버의 accept 타입을 반환합니다.

C -> S: OPTIONS rtsp://example.com/media.mp3 RTSP/1.0
        CSeq: 1 Require: implicit-play
        Proxy-Require: gzipped-messages
S -> C: RTSP/1.0 200 OK
        CSeq: 1
        Public: DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE

 

 

DESCRIBE

DESCRIBE 요청에는 URL(rtsp://...)이 포함됩니다. 기본 포트 554번은 UDP, TCP 둘 다에 사용됩니다. DESCRIBE에 대한 응답 메시지에는 요청한 것에 대한 설명도 포함되는데, 대개 SDP(Session Description Protocol) 형태를 갖추고 있습니다.

C -> S: OPTIONS rstp://example.com/media.mp4 RTSP/1.0
        CSeq: 2
S -> C: RTSP/1.0 200 OK
        CSeq: 2
        Content-Base: rtsp://example.com/media.mp4
        Content-Type: application/sdp
        Content=-Length: 460
        m=video 0 RTP/AVP 96
        a=control:streamid=0
        a=range:npt=0-7.741000
        a=length:npt=7.741000
        a=rtpmap:96 MP4V-ES/5544
        a=mimetype:string; "video/MP4V-ES"
        a=AvgBitRate:integer;304018
        a=StreamName:string;"hinted video track"
        m=audio 0 RTP/AVP 97
        a=control:streamid=1
        a=range:npt=0-7.712000
        a=length:npt=7.712000
        a=rtpmap:97 mpeg4-generic/32000/2
        a=mimetype:string; "audio/mpeg4-generic"
        a=AvgBitRate:integer;65790
        a=StreamName:string;"hinted audio track"

 

 

SETUP

SETUP 요청은 단일 미디어 스트림이 전송되어야 하는지 규정합니다. 이 요청은 PLAY 요청 하기 전에 마쳐야 합니다. 그리고 요청할 때 미디어 스트림 URL과 전송점을 포함해야 합니다. 전송점에는 RTP 데이터(오디오/비디오), RTCP 데이터(메타 정보)를 전송받기 위한 포트 번호도 포함됩니다.

C -> S: SETUP rtsp://example.com/media.mp4/streamid=0 RTSP/1.0
        CSeq: 3
        Transport: RTP/AVP;unicast;client_port=8000-8001
S -> C: RTSP/1.0 200 OK
        CSeq: 3
        Transport: RTP/AVP;unicast;client_port=8000-8001;server_port=9000-9001;ssrc=1234ABCD
        Session: 12345678

 

 

PLAY

PLAY 요청은 하나 또는 모든 미디어 스트림을 재생시킵니다. PLAY 명령은 다중 요청이 가능합니다. 모든 미디어 스트림 재생을 위해서는 URL 집합체가 요청에 포함되어야 합니다. 재생 범위를 구체적으로 지정할 수도 있습니다. 만약 재생 범위를 지정하지 않으면, 미디어 처음부터 끝까지 재생하게됩니다. 또, 일시 정지 상태라면 일시 정지된 위치부터 재생됩니다.

C -> S: OPTIONS rstp://example.com/media.mp4 RTSP/1.0
        CSeq: 4
        Range: npt=5-20 Session: 12345678
S -> C: RTSP/1.0 200 OK
        CSeq: 4
        Session: 12345678 RTP-Info: url=rtsp://example.com/media.mp4/streamid=0;seq=9810092;trptime=3450012

 

PAUSE

PLAY 요청은 하나 또는 모든 스트림을 재생시킵니다. PLAY 명령은 다중 요청이 가능합니다. 모든 미디어 스트림 재생을 위해서는 URL 집합체가 요청에 포함되어야 합니다. 일시 정지할때 범위를 구체적으로 지정할 수도 있습니다.

C -> S: PAUSE rstp://example.com/media.mp4 RTSP/1.0
        CSeq: 5
        Session: 12345678
S -> C: RTSP/1.0 200 OK
        CSeq: 5
        Session: 12345678

 

RECORD

RECORD 요청은 녹화를 위한 명령어입니다.

C -> S: RECORD rstp://example.com/media.mp4 RTSP/1.0
        CSeq: 6
        Session: 12345678
S -> C: RTSP/1.0 200 OK
        CSeq: 6
        Session: 12345678

 

TEARDOWN

TEARDOWN 요청은 세션을 종료하기 위한 명령어이고, 모든 미디어 스트림의 재생을 중단하고 서버에 있는 관련 데이터에 걸린 모든 세션도 해제합니다.

C -> S: OPTIONS rstp://example.com/media.mp4 RTSP/1.0
        CSeq: 8
        Range: npt=5-20
        Session: 12345678
S -> C: RTSP/1.0 200 OK
        CSeq: 8
        Session: 12345678

 

RTSP 서버/클라이언트 종류

Server

Darwin Streaming Server, Feng, GStreamer, Hlix DNA Server, Helix Universal Server, LEADTOOLS Media Streaming Server SDK, LIVE555 liveMedia / openRTSP, Managed FMedia Aggregation, Nimble Streamer, pvServer, QuickTime Streaming Server, SharpRTSP, TV Server, ViaMotion, VideoLAN, VX30, Windows Media Services, Wowza Streaming Engine, Xenon Streamfing Server, YouTube

 

Client

Astra, cURL, FFmpeg, GStreamer, JetAudio, LIVE555 liveMedia / oepnRTSP, Media Play Classic, MPlayer, MythTV, Managed Media Aggregation, omxplayer, QuickTime, RealPlayer, SharpRTSP, Skype, Spotify, VLC media player, Winamp, Windows Media Player, xine

 

출처: https://12bme.tistory.com/345

'Media' 카테고리의 다른 글

Resolution  (0) 2021.09.24

Equals()

public static bool ReferenceEquals(object left, object right);
public static bool Equals(object left, object right);
// 재정의하는 경우 IEquatable<T>를 구현해야 한다.
// (값에 고유의 의미 체계를 부여하기 위해 IStructuralEquality를 구현하기도 함)
public virtual bool Equals(object right);
// 주로 성능을 개선하기 위해 재정의
public static bool operator == (MyClass left, MyClass right);
  • 참조 타입의 경우, 참조 대상이 같으면 동일하다고 간주
  • 값 타입의 경우, 두 객체의 타입과 값의 내용이 일치해야만 동일한 객체로 판단
public static bool Equals(object left, object right)
{
    if (object.ReferenceEquals(left, right))
        return true;
 
    if (object.ReferenceEquals(left, null) ||
        object.ReferenceEquals(right, null))
        return false;
 
    return left.Equals(right);
}

동일성의 수학적 속성

  • 반사적 속성(reflexive property)
    • 어떤 객체든 자기 자신과는 항상 같아야 한다.
  • 대칭적 속성(symmetric property)
    • 동일성의 결과가 비교 순서와는 무관해야 한다.
  • 추이적 속성(transitive property)
    • if (a == b) and (b == c), a == c

 

IEquatable<T>

public class MyClass : IEquatable<MyClass>
{
    public override bool Equals(object other)
    {
        // C# 메서드 내에서 this는 절대 null이 될 수 없다.
        if (object.ReferenceEquals(right, null))
            return false;

        if (object.ReferenceEquals(this, other))
            return true;

        if (this.GetType() != other.GetType())
            return false;

        return this.Equals(other as MyCalss)
    }

    // IEquatable<MyClass>
    public bool Equals(MyClass other)
    {
        ;
    }
}

'.NET > C#' 카테고리의 다른 글

Concurrency (동시성)  (0) 2023.08.16
Marshaling: 복사 및 고정  (0) 2021.10.15
Array Marshaling  (0) 2021.10.15
Comparisons and Sorts  (0) 2021.10.15
Debugging Tips  (0) 2021.09.15
#include <cstdlib>
#include <iostream>
#include <chrono>
#include <ctime>
#include <queue>
using namespace std;
 
int main()
{
    // your code goes here
 
    std::chrono::steady_clock::time_point t0, t1, tp;
    int isNotFirst = 0;
    double elapsed_s = 0, g_samples_s = 0;
    std::queue<double> g_fps;
    size_t nb_samples;
 
    for (int i = 0; i < 10; ++i)
    {
        t0 = std::chrono::steady_clock::now();
 
        int r = (std::rand() % 10) + 25; // 25 ~ 34
        std::this_thread::sleep_for(std::chrono::milliseconds(r));
 
        t1 = std::chrono::steady_clock::now();
        elapsed_s = (double)r / 1000;//std::chrono::duration_cast<std::chrono::duration<double>(t1 - t0).count();
 
        double fps = 0, avg_fps = 0;
 
        if (isNotFirst)
        {
            nb_samples = g_fps.size();
            elapsed_s = r;//std::chrono::duration_cast<std::chrono::duration<double>>(t0 - tp).count();
 
            g_samples_s += elapsed_s;
            g_fps.push(elapsed_s);
 
            if (nb_samples >= 10)
            {
                g_samples_s -= g_fps.front();
                   g_fps.pop();
            }
            else nb_samples++;
 
            fps = 1 / elapsed_s;
            avg_fps = nb_samples / g_samples_s;
        }
 
        tp = t0;
        isNotFirst = 1;
 
        printf("%d. %.2f/%.2f fps\r\n", i, fps, avg_fps);
    }
 
    return 0;
}

'C, C++' 카테고리의 다른 글

xlnt - XLSX 파일 다루기  (0) 2022.12.22
To install the MinGW-w64 toolchain  (0) 2022.10.28
문자열 구분자로 분리  (0) 2021.10.20
VSCode + vcpkg  (0) 2021.10.19
Get DLL path at run time  (0) 2021.10.05
<Style TargetType="{x:Type DataGrid}">
    <Setter Property="RowStyle">
        <Setter.Value>
            <Style TargetType="{x:Type DataGridRow}">
                <Setter Property="BorderBrush"
                        Value="{StaticResource ContentBgColorKey}"/>
                <Setter Property="BorderThickness" Value="0"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type DataGridRow}">
                            <Border x:Name="DGR_Border"
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    SnapsToDevicePixels="True">
                                <Grid>
                                    <SelectiveScrollingGrid>
                                        <SelectiveScrollingGrid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto"/>
                                            <ColumnDefinition/>
                                        </SelectiveScrollingGrid.ColumnDefinitions>
                                                
                                        <DataGridCellsPresenter Grid.Column="1"
                                                                ItemsPanel="{TemplateBinding ItemsPanel}"
                                                                SnapsToDevicePixels="True"/>

                                        <DataGridRowHeader
                                            SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical"
                                            Visibility="{Binding HeadersVisibility,
                                                                 Converter={x:Static DataGrid.HeadersVisibilityConverter},
                                                                 ConverterParameter={x:Static DataGridHeadersVisibility.Row},
                                                                 RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                                    </SelectiveScrollingGrid>

                                    <Rectangle x:Name="PART_Box"
                                               Margin="0,0,1,0"
                                               Stroke="Orange"
                                               StrokeThickness="1"
                                               Fill="{x:Null}"
                                               Visibility="Hidden"/>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="PART_Box"
                                        Property="Visibility" Value="Visible"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Setter.Value>
    </Setter>
</Style>

 

<Style TargetType="{x:Type DataGrid}">
    <Style.Resources>
        <Style x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}"
               TargetType="{x:Type Button}">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="BorderThickness" Value="0"/>
        </Style>
    </Style.Resources>
</Style>

+ Recent posts