Skip to content

Commit

Permalink
杂七杂八的细节调整
Browse files Browse the repository at this point in the history
  • Loading branch information
miRoox committed Dec 19, 2019
1 parent 2d0606f commit b483a88
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 25 deletions.
8 changes: 1 addition & 7 deletions DIP-src/DIP.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ TARGET = DIP

CONFIG(release, debug|release): DESTDIR = ../bin

VERSION = 1.0.0
VERSION = 1.0.1

QT += core gui charts

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17
#mac: CONFIG -= app_bundle

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
Expand Down Expand Up @@ -44,8 +43,3 @@ RESOURCES += \

win32: RC_ICONS = DIP.ico
mac: ICON = DIP.icns

#CONFIG(release, debug|release) {
# win32: QMAKE_POST_LINK += $$[QT_INSTALL_BINS]/windeployqt $$shell_path($$absolute_path($$DESTDIR)) $$escape_expand(\\n\\t)
# mac: QMAKE_POST_LINK += $$[QT_INSTALL_BINS]/macdeployqt $$shell_path($$absolute_path($$DESTDIR)) $$escape_expand(\\n\\t)
#}
11 changes: 6 additions & 5 deletions DIP-src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,13 @@ MainWindow::MainWindow(QWidget *parent)
ui->toolBar->addAction(QIcon(":/rc/icon/information.png"),
tr("关于"),[this]{
QMessageBox::about(this,tr("关于本程序"),
tr("<h1>数字图像处理 - 作业</h1>")+
tr("<h1>数字图像处理大作业</h1>")+
tr("<h2>局部统计特征增强</h2>")+
tr("<p>并与全局直方图均衡化对比,用钨丝灰度图。</p>")+
tr("<hr/>")+
tr("<p>本程序基于<a href=\"https://www.qt.io/\">Qt</a>构建</p>")+
tr("<p>图标由<a href=\"https://www.flaticon.com/authors/good-ware\" title=\"Good Ware\">Good Ware</a>和<a href=\"https://www.flaticon.com/authors/freepik\" title=\"Freepik\">Freepik</a>制作</p>"));
tr("<p>程序源码托管于<a href=\"https://github.com/miRoox/HIT-DigitalImageProcessing-Postgraduate\">GitHub</a></p>")+
tr("<p>图标由<a href=\"https://www.flaticon.com/authors/good-ware\">Good Ware</a>和<a href=\"https://www.flaticon.com/authors/freepik\">Freepik</a>制作</p>"));
});
} // “关于”按钮

Expand Down Expand Up @@ -228,7 +229,7 @@ MainWindow::MainWindow(QWidget *parent)
ui->tabWidget->setCurrentWidget(tab);
auto splitter = tab->findChild<QSplitter*>();
Q_CHECK_PTR(splitter);
int prefSize = std::min(image.width(),splitter->height()); // 更换图像的时候调整显示区域尺寸
int prefSize = std::min(image.width(),image.width()*splitter->height()/image.height()); // 更换图像的时候调整显示区域尺寸
splitter->setSizes({prefSize,splitter->width()-prefSize});
imageView->fitInView(scene->itemsBoundingRect(),Qt::KeepAspectRatio);
imageView->updateGeometry();
Expand Down Expand Up @@ -286,9 +287,9 @@ MainWindow::MainWindow(QWidget *parent)
setupViews(origin,ui->originView,ui->originHistView,ui->originTab,
tr("原图像的灰度直方图"),&MainWindow::imageLoaded);
setupViews(globalEnh,ui->globalEnhView,ui->globalEnhHistView,ui->globalEnhTab,
tr("全局直方图均衡化图像的灰度直方图"),&MainWindow::globalEnhUpdated);
tr("直方图均衡化结果的灰度直方图"),&MainWindow::globalEnhUpdated);
setupViews(localEnh,ui->localEnhView,ui->localEnhHistView,ui->localEnhTab,
tr("局部统计增强图像的灰度直方图"),&MainWindow::localEnhUpdated);
tr("局部统计增强结果的灰度直方图"),&MainWindow::localEnhUpdated);
}

