Skip to content

Commit

Permalink
finalized features
Browse files Browse the repository at this point in the history
  • Loading branch information
jkriege2 committed Dec 2, 2016
1 parent e9bf941 commit e2eaec3
Show file tree
Hide file tree
Showing 20 changed files with 511 additions and 103 deletions.
14 changes: 10 additions & 4 deletions SlitScanGenerator/SlitScanGenerator.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
#-------------------------------------------------

QT += core gui multimedia
QT += core gui
CONFIG += c++11 stl exceptions

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
Expand All @@ -18,16 +18,19 @@ SOURCES += main.cpp\
cimg_tools.cpp \
ffmpeg_tools.cpp \
imageviewer.cpp \
processingparametertable.cpp
processingparametertable.cpp \
aboutbox.cpp

HEADERS += mainwindow.h \
../CImg/CImg.h \
cimg_tools.h \
ffmpeg_tools.h \
imageviewer.h \
processingparametertable.h
processingparametertable.h \
aboutbox.h

FORMS += mainwindow.ui
FORMS += mainwindow.ui \
aboutbox.ui

INCLUDEPATH += ../CImg \
../ffmpeg/include
Expand All @@ -37,3 +40,6 @@ DEFINES +=
LIBS += -lm -L../ffmpeg/lib -lavutil -lavcodec -lavdevice -lswscale -lavformat -lswresample -lpostproc -lavfilter

MAKE_CXXFLAGS_RELEASE += -O3 -fopenmp -msse2 -msse -fpmath=both

RESOURCES += \
slitscangenerator.qrc
14 changes: 14 additions & 0 deletions SlitScanGenerator/aboutbox.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "aboutbox.h"
#include "ui_aboutbox.h"

AboutBox::AboutBox(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutBox)
{
ui->setupUi(this);
}

AboutBox::~AboutBox()
{
delete ui;
}
22 changes: 22 additions & 0 deletions SlitScanGenerator/aboutbox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef ABOUTBOX_H
#define ABOUTBOX_H

#include <QDialog>

namespace Ui {
class AboutBox;
}

class AboutBox : public QDialog
{
Q_OBJECT

public:
explicit AboutBox(QWidget *parent = 0);
~AboutBox();

private:
Ui::AboutBox *ui;
};

#endif // ABOUTBOX_H
100 changes: 100 additions & 0 deletions SlitScanGenerator/aboutbox.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutBox</class>
<widget class="QDialog" name="AboutBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>459</width>
<height>349</height>
</rect>
</property>
<property name="windowTitle">
<string>About ...</string>
</property>
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1,0" columnstretch="0,1">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="slitscangenerator.qrc">:/icons/icons/info.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>28</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>SlitScanGenerator</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This softwrae generates SlitScan photography images from videos, i.e. XT/YT-slices.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;(c) 2016 by Jan W. Krieger (jan@jkrieger.de)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;It is licensed under the terms of the &lt;/span&gt;&lt;a href=&quot;https://www.gnu.org/licenses/gpl-3.0.html&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline; color:#0000ff;&quot;&gt;GPL 3.0&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;, or above.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;The source code if this application is available from:&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;https://github.com/jkriege2/SlitScanGenerator&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/jkriege2/SlitScanGenerator&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;It uses these libraries for its GUI, image processing and reading videos:&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;Qt (&lt;a href=&quot;https://www.qt.io/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://www.qt.io/&lt;/span&gt;&lt;/a&gt;) -- CImg (&lt;a href=&quot;http://cimg.eu/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;http://cimg.eu/&lt;/span&gt;&lt;/a&gt;) -- FFMPEG (&lt;a href=&quot;https://ffmpeg.org/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://ffmpeg.org/&lt;/span&gt;&lt;/a&gt;)&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="slitscangenerator.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AboutBox</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>227</x>
<y>365</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AboutBox</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>295</x>
<y>371</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
20 changes: 17 additions & 3 deletions SlitScanGenerator/ffmpeg_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern "C" {



bool readFFMPEGAsImageStack(cimg_library::CImg<uint8_t> &video, const std::string& filename, int everyNthFrame, double xyscale, std::string* error, std::function<void(int)> frameCallback)
bool readFFMPEGAsImageStack(cimg_library::CImg<uint8_t> &video, const std::string& filename, int everyNthFrame, double xyscale, std::string* error, std::function<bool(int, int)> frameCallback)
{

// see http://dranger.com/ffmpeg/tutorial01.html
Expand Down Expand Up @@ -63,6 +63,10 @@ bool readFFMPEGAsImageStack(cimg_library::CImg<uint8_t> &video, const std::strin
// Get a pointer to the codec context for the video stream
pCodecCtx=pFormatCtx->streams[videoStream]->codec;

// get number of frames
int nb_frames = pFormatCtx->streams[videoStream]->nb_frames;



// Find the decoder for the video stream
pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
Expand Down Expand Up @@ -104,7 +108,12 @@ bool readFFMPEGAsImageStack(cimg_library::CImg<uint8_t> &video, const std::strin
sws_ctx = sws_getContext(pCodecCtx->width,pCodecCtx->height,pCodecCtx->pix_fmt,pCodecCtx->width,pCodecCtx->height,AV_PIX_FMT_RGB24,SWS_BILINEAR,NULL,NULL,NULL);

i=0;
while(av_read_frame(pFormatCtx, &packet)>=0) {
bool canceled=false;
if (frameCallback) {
canceled=frameCallback(0, nb_frames);
}

while(!canceled && av_read_frame(pFormatCtx, &packet)>=0) {
// Is this a packet from the video stream?
if(packet.stream_index==videoStream) {
// Decode video frame
Expand All @@ -128,7 +137,12 @@ bool readFFMPEGAsImageStack(cimg_library::CImg<uint8_t> &video, const std::strin
}
frame.resize(pCodecCtx->width/xyscale, pCodecCtx->height/xyscale,1,3);
video.append(frame, 'z');
if (frameCallback) frameCallback(video.depth());
if (frameCallback) {
if (frameCallback((nb_frames>0)?i:video.depth(), nb_frames)) {
canceled=true;
}
}

}
}
}
Expand Down
2 changes: 1 addition & 1 deletion SlitScanGenerator/ffmpeg_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*
* \return returns \c true on success and \c false else, error messages are returned in \a error.
*/
bool readFFMPEGAsImageStack(cimg_library::CImg<uint8_t> &video, const std::string& filename, int everyNthFrame=1, double xyscale=1, std::string* error=nullptr, std::function<void(int)> frameCallback=std::function<void(int)>());
bool readFFMPEGAsImageStack(cimg_library::CImg<uint8_t> &video, const std::string& filename, int everyNthFrame=1, double xyscale=1, std::string* error=nullptr, std::function<bool(int,int)> frameCallback=std::function<bool(int,int)>());

struct FFMPEGVideo;

Expand Down
Binary file added SlitScanGenerator/icons/exit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SlitScanGenerator/icons/fileexport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SlitScanGenerator/icons/fileimport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SlitScanGenerator/icons/folder_video.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SlitScanGenerator/icons/info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SlitScanGenerator/icons/list_add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SlitScanGenerator/icons/list_remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added SlitScanGenerator/icons/wizard2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e2eaec3

Please sign in to comment.