[ui] reading, writing works
This commit is contained in:
parent
f68dc517ae
commit
6a0570666e
@ -10,7 +10,7 @@ void Grabber::run() {
|
||||
Pylon::CInstantCamera *cam = camera->getCamera();
|
||||
cam->StartGrabbing();
|
||||
while (!stop_request) {
|
||||
camera->frameRate(25);
|
||||
camera->frameRate(50);
|
||||
MyImage img;
|
||||
cam->RetrieveResult( 5000, frame, Pylon::TimeoutHandling_ThrowException);
|
||||
img.setFrame(frame);
|
||||
|
@ -41,8 +41,9 @@ PylonRecorder::PylonRecorder(QWidget *parent)
|
||||
scrollArea->setVisible(false);
|
||||
setCentralWidget(scrollArea);
|
||||
pylon = new PylonWrapper();
|
||||
buffer = new ImageBuffer();
|
||||
buffer = new ImageBuffer(1000);
|
||||
grabber = new Grabber(pylon, buffer);
|
||||
writer = new Writer(buffer);
|
||||
createActions();
|
||||
updateActions();
|
||||
|
||||
@ -69,6 +70,7 @@ PylonRecorder::~PylonRecorder(){
|
||||
delete pylon;
|
||||
delete buffer;
|
||||
delete grabber;
|
||||
delete writer;
|
||||
}
|
||||
|
||||
bool PylonRecorder::loadFile(const QString &fileName) {
|
||||
@ -384,17 +386,32 @@ void PylonRecorder::disconnectCamera() {
|
||||
}
|
||||
|
||||
void PylonRecorder::startRecording() {
|
||||
VideoSpecs specs;
|
||||
specs.fps = 25;
|
||||
specs.filename = "Test.mp4";
|
||||
ImageSettings settings = pylon->getImageSettings();
|
||||
specs.width = static_cast<uint32_t>(settings.width);
|
||||
specs.height= static_cast<uint32_t>(settings.height);
|
||||
specs.pixelType = settings.pixelType;
|
||||
specs.orientation = settings.orientation;
|
||||
specs.quality = 95;
|
||||
writer->setVideoSpecs(specs);
|
||||
buffer->clear();
|
||||
grabber->start();
|
||||
writer->start();
|
||||
grabbing = true;
|
||||
|
||||
preassureTimer->start(50);
|
||||
frameTimer->start(50);
|
||||
updateActions();
|
||||
preassureTimer->start(25);
|
||||
frameTimer->start(100);
|
||||
|
||||
}
|
||||
|
||||
void PylonRecorder::stopRecording() {
|
||||
grabber->requestStop();
|
||||
writer->requestStop();
|
||||
grabber->wait(10000);
|
||||
writer->wait(10000);
|
||||
grabbing = false;
|
||||
frameTimer->stop();
|
||||
preassureTimer->stop();
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "pylonwrapper.h"
|
||||
#include "imagebuffer.h"
|
||||
#include "grabber.h"
|
||||
#include "writer.h"
|
||||
|
||||
#include <QImage>
|
||||
#if defined(QT_PRINTSUPPORT_LIB)
|
||||
@ -78,6 +79,7 @@ private:
|
||||
PylonWrapper *pylon;
|
||||
ImageBuffer *buffer;
|
||||
Grabber *grabber;
|
||||
Writer *writer;
|
||||
bool grabbing;
|
||||
QPalette progressPalette;
|
||||
|
||||
|
@ -65,8 +65,11 @@ ImageSettings PylonWrapper::getImageSettings() {
|
||||
Pylon::CIntegerParameter width( camera->GetNodeMap(), "Width");
|
||||
Pylon::CIntegerParameter height( camera->GetNodeMap(), "Height");
|
||||
Pylon::CEnumParameter pixelFormat( camera->GetNodeMap(), "PixelFormat");
|
||||
Pylon::CPixelTypeMapper pixelTypeMapper(&pixelFormat);
|
||||
settings.pixelType = pixelTypeMapper.GetPylonPixelTypeFromNodeValue(pixelFormat.GetIntValue());
|
||||
settings.width = width.GetValue();
|
||||
settings.height = height.GetValue();
|
||||
settings.orientation = Pylon::EImageOrientation::ImageOrientation_TopDown;
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
@ -8,6 +8,8 @@
|
||||
struct ImageSettings {
|
||||
int64_t width = 0;
|
||||
int64_t height = 0;
|
||||
Pylon::EPixelType pixelType;
|
||||
Pylon::EImageOrientation orientation;
|
||||
};
|
||||
|
||||
class PylonWrapper
|
||||
|
@ -7,14 +7,16 @@ HEADERS = \
|
||||
imagebuffer.h \
|
||||
myimage.h \
|
||||
pylonrecorder.h \
|
||||
pylonwrapper.h
|
||||
pylonwrapper.h \
|
||||
writer.h
|
||||
SOURCES = \
|
||||
grabber.cpp \
|
||||
imagebuffer.cpp \
|
||||
myimage.cpp \
|
||||
pylonrecorder.cpp \
|
||||
pylonwrapper.cpp \
|
||||
main.cpp
|
||||
main.cpp \
|
||||
writer.cpp
|
||||
|
||||
# install
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/imageviewer
|
||||
|
Loading…
Reference in New Issue
Block a user