Skip to content

Commit

Permalink
Removed 3rd form (videosettings). videopanel gui populated. opencv fp…
Browse files Browse the repository at this point in the history
…s_issue not yet solved.
  • Loading branch information
clementlee2000 committed Nov 29, 2016
1 parent 81fd60d commit a4f2d63
Show file tree
Hide file tree
Showing 14 changed files with 267 additions and 988 deletions.
30 changes: 0 additions & 30 deletions VideoCapture.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@
<ClCompile Include="mf_enumerate_cameras.cpp" />
<ClCompile Include="release\moc_mainwindow.cpp" />
<ClCompile Include="release\moc_videopanel.cpp" />
<ClCompile Include="release\moc_videosettings.cpp" />
<ClCompile Include="videopanel.cpp" />
<ClCompile Include="videosettings.cpp" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="mainwindow.ui">
Expand All @@ -192,21 +190,6 @@
<ItemGroup>
<ClInclude Include="ui_mainwindow.h" />
<ClInclude Include="ui_videopanel.h" />
<ClInclude Include="ui_videosettings.h" />
<CustomBuild Include="videosettings.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QT5SDK)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"$(QT5SDK)\include\QtCore" -I"$(QT5SDK)\include\QtGui" -I"$(QT5SDK)\include\QyWidgets" -I"$(QT5SDK)\include\QtMultimedia" -I"$(QT5SDK)\include" -I"..\..\LSL\liblsl\include" -I"..\..\LSL\liblsl\external" -I"$(BOOST_ROOT)" -I"$(QT5SDK)\include\ActiveQt" -I"release" -I"." -I$(QT5SDK)\mkspecs\default -D_MSC_VER=1500 -DWIN32 videosettings.h -o release\moc_videosettings.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MOC videosettings.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">release\moc_videosettings.cpp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QT5SDK)\bin\moc.exe;videosettings.h</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QT5SDK)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"$(QT5SDK)\include\QtCore" -I"$(QT5SDK)\include\QtGui" -I"$(QT5SDK)\include\QyWidgets" -I"$(QT5SDK)\include\QtMultimedia" -I"$(QT5SDK)\include" -I"..\..\LSL\liblsl\include" -I"..\..\LSL\liblsl\external" -I"$(BOOST_ROOT)" -I"$(QT5SDK)\include\ActiveQt" -I"release" -I"." -I$(QT5SDK)\mkspecs\default -D_MSC_VER=1500 -DWIN32 videosettings.h -o release\moc_videosettings.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MOC videosettings.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">release\moc_videosettings.cpp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QT5SDK)\bin\moc.exe;videosettings.h</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QT5SDK)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"$(QT5SDK)\include\QtCore" -I"$(QT5SDK)\include\QtGui" -I"$(QT5SDK)\include\QyWidgets" -I"$(QT5SDK)\include\QtMultimedia" -I"$(QT5SDK)\include" -I"..\..\LSL\liblsl\include" -I"..\..\LSL\liblsl\external" -I"$(BOOST_ROOT)" -I"$(QT5SDK)\include\ActiveQt" -I"release" -I"." -I$(QT5SDK)\mkspecs\default -D_MSC_VER=1500 -DWIN32 videosettings.h -o release\moc_videosettings.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MOC videosettings.h</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">debug\moc_videosettings.cpp</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(QT5SDK)\bin\moc.exe;videosettings.h</AdditionalInputs>
</CustomBuild>
<CustomBuild Include="videopanel.h">
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QT5SDK)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"$(QT5SDK)\include\QtCore" -I"$(QT5SDK)\include\QtGui" -I"$(QT5SDK)\include\QyWidgets" -I"$(QT5SDK)\include\QtMultimedia" -I"$(QT5SDK)\include" -I"..\..\LSL\liblsl\include" -I"..\..\LSL\liblsl\external" -I"$(BOOST_ROOT)" -I"$(QT5SDK)\include\ActiveQt" -I"release" -I"." -I$(QT5SDK)\mkspecs\default -D_MSC_VER=1500 -DWIN32 videopanel.h -o release\moc_videopanel.cpp</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MOC videopanel.h</Message>
Expand Down Expand Up @@ -258,19 +241,6 @@
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QT5SDK)\bin\uic.exe;videopanel.ui</AdditionalInputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="videosettings.ui">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QT5SDK)\bin\uic.exe videosettings.ui -o ui_videosettings.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">UIC videosettings.ui</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">ui_videosettings.h</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QT5SDK)\bin\uic.exe;videosettings.ui</AdditionalInputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QT5SDK)\bin\uic.exe videosettings.ui -o ui_videosettings.h</Command>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">UIC videosettings.ui</Message>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ui_videosettings.h</Outputs>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(QT5SDK)\bin\uic.exe;videosettings.ui</AdditionalInputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
15 changes: 0 additions & 15 deletions VideoCapture.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,12 @@
<ClCompile Include="videopanel.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="videosettings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="release\moc_mainwindow.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="release\moc_videopanel.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="release\moc_videosettings.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="mainwindow.ui">
Expand All @@ -55,12 +49,6 @@
<CustomBuild Include="videopanel.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="videosettings.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="videosettings.h">
<Filter>Header Files</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="mf_enumerate_cameras.h">
Expand All @@ -72,8 +60,5 @@
<ClInclude Include="ui_videopanel.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="ui_videosettings.h">
<Filter>Generated Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "mf_enumerate_cameras.h"
#include <Objbase.h>
#include <iostream>

