-
Notifications
You must be signed in to change notification settings - Fork 0
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
Eggplantsjz
authored and
Eggplantsjz
committed
Nov 24, 2023
1 parent
117875e
commit d421d7f
Showing
12 changed files
with
533 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.33927.289 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XVideoEdit", "XVideoEdit.vcxproj", "{C498B696-B9C3-4C6B-AB8B-FDFF8624BAB1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Release|x64 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C498B696-B9C3-4C6B-AB8B-FDFF8624BAB1}.Debug|x64.ActiveCfg = Debug|x64 | ||
{C498B696-B9C3-4C6B-AB8B-FDFF8624BAB1}.Debug|x64.Build.0 = Debug|x64 | ||
{C498B696-B9C3-4C6B-AB8B-FDFF8624BAB1}.Release|x64.ActiveCfg = Release|x64 | ||
{C498B696-B9C3-4C6B-AB8B-FDFF8624BAB1}.Release|x64.Build.0 = Release|x64 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {BA50965F-AD5D-48FF-9B79-D92500B8E80E} | ||
EndGlobalSection | ||
EndGlobal |
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,121 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
*************************************************************************************************** | ||
Copyright (C) 2023 The Qt Company Ltd. | ||
SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | ||
*************************************************************************************************** | ||
--> | ||
<Project DefaultTargets="Build" ToolsVersion="16.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>{C498B696-B9C3-4C6B-AB8B-FDFF8624BAB1}</ProjectGuid> | ||
<Keyword>QtVS_v304</Keyword> | ||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild> | ||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>v142</PlatformToolset> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>v142</PlatformToolset> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')"> | ||
<Import Project="$(QtMsBuild)\qt_defaults.props" /> | ||
</ImportGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings"> | ||
<QtInstall>W:\qt\5.9\msvc2017_64</QtInstall> | ||
<QtModules>core;gui;opengl;widgets</QtModules> | ||
<QtBuildConfig>debug</QtBuildConfig> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings"> | ||
<QtInstall>W:\qt\5.9\msvc2017_64</QtInstall> | ||
<QtModules>core;gui;widgets</QtModules> | ||
<QtBuildConfig>release</QtBuildConfig> | ||
</PropertyGroup> | ||
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') or !Exists('$(QtMsBuild)\qt.props')"> | ||
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." /> | ||
</Target> | ||
<ImportGroup Label="ExtensionSettings" /> | ||
<ImportGroup Label="Shared" /> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="$(QtMsBuild)\Qt.props" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="$(QtMsBuild)\Qt.props" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> | ||
<OutDir>..\..\bin</OutDir> | ||
<LibraryPath>W:\opencv480\opencv\build\x64\vc16\lib;$(LibraryPath)</LibraryPath> | ||
<IncludePath>W:\opencv480\opencv\build\include;$(IncludePath)</IncludePath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<AdditionalIncludeDirectories>W:\opencv480\opencv\build\include;W:\qt\5.9\msvc2017_64\include</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
<Link> | ||
<AdditionalLibraryDirectories>W:\opencv480\opencv\build\x64\vc16\lib</AdditionalLibraryDirectories> | ||
<AdditionalDependencies>W:\opencv480\opencv\build\x64\vc16\lib\opencv_world480d.lib;W:\code\opencv\lib\opencv_world412d.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration"> | ||
<ClCompile> | ||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> | ||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
<Optimization>Disabled</Optimization> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="Configuration"> | ||
<ClCompile> | ||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType> | ||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | ||
<DebugInformationFormat>None</DebugInformationFormat> | ||
<Optimization>MaxSpeed</Optimization> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Windows</SubSystem> | ||
<GenerateDebugInformation>false</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="XVideoThread.cpp" /> | ||
<ClCompile Include="XVideoWidget.cpp" /> | ||
<QtRcc Include="XVideoUI.qrc" /> | ||
<QtUic Include="XVideoUI.ui" /> | ||
<QtMoc Include="XVideoUI.h" /> | ||
<ClCompile Include="XVideoUI.cpp" /> | ||
<ClCompile Include="main.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<QtMoc Include="XVideoThread.h" /> | ||
<QtMoc Include="XVideoWidget.h" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')"> | ||
<Import Project="$(QtMsBuild)\qt.targets" /> | ||
</ImportGroup> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="Resource Files"> | ||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
<Extensions>qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||
</Filter> | ||
<Filter Include="Form Files"> | ||
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier> | ||
<Extensions>ui</Extensions> | ||
</Filter> | ||
<Filter Include="Translation Files"> | ||
<UniqueIdentifier>{639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}</UniqueIdentifier> | ||
<Extensions>ts</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<QtRcc Include="XVideoUI.qrc"> | ||
<Filter>Resource Files</Filter> | ||
</QtRcc> | ||
<QtUic Include="XVideoUI.ui"> | ||
<Filter>Form Files</Filter> | ||
</QtUic> | ||
<QtMoc Include="XVideoUI.h"> | ||
<Filter>Header Files</Filter> | ||
</QtMoc> | ||
<ClCompile Include="XVideoUI.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="main.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="XVideoWidget.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="XVideoThread.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<QtMoc Include="XVideoThread.h"> | ||
<Filter>Header Files</Filter> | ||
</QtMoc> | ||
<QtMoc Include="XVideoWidget.h"> | ||
<Filter>Header Files</Filter> | ||
</QtMoc> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "XVideoThread.h" | ||
#include <opencv2/imgcodecs.hpp> | ||
#include<opencv2/highgui.hpp> | ||
#include<opencv2/imgproc.hpp> | ||
#include<opencv2/core.hpp> | ||
#include<opencv2/opencv.hpp> | ||
#include <iostream> | ||
using namespace std; | ||
using namespace cv; | ||
//ŇťşĹĘÓĆľ | ||
static VideoCapture cap1; | ||
static bool isexit = false; | ||
bool XVideoThread::Open(const string file) | ||
{ | ||
cout << "open:" << file << endl; | ||
mutex.lock(); | ||
int re = cap1.open(file); | ||
mutex.unlock(); | ||
cout << re << endl; | ||
return re; | ||
} | ||
|
||
XVideoThread::XVideoThread() | ||
{ | ||
start(); | ||
} | ||
|
||
XVideoThread::~XVideoThread() | ||
{ | ||
mutex.lock(); | ||
isexit = true; | ||
mutex.unlock(); | ||
} | ||
|
||
void XVideoThread::run() | ||
{ | ||
Mat mat1; | ||
for (;;) | ||
{ | ||
mutex.lock(); | ||
if (isexit) | ||
{ | ||
mutex.unlock(); | ||
break; | ||
} | ||
if (!cap1.isOpened()) { | ||
mutex.unlock(); | ||
msleep(5); | ||
continue; | ||
} | ||
if (!cap1.read(mat1)||mat1.empty()) { | ||
mutex.unlock(); | ||
msleep(5); | ||
continue; | ||
} | ||
ViewImage1(mat1); | ||
msleep(40); | ||
mutex.unlock(); | ||
|
||
|
||
} | ||
} |
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,27 @@ | ||
#pragma once | ||
#include <QtCore/QThread> | ||
#include <QtCore/QMutex> | ||
#include <opencv2/core.hpp> | ||
#include <string> | ||
using namespace std; | ||
class XVideoThread:public QThread | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
static XVideoThread* Get() | ||
{ | ||
static XVideoThread vt; | ||
return &vt; | ||
}; | ||
bool Open(const string file); | ||
~XVideoThread(); | ||
|
||
void run(); | ||
signals: | ||
void ViewImage1(cv::Mat mat); | ||
protected: | ||
XVideoThread(); | ||
QMutex mutex; | ||
}; | ||
|
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,36 @@ | ||
#include "XVideoUI.h" | ||
#include <QtWidgets/qfiledialog.h> | ||
#include<string> | ||
#include <QtWidgets/qmessagebox.h> | ||
#include "XVideoThread.h" | ||
#include "XVideoWidget.h" | ||
XVideoUI::XVideoUI(QWidget *parent) | ||
: QWidget(parent) | ||
{ | ||
ui.setupUi(this); | ||
setWindowFlags(Qt::FramelessWindowHint); | ||
qRegisterMetaType<cv::Mat>("cv::Mat"); | ||
QObject::connect(XVideoThread::Get(), | ||
SIGNAL(ViewImage1(cv::Mat)), | ||
ui.src1video, | ||
SLOT(SetImage(cv::Mat)) | ||
); | ||
} | ||
|
||
XVideoUI::~XVideoUI() | ||
{} | ||
|
||
void XVideoUI::Open() | ||
{ | ||
QString name = QFileDialog::getOpenFileName(this,QString::fromLocal8Bit("ÇëÑ¡ÔñÊÓƵÎļþ")); | ||
if (name.isEmpty()) | ||
{ | ||
return; | ||
} | ||
std::string file = name.toLocal8Bit().data(); | ||
/*QMessageBox::information(this, "", name);*/ | ||
if (!XVideoThread::Get()->Open(file)) { | ||
QMessageBox::information(this, "", name+"open failed!"); | ||
return; | ||
} | ||
} |
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,18 @@ | ||
#pragma once | ||
|
||
#include <QtWidgets/QWidget> | ||
#include "ui_XVideoUI.h" | ||
|
||
class XVideoUI : public QWidget | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
XVideoUI(QWidget *parent = nullptr); | ||
~XVideoUI(); | ||
public slots: | ||
void Open(); | ||
|
||
private: | ||
Ui::XVideoUIClass ui; | ||
}; |
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,4 @@ | ||
<RCC> | ||
<qresource prefix="XVideoUI"> | ||
</qresource> | ||
</RCC> |
Oops, something went wrong.