-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CameraEngine.h/.cpp, cameras/): new features.
1. new coding stripe cropping function added. 2. the Save Point Cloud feature will save both texture and depth maps simultaneously.
- Loading branch information
1 parent
3144550
commit edd2ea2
Showing
11 changed files
with
601 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ | |
"type" : "bool" | ||
}, | ||
{ | ||
"data" : 1, | ||
"data" : 0, | ||
"title" : "Gpu Accelerate", | ||
"type" : "bool" | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
/** | ||
* @file CameraEngine.h | ||
* @author Evans Liu ([email protected]) | ||
* @brief | ||
* @brief | ||
* @version 0.1 | ||
* @date 2024-03-19 | ||
* | ||
* | ||
* @copyright Copyright (c) 2024 | ||
* | ||
* | ||
*/ | ||
|
||
#ifndef __CAMERA_ENGINE_H_ | ||
#define __CAMERA_ENGINE_H_ | ||
|
||
#include <vector> | ||
#include <thread> | ||
#include <vector> | ||
|
||
|
||
#include <QObject> | ||
#include <QThread> | ||
|
||
#include <opencv2/opencv.hpp> | ||
|
||
#include "AppType.h" | ||
#include "CameraModel.h" | ||
#include "ImagePaintItem.h" | ||
#include "typeDef.h" | ||
#include "CameraModel.h" | ||
|
||
|
||
#include <slmaster.h> | ||
|
||
|
@@ -33,28 +35,42 @@ class CameraEngine : public QObject { | |
Q_PROPERTY_AUTO(bool, isConnected) | ||
Q_PROPERTY_AUTO(bool, isBurnWorkFinish) | ||
public: | ||
static CameraEngine* instance(); | ||
static CameraEngine *instance(); | ||
struct OrderTableRecord { | ||
OrderTableRecord() {} | ||
OrderTableRecord(const int patternsNum, const int shiftTime, const bool isVertical) : patternsNum_(patternsNum), shiftTime_(shiftTime), isVertical_(isVertical) {} | ||
OrderTableRecord(const int patternsNum, const int shiftTime, | ||
const bool isVertical) | ||
: patternsNum_(patternsNum), shiftTime_(shiftTime), | ||
isVertical_(isVertical) {} | ||
int patternsNum_; | ||
int shiftTime_; | ||
bool isVertical_; | ||
}; | ||
//Device page | ||
// Device page | ||
Q_INVOKABLE void startDetectCameraState(); | ||
Q_INVOKABLE int createStripe(const int pixelDepth, const int direction, const int stripeType, const int defocusMethod, const int imgWidth, const int imgHeight, const int cycles, const int shiftTime, const bool isKeepAdd); | ||
Q_INVOKABLE int createStripe(const int pixelDepth, const int direction, | ||
const int stripeType, const int defocusMethod, | ||
const int imgWidth, const int imgHeight, | ||
const int clipWidth, const int clipHeight, | ||
const int cycles, const int shiftTime, | ||
const bool isKeepAdd); | ||
Q_INVOKABLE void displayStripe(const int stripeIndex); | ||
Q_INVOKABLE void selectCamera(const int cameraType); | ||
Q_INVOKABLE void setCameraJsonPath(const std::string jsonPath); | ||
Q_INVOKABLE bool connectCamera(); | ||
Q_INVOKABLE bool disConnectCamera(); | ||
Q_INVOKABLE void burnStripe(); | ||
Q_INVOKABLE void bindStripePaintItem(ImagePaintItem* stripePaintItem) { stripePaintItem_ = stripePaintItem; } | ||
//offlineScan page | ||
Q_INVOKABLE void bindOfflineCamPaintItem(ImagePaintItem* camPaintItem) { offlineCamPaintItem_ = camPaintItem; } | ||
//scan page | ||
Q_INVOKABLE void setScanMode(const int scanMode) { scanMode_ = AppType::ScanModeType(scanMode); } | ||
Q_INVOKABLE void bindStripePaintItem(ImagePaintItem *stripePaintItem) { | ||
stripePaintItem_ = stripePaintItem; | ||
} | ||
// offlineScan page | ||
Q_INVOKABLE void bindOfflineCamPaintItem(ImagePaintItem *camPaintItem) { | ||
offlineCamPaintItem_ = camPaintItem; | ||
} | ||
// scan page | ||
Q_INVOKABLE void setScanMode(const int scanMode) { | ||
scanMode_ = AppType::ScanModeType(scanMode); | ||
} | ||
Q_INVOKABLE void projectOnce(); | ||
Q_INVOKABLE void projectContinues(); | ||
Q_INVOKABLE void pauseProject(const bool isResume); | ||
|
@@ -64,50 +80,70 @@ class CameraEngine : public QObject { | |
Q_INVOKABLE void startScan(); | ||
Q_INVOKABLE void continuesScan(); | ||
Q_INVOKABLE void pauseScan(); | ||
Q_INVOKABLE void bindOfflineLeftCamModel(CameraModel* model) { leftCamModel_ = model; } | ||
Q_INVOKABLE void bindOfflineRightCamModel(CameraModel* model) { rightCamModel_ = model; } | ||
Q_INVOKABLE void bindOfflineColorCamModel(CameraModel* model) { colorCamModel_ = model; } | ||
Q_INVOKABLE void bindScanTexturePaintItem(ImagePaintItem* paintItem) { scanTexturePaintItem_ = paintItem; } | ||
Q_INVOKABLE void updateDisplayImg(const QString& imgPath); | ||
Q_INVOKABLE void saveStripe(const QString& path); | ||
Q_INVOKABLE void bindOfflineLeftCamModel(CameraModel *model) { | ||
leftCamModel_ = model; | ||
} | ||
Q_INVOKABLE void bindOfflineRightCamModel(CameraModel *model) { | ||
rightCamModel_ = model; | ||
} | ||
Q_INVOKABLE void bindOfflineColorCamModel(CameraModel *model) { | ||
colorCamModel_ = model; | ||
} | ||
Q_INVOKABLE void bindScanTexturePaintItem(ImagePaintItem *paintItem) { | ||
scanTexturePaintItem_ = paintItem; | ||
} | ||
Q_INVOKABLE void updateDisplayImg(const QString &imgPath); | ||
Q_INVOKABLE void saveStripe(const QString &path); | ||
Q_INVOKABLE void setPatternType(const int patternType); | ||
Q_INVOKABLE bool setNumberAttribute(const QString& attributeName, | ||
const double val); | ||
Q_INVOKABLE bool setBooleanAttribute(const QString& attributeName, const bool val); | ||
Q_INVOKABLE double getNumberAttribute(const QString& attributeName); | ||
Q_INVOKABLE bool getBooleanAttribute(const QString& attributeName); | ||
Q_INVOKABLE QString getStringAttribute(const QString& attributeName); | ||
Q_INVOKABLE const slmaster::cameras::FrameData& getCurFrame() { return frame_; } | ||
std::shared_ptr<slmaster::cameras::SLCamera> getSLCamera() { return slCameraFactory_.getCamera(slmaster::cameras::CameraType(cameraType_)); } | ||
std::vector<OrderTableRecord> getOrderTableRecord() { return orderTableRecord_; } | ||
Q_INVOKABLE bool setNumberAttribute(const QString &attributeName, | ||
const double val); | ||
Q_INVOKABLE bool setBooleanAttribute(const QString &attributeName, | ||
const bool val); | ||
Q_INVOKABLE double getNumberAttribute(const QString &attributeName); | ||
Q_INVOKABLE bool getBooleanAttribute(const QString &attributeName); | ||
Q_INVOKABLE QString getStringAttribute(const QString &attributeName); | ||
Q_INVOKABLE const slmaster::cameras::FrameData &getCurFrame() { | ||
return frame_; | ||
} | ||
Q_INVOKABLE bool saveFrame(const QString &path); | ||
std::shared_ptr<slmaster::cameras::SLCamera> getSLCamera() { | ||
return slCameraFactory_.getCamera( | ||
slmaster::cameras::CameraType(cameraType_)); | ||
} | ||
std::vector<OrderTableRecord> getOrderTableRecord() { | ||
return orderTableRecord_; | ||
} | ||
signals: | ||
void stripeImgsChanged(const int num); | ||
void frameCaptured(); | ||
|
||
private: | ||
CameraEngine(); | ||
~CameraEngine(); | ||
CameraEngine(const CameraEngine&) = delete; | ||
const CameraEngine& operator=(const CameraEngine&) = delete; | ||
void defocusStripeCreate(std::vector<cv::Mat>& imgs, const int direction, const int cycles, const int shiftTime, AppType::DefocusEncoding method); | ||
void realTimeRenderImg(const QImage& img); | ||
CameraEngine(const CameraEngine &) = delete; | ||
const CameraEngine &operator=(const CameraEngine &) = delete; | ||
void defocusStripeCreate(std::vector<cv::Mat> &imgs, const int direction, | ||
const int cycles, const int shiftTime, | ||
AppType::DefocusEncoding method); | ||
void realTimeRenderImg(const QImage &img); | ||
void createTenLine(); | ||
void switchTrigMode(const bool isTrigLine, const int exposureTime); | ||
std::vector<OrderTableRecord> orderTableRecord_; | ||
std::vector<QImage> stripeImgs_; | ||
AppType::ScanModeType scanMode_; | ||
AppType::CameraType cameraType_; | ||
AppType::PatternMethod patternType_; | ||
static CameraEngine* engine_; | ||
ImagePaintItem* stripePaintItem_ = nullptr; | ||
ImagePaintItem* offlineCamPaintItem_ = nullptr; | ||
ImagePaintItem* scanTexturePaintItem_ = nullptr; | ||
static CameraEngine *engine_; | ||
ImagePaintItem *stripePaintItem_ = nullptr; | ||
ImagePaintItem *offlineCamPaintItem_ = nullptr; | ||
ImagePaintItem *scanTexturePaintItem_ = nullptr; | ||
std::thread onlineDetectThread_; | ||
std::thread workThread_; | ||
slmaster::cameras::SLCameraFactory slCameraFactory_; | ||
std::shared_ptr<slmaster::cameras::Pattern> pattern_ = nullptr; | ||
CameraModel* leftCamModel_ = nullptr; | ||
CameraModel* rightCamModel_ = nullptr; | ||
CameraModel* colorCamModel_ = nullptr; | ||
CameraModel *leftCamModel_ = nullptr; | ||
CameraModel *rightCamModel_ = nullptr; | ||
CameraModel *colorCamModel_ = nullptr; | ||
slmaster::cameras::FrameData frame_; | ||
std::thread test_thread_; | ||
std::atomic_bool appExit_; | ||
|
@@ -116,4 +152,4 @@ class CameraEngine : public QObject { | |
std::atomic_bool isContinusStop_; | ||
}; | ||
|
||
#endif// !__CAMERA_ENGINE_H_ | ||
#endif // !__CAMERA_ENGINE_H_ |
Oops, something went wrong.