Expand All @@ -16,7 +17,7 @@ MainWindow::MainWindow(QWidget *parent) :

std::vector<std::string> camera_names;
WmfEnumerateCameras wmf_obj;

// will print the names of all available cameras to the console and store them in the vector:
wmf_obj.getCameraNames(camera_names);

Expand Down
1 change: 0 additions & 1 deletion mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#endif

#include "videopanel.h"
#include "mf_enumerate_cameras.h"

// Qt
#include <QtWidgets\QMainWindow>
Expand Down
5 changes: 3 additions & 2 deletions mf_enumerate_cameras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ HRESULT WmfEnumerateCameras::EnumerateCaptureFormats(IMFMediaSource *pSource, st
// get available resolutions
//ss.clear();
hr = MFGetAttributeSize(pType, MF_MT_FRAME_SIZE, &width, &height);
std::cout << "width " << width << " height " << height << std::endl;
// std::cout << "width " << width << " height " << height << std::endl;
//ss << width << "x" << height;
//resVec.push_back(ss.str());

// get available framerates
//ss.clear();
hr = MFGetAttributeRatio(pType, MF_MT_FRAME_RATE, &frameRate, &denominator);
std::cout << "frameRate " << frameRate << " denominator " << denominator << std::endl;
// std::cout << "frameRate " << frameRate << " denominator " << denominator << std::endl;
//ss << (float)frameRate / (float)denominator;
//frameRateVec.push_back(ss.str());

Expand Down Expand Up @@ -149,6 +149,7 @@ HRESULT WmfEnumerateCameras::SelectDevice(std::string deviceName, std::vector<wm
std::wstring *ws;
std::string *s;
IMFMediaSource *pSource=NULL;

HRESULT hr = init_hr_IMFAttributes();

for (int i = 0; i < m_cDevices; i++) {
Expand Down
1 change: 1 addition & 0 deletions mf_enumerate_cameras.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ struct wmfCameraInfo {

};


class WmfEnumerateCameras {


Expand Down
109 changes: 91 additions & 18 deletions ui_videopanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QHBoxLayout>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QPushButton>
#include <QtWidgets/QVBoxLayout>
#include <QtWidgets/QWidget>
#include "qcameraviewfinder.h"

QT_BEGIN_NAMESPACE

class Ui_videoPanel
{
public:
QCameraViewfinder *viewFinder;
QWidget *verticalLayoutWidget;
QVBoxLayout *verticalLayout;
QPushButton *recordingSettingsButton;
QPushButton *recordButton;
QLabel *label_5;
QLineEdit *requestedFR;
Expand All @@ -41,32 +42,35 @@ class Ui_videoPanel
QLineEdit *timeStamp;
QLabel *label_7;
QLineEdit *resolutionEdit;
QGroupBox *groupBox_2;
QGridLayout *gridLayout_2;
QComboBox *videoCodecBox;
QComboBox *videoFramerateBox;
QLabel *videoFrameRateLabel;
QLabel *videoResolutionLabel;
QLabel *videoCodecLabel;
QComboBox *videoResolutionBox;
QLabel *videoFormatLabel;
QComboBox *videoFormatBox;
QWidget *layoutWidget;
QHBoxLayout *horizontalLayout;
QLineEdit *saveFileNameEdit;
QLabel *label;

void setupUi(QWidget *videoPanel)
{
if (videoPanel->objectName().isEmpty())
videoPanel->setObjectName(QStringLiteral("videoPanel"));
videoPanel->resize(731, 444);
viewFinder = new QCameraViewfinder(videoPanel);
viewFinder->setObjectName(QStringLiteral("viewFinder"));
viewFinder->setEnabled(true);
viewFinder->setGeometry(QRect(230, 10, 491, 421));
viewFinder->setAutoFillBackground(true);
videoPanel->resize(622, 306);
verticalLayoutWidget = new QWidget(videoPanel);
verticalLayoutWidget->setObjectName(QStringLiteral("verticalLayoutWidget"));
verticalLayoutWidget->setGeometry(QRect(10, 10, 211, 279));
verticalLayout = new QVBoxLayout(verticalLayoutWidget);
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
recordingSettingsButton = new QPushButton(verticalLayoutWidget);
recordingSettingsButton->setObjectName(QStringLiteral("recordingSettingsButton"));
recordingSettingsButton->setEnabled(true);

verticalLayout->addWidget(recordingSettingsButton);

recordButton = new QPushButton(verticalLayoutWidget);
recordButton->setObjectName(QStringLiteral("recordButton"));
recordButton->setEnabled(false);
recordButton->setEnabled(true);

verticalLayout->addWidget(recordButton);

Expand Down Expand Up @@ -129,6 +133,68 @@ class Ui_videoPanel

verticalLayout->addWidget(resolutionEdit);

groupBox_2 = new QGroupBox(videoPanel);
groupBox_2->setObjectName(QStringLiteral("groupBox_2"));
groupBox_2->setGeometry(QRect(240, 10, 368, 230));
gridLayout_2 = new QGridLayout(groupBox_2);
gridLayout_2->setObjectName(QStringLiteral("gridLayout_2"));
videoCodecBox = new QComboBox(groupBox_2);
videoCodecBox->setObjectName(QStringLiteral("videoCodecBox"));

gridLayout_2->addWidget(videoCodecBox, 7, 0, 1, 2);

videoFramerateBox = new QComboBox(groupBox_2);
videoFramerateBox->setObjectName(QStringLiteral("videoFramerateBox"));

gridLayout_2->addWidget(videoFramerateBox, 3, 0, 1, 2);

videoFrameRateLabel = new QLabel(groupBox_2);
videoFrameRateLabel->setObjectName(QStringLiteral("videoFrameRateLabel"));

gridLayout_2->addWidget(videoFrameRateLabel, 2, 0, 1, 2);

videoResolutionLabel = new QLabel(groupBox_2);
videoResolutionLabel->setObjectName(QStringLiteral("videoResolutionLabel"));

gridLayout_2->addWidget(videoResolutionLabel, 0, 0, 1, 2);

videoCodecLabel = new QLabel(groupBox_2);
videoCodecLabel->setObjectName(QStringLiteral("videoCodecLabel"));

gridLayout_2->addWidget(videoCodecLabel, 6, 0, 1, 2);

videoResolutionBox = new QComboBox(groupBox_2);
videoResolutionBox->setObjectName(QStringLiteral("videoResolutionBox"));

gridLayout_2->addWidget(videoResolutionBox, 1, 0, 1, 2);

videoFormatLabel = new QLabel(groupBox_2);
videoFormatLabel->setObjectName(QStringLiteral("videoFormatLabel"));
videoFormatLabel->setEnabled(false);

gridLayout_2->addWidget(videoFormatLabel, 4, 0, 1, 1);

videoFormatBox = new QComboBox(groupBox_2);
videoFormatBox->setObjectName(QStringLiteral("videoFormatBox"));
videoFormatBox->setEnabled(false);

gridLayout_2->addWidget(videoFormatBox, 5, 0, 1, 2);

layoutWidget = new QWidget(videoPanel);
layoutWidget->setObjectName(QStringLiteral("layoutWidget"));
layoutWidget->setGeometry(QRect(250, 260, 351, 25));
horizontalLayout = new QHBoxLayout(layoutWidget);
horizontalLayout->setSpacing(6);
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
horizontalLayout->setContentsMargins(0, 0, 0, 0);
saveFileNameEdit = new QLineEdit(layoutWidget);
saveFileNameEdit->setObjectName(QStringLiteral("saveFileNameEdit"));

horizontalLayout->addWidget(saveFileNameEdit);

label = new QLabel(videoPanel);
label->setObjectName(QStringLiteral("label"));
label->setGeometry(QRect(250, 240, 931, 20));

retranslateUi(videoPanel);

Expand All @@ -138,13 +204,20 @@ class Ui_videoPanel
void retranslateUi(QWidget *videoPanel)
{
videoPanel->setWindowTitle(QApplication::translate("videoPanel", "Form", 0));
recordingSettingsButton->setText(QApplication::translate("videoPanel", "Recording Settings", 0));
recordButton->setText(QApplication::translate("videoPanel", "Select video settings first", 0));
recordButton->setText(QApplication::translate("videoPanel", "Record", 0));
label_5->setText(QApplication::translate("videoPanel", "Requested Frame Rate", 0));
requestedFR->setText(QString());
label_4->setText(QApplication::translate("videoPanel", "Actual Frame Rate", 0));
label_3->setText(QApplication::translate("videoPanel", "Frame Count", 0));
label_2->setText(QApplication::translate("videoPanel", "Timestamp", 0));
label_7->setText(QApplication::translate("videoPanel", "Resolution", 0));
groupBox_2->setTitle(QApplication::translate("videoPanel", "Video Settings", 0));
videoFrameRateLabel->setText(QApplication::translate("videoPanel", "Framerate:", 0));
videoResolutionLabel->setText(QApplication::translate("videoPanel", "Resolution:", 0));
videoCodecLabel->setText(QApplication::translate("videoPanel", "Video Codec:", 0));
videoFormatLabel->setText(QApplication::translate("videoPanel", "Video Format (windows only):", 0));
saveFileNameEdit->setText(QApplication::translate("videoPanel", "videoCapture.avi", 0));
label->setText(QApplication::translate("videoPanel", "Save File Name:", 0));
} // retranslateUi

};
Expand Down
Loading

0 comments on commit a4f2d63

Please sign in to comment.