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

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

@ -6,6 +6,7 @@
#include <string>
#include <vector>
#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)
@ -50,8 +51,60 @@ void save_frames(std::vector<cv::Mat>& frames, const std::string& outputDir){
}
int main(){
std::vector<cv::Mat>frameData;
extract_frames("C:/Users/sigon/Videos/test.mp4",frameData);
#define OLC_PGE_APPLICATION
#include "olcPixelGameEngine.h"
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