网络摄像机视觉系统 Network Camera Vision System
立即下载
资源介绍:
网络摄像机视觉系统
功能齐全的 IP 摄像机管理系统内置于 Qt Creator 中,可在 Windows 上实现 FFMPEG。包括预构建的二进制库,便于编译。需要 Qt、MS Visual Studio、NVIDIA Cuda 驱动程序。
有一个可执行文件的安装程序
# 功能
- ONVIF
Network Camera Vision System
Fully featured IP camera management system built in Qt creator implementing FFMPEG on windows. Includes pre built binary libraries for easy compilation. Requires Qt, MS Visual Studio, NVIDIA Cuda drivers.
There is an install program for the executable
# Features
- ONVIF
- Windows
- FFMPEG
- Qt
- Cuda
- IP Camera
/*******************************************************************************
* mainwindow.cpp
*
* Copyright (c) 2020 Stephen Rhodes
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*******************************************************************************/
#include "mainwindow.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
using namespace std::chrono;
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
QIcon icon("ncvs.ico");
setWindowIcon(icon);
setWindowTitle("Network Camera Vision System v1.0");
settings = new QSettings("NCVS", "ProgramSettings");
cameraNames = new QSettings("NCVS", "CameraNames");
av_log_set_level(AV_LOG_PANIC);
loginDialog = new LoginDialog(this);
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(poll()));
timer->start(1000 / 30);
windowTitleUpdate = new QTimer(this);
connect(windowTitleUpdate, SIGNAL(timeout()), this, SLOT(updateWindowTitle()));
windowTitleUpdate->start(500);
messageDialog = new MessageDialog(this);
analyticsDialog = new AnalyticsDialog(this);
displayContainer = new DisplayContainer(this);
displayContainer->setIdle();
picture_queue = new PictureQueue();
packet_queue = new PacketQueue();
discovery = new Discovery(this);
streamer = new Streamer(this);
reader = new FileReader(this);
picture_file = new PictureFile(this);
controlPanel = new ControlPanel(this);
cameraList = new CameraListView(this);
cameraPanel = new CameraPanel(this);
QGridLayout *layout = new QGridLayout();
mainPanel = new QWidget();
mainPanel->setLayout(layout);
splitter = new QSplitter();
cameraSplitter = new QSplitter();
cameraSplitter->setOrientation(Qt::Vertical);
cameraSplitter->addWidget(cameraList);
cameraSplitter->addWidget(cameraPanel);
videoFileView = new FileView(this);
pictureFileView = new FileView(this);
filterPanel = new FilterPanel(this);
configPanel = new ConfigPanel(this);
tabUtils = new QTabWidget();
tabUtils->addTab(cameraSplitter, "Cameras");
tabUtils->addTab(videoFileView, "Videos");
tabUtils->addTab(pictureFileView, "Pictures");
tabUtils->addTab(filterPanel, "Filters");
tabUtils->addTab(configPanel, "Configuration");
QWidget *sidePanel = new QWidget();
QVBoxLayout *sideLayout = new QVBoxLayout();
sideLayout->addWidget(tabUtils);
sideLayout->addWidget(controlPanel);
sidePanel->setLayout(sideLayout);
splitter->addWidget(displayContainer);
splitter->addWidget(sidePanel);
connect(splitter, SIGNAL(splitterMoved(int, int)), this, SLOT(splitterMoved(int, int)));
layout->addWidget(splitter, 0, 0, 1, 2);
setCentralWidget(mainPanel);
filter_chain = new FilterChain(this);
connect(streamer->decoder, SIGNAL(filter()), filter_chain, SLOT(filter()));
connect(streamer->hw_decoder, SIGNAL(filter()), filter_chain, SLOT(filter()));
connect(reader->decoder, SIGNAL(filter()), filter_chain, SLOT(filter()));
connect(reader, SIGNAL(process(Picture*)), filter_chain, SLOT(process(Picture*)));
connect(picture_file, SIGNAL(filter()), filter_chain, SLOT(filter()));
filter_chain->start();
readGUISettings();
if (configPanel->autoDiscovery->isChecked())
startDiscovery();
if (configPanel->autoShowMessages->isChecked())
showMessageDialog();
if (configPanel->autoShowAnalytics->isChecked())
showAnalyticsDialog();
controlPanel->pauseButton->setEnabled(false);
controlPanel->snapshotButton->setEnabled(false);
controlPanel->writerButton->setEnabled(false);
}
MainWindow::~MainWindow()
{
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
delete timer;
}
void MainWindow::updateWindowTitle()
{
QString title;
if (controlPanel->streamerButton->isChecked()) {
switch (current_stream_type) {
case CAMERA_STREAM:
title = cameraList->getCurrentCamera()->getCameraName();
break;
default:
title = "Network Camera Vision System v1.0";
}
}
else {
title = "Network Camera Vision System v1.0";
}
if (controlPanel->writerButton->isChecked()) {
if (alternateTitle)
title.append(" ** RECORDING **");
alternateTitle = !alternateTitle;
}
setWindowTitle(title);
}
void MainWindow::splitterMoved(int x, int y)
{
if (mainPanel->geometry().width() - x < configPanel->geometry().width()) {
tabUtils->hide();
controlPanel->hide();
}
else {
tabUtils->show();
controlPanel->show();
}
}
void MainWindow::initializeSDL()
{
window = SDL_CreateWindowFrom((void *)displayContainer->getWinId());
renderer = SDL_CreateRenderer(window, -1, 0);
}
void MainWindow::poll()
{
SDL_PollEvent(&sdlEvent);
}
void MainWindow::render(Picture *picture)
{
mutex.lock();
if (current_stream_type == VIDEO_STREAM) {
if (reader->paused) {
if (reader->picture.pts != filter_chain->pre_picture.pts)
reader->picture.copy(&(filter_chain->pre_picture));
}
else {
reader->adjustSliderPosition(picture->pts);
}
}
if (getSDLWindowSize() != picture->size)
SDL_SetWindowSize(window, picture->size.width(), picture->size.height());
int sdl_ret = 0;
sdl_ret = SDL_UpdateYUVTexture(texture, NULL, picture->data[0], picture->linesize[0],
picture->data[1], picture->linesize[1],
picture->data[2], picture->linesize[2]);
if (sdl_ret < 0)
msg(QString("SDL_UpdateYUVTexture Error - %1\n").arg(SDL_GetError()));
sdl_ret = SDL_RenderCopy(renderer, texture, NULL, &rect);
if (sdl_ret < 0)
msg(QString("SDL_RenderCopy Error - %1\n").arg(SDL_GetError()));
SDL_RenderPresent(renderer);
last_picture.copy(picture);
mutex.unlock();
}
QSize MainWindow::getSDLWindowSize()
{
int window_width;
int window_height;
SDL_GetWindowSize(window, &window_width, &window_height);
QSize window_size(window_width, window_height);
return window_size;
}
void MainWindow::updateDisplay(QSize size)
{
display_size.setWidth(size.width());
display_size.setHeight(size.height());
bool has_zero_denominator = false;
if (resolution.width() == 0 || resolution.height() == 0 || display_size.height() == 0)
has_zero_denominator = true;
if (!has_zero_denominator) {
float resolution_aspect_ratio = resolution.width() / (float)resolution.height();
float display_aspect_ratio = display_size.width() / (float)display_size.height();
if (display_aspect_ratio > resolution_aspect_ratio) {
display_size.setWidth((int)(resolution_aspect_ratio * display_size.h
资源文件列表:
ncvs-1.0.0.zip 大约有556个文件