Able to now view individual frames of video.

master
sigonasr2 1 year ago
parent 3766c28cf8
commit f659e3267b
  1. 13
      OpenCVVideoParser/OpenCVVideoParser.vcxproj
  2. 5
      OpenCVVideoParser/OpenCVVideoParser.vcxproj.filters
  3. 59
      OpenCVVideoParser/main.cpp
  4. 6695
      OpenCVVideoParser/olcPixelGameEngine.h
  5. BIN
      OpenCVVideoParser/opencv_calib3d480.dll
  6. BIN
      OpenCVVideoParser/opencv_core480.dll
  7. BIN
      OpenCVVideoParser/opencv_dnn480.dll
  8. BIN
      OpenCVVideoParser/opencv_features2d480.dll
  9. BIN
      OpenCVVideoParser/opencv_flann480.dll
  10. BIN
      OpenCVVideoParser/opencv_gapi480.dll
  11. BIN
      OpenCVVideoParser/opencv_highgui480.dll
  12. BIN
      OpenCVVideoParser/opencv_imgcodecs480.dll
  13. BIN
      OpenCVVideoParser/opencv_imgproc480.dll
  14. BIN
      OpenCVVideoParser/opencv_ml480.dll
  15. BIN
      OpenCVVideoParser/opencv_objdetect480.dll
  16. BIN
      OpenCVVideoParser/opencv_photo480.dll
  17. BIN
      OpenCVVideoParser/opencv_stitching480.dll
  18. BIN
      OpenCVVideoParser/opencv_video480.dll
  19. BIN
      OpenCVVideoParser/opencv_videoio480.dll

@ -94,7 +94,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>C:\Users\sigon\Downloads\opencv\build\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>C:\Users\sigon\Downloads\opencv\build\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
@ -103,7 +103,8 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\Users\sigon\Downloads\opencv-4.8.0\opencv-4.8.0\build\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>C:\Users\sigon\Downloads\opencv-4.8.0\opencv-4.8.0\build\bin\Release;C:\Users\sigon\Downloads\opencv-4.8.0\opencv-4.8.0\build\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>opencv_imgcodecs480.lib;opencv_videoio480.lib;opencv_video480.lib;opencv_imgproc480.lib;opencv_core480.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -130,7 +131,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>C:\Users\sigon\Downloads\opencv\build\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>C:\Users\sigon\Downloads\opencv\build\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
@ -139,12 +140,16 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\Users\sigon\Downloads\opencv-4.8.0\opencv-4.8.0\build\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>C:\Users\sigon\Downloads\opencv-4.8.0\opencv-4.8.0\build\bin\Release;C:\Users\sigon\Downloads\opencv-4.8.0\opencv-4.8.0\build\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>opencv_imgcodecs480.lib;opencv_videoio480.lib;opencv_video480.lib;opencv_imgproc480.lib;opencv_core480.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="main.cpp" /> <ClCompile Include="main.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="olcPixelGameEngine.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

@ -19,4 +19,9 @@
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="olcPixelGameEngine.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project> </Project>

@ -6,6 +6,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <stdio.h>
/* /*
This functions opens a video file and extracts the frames and put them into a vector of Mat(its the class for representing an img) This functions opens a video file and extracts the frames and put them into a vector of Mat(its the class for representing an img)
@ -50,8 +51,60 @@ void save_frames(std::vector<cv::Mat>& frames, const std::string& outputDir){
} }
int main(){ #define OLC_PGE_APPLICATION
std::vector<cv::Mat>frameData; #include "olcPixelGameEngine.h"
extract_frames("C:/Users/sigon/Videos/test.mp4",frameData);
using namespace olc;
// Override base class with your custom functionality
class Example : public olc::PixelGameEngine
{
public:
Example()
{
// Name your application
sAppName = "Example";
}
public:
std::vector<cv::Mat>frames;
float frameView=0;
bool OnUserCreate() override
{
// Called once at the start, so create things here
extract_frames("C:/users/sigon/Videos/test.mp4",frames);
return true;
}
void UpdateScreen(){
Clear(BLACK);
cv::Mat&targetFrame=frames[int(frameView)];
for(int y=0;y<targetFrame.rows;y++){
for(int x=0;x<targetFrame.cols;x++){
cv::Vec3b col=targetFrame.at<cv::Vec3b>(cv::Point{x,y});
Draw(x,y,{col[2],col[1],col[0]});
}
}
}
bool OnUserUpdate(float fElapsedTime) override
{
// Called once per frame, draws random coloured pixels
if(GetKey(RIGHT).bHeld){
frameView+=fElapsedTime*60;
UpdateScreen();
}
if(GetKey(LEFT).bHeld){
frameView-=fElapsedTime*60;
UpdateScreen();
}
return true;
}
};
int main()
{
Example demo;
if (demo.Construct(1920, 1080, 1, 1))
demo.Start();
return 0;
} }

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save