MainWindow::~MainWindow()
Expand Down
1 change: 0 additions & 1 deletion DIP-src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define MAINWINDOW_H

#include <QMainWindow>
#include <QVector>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
Expand Down
9 changes: 6 additions & 3 deletions DIP-src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
<bool>true</bool>
</property>
<property name="windowTitle">
<string>数字图像处理 - 作业</string>
<string>数字图像处理大作业</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="acceptDrops">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QTabWidget" name="tabWidget">
Expand All @@ -25,7 +28,7 @@
</property>
<widget class="QWidget" name="originTab">
<attribute name="title">
<string>原图</string>
<string>原图像</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
Expand Down Expand Up @@ -85,7 +88,7 @@
</widget>
<widget class="QWidget" name="localEnhTab">
<attribute name="title">
<string>局部直方图统计增强</string>
<string>基于局部统计特征的增强</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
Expand Down
18 changes: 9 additions & 9 deletions report/report.tex
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@

\section{题目}

局部统计特征增强

局部统计特征增强\\
并与全局直方图均衡化对比,用钨丝灰度图。

\section{数学原理}
Expand Down Expand Up @@ -115,7 +114,7 @@ \subsection{基于局部统计特征的增强}
则对于$x=0,1,\cdots,M-1,\,y=0,1,\cdots,N-1$,有
\begin{equation}\label{eq:local-enh}
g(x,y)=\begin{cases}
E\cdot f(x,y) & m_{S_{x,y}}\le m_G\,\text{且}\,k_1\sigma_G\le\sigma_{S_{x,y}}\le k_2\sigma_G\\
E\cdot f(x,y) & m_{S_{x,y}}\le m_G \land k_1\sigma_G\le\sigma_{S_{x,y}}\le k_2\sigma_G\\
f(x,y) & \text{其它}
\end{cases}
\end{equation}
Expand Down Expand Up @@ -254,7 +253,7 @@ \section{结果分析与讨论}

\begin{figure}[!htb]
\centering
\includegraphics[width=0.8\linewidth]{tungsten-hist.png}
\includegraphics[width=0.9\linewidth]{tungsten-hist.png}
\caption{原图像的灰度直方图}
\label{fig:tungsten-origin-hist}
\end{figure}
Expand All @@ -267,14 +266,14 @@ \section{结果分析与讨论}

\begin{figure}[!htb]
\centering
\includegraphics[width=0.8\linewidth]{tungsten-global-hist.png}
\includegraphics[width=0.9\linewidth]{tungsten-global-hist.png}
\caption{直方图均衡化结果的灰度直方图}
\label{fig:tungsten-global-hist}
\end{figure}

\begin{figure}[!htb]
\centering
\includegraphics[width=0.8\linewidth]{tungsten-local-hist.png}
\includegraphics[width=0.9\linewidth]{tungsten-local-hist.png}
\caption{局部统计增强结果的灰度直方图}
\label{fig:tungsten-local-hist}
\end{figure}
Expand All @@ -296,12 +295,13 @@ \section{结果分析与讨论}

\section{算法源码}

程序使用 C++ 基于 Qt 框架开发,完整的源码见 GitHub 仓库:\\
程序使用 C++ 语言基于 Qt 框架开发,完整的源码见 GitHub 仓库:\\
\url{https://github.com/miRoox/HIT-DigitalImageProcessing-Postgraduate}

代码仓库中也包含报告的 \LaTeX{} 源码和一个 \textsc{Matlab} 版代码。
代码仓库中也包含报告的 \LaTeX{} 源码和一个 \textsc{Matlab} 版代码,
编译得到的可执行的程序可以在仓库的“releases”页面找到。

下面只附上算法 C++ 实现的核心源码:
\noindent 下面只附上算法 C++ 实现的核心源码:

\noindent 头文件\textbf{algorithms.h}:

Expand Down
Binary file modified report/tungsten-global-hist.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 modified report/tungsten-local-hist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b483a88

Please sign in to comment.