remove zbar dependency
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
#include "adjustpicturedialog.h"
|
||||
#include "ui_adjustpicturedialog.h"
|
||||
#include "utils/utils.h"
|
||||
#include <utils/utils.h>
|
||||
|
||||
#include <opencv2/objdetect.hpp>
|
||||
#include <opencv2/imgcodecs.hpp>
|
||||
#include <opencv2/imgproc.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <string>
|
||||
#include <opencv2/core/mat.hpp>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <zbar.h>
|
||||
|
||||
using cv::QRCodeDetector, cv::Mat;
|
||||
|
||||
AdjustPictureDialog::AdjustPictureDialog(QWidget *parent, std::string imagePath)
|
||||
: QDialog(parent)
|
||||
@@ -54,24 +57,26 @@ void AdjustPictureDialog::accept() {
|
||||
}
|
||||
|
||||
std::string AdjustPictureDialog::decode() {
|
||||
cv::Mat im = cv::imread(get_path_relative_to_home(".local/share/checks_parser/temp.png"));
|
||||
Mat im = cv::imread(get_path_relative_to_home(".local/share/checks_parser/temp.png"));
|
||||
QRCodeDetector qrDecoder = QRCodeDetector();
|
||||
return qrDecoder.detectAndDecode(im);
|
||||
|
||||
zbar::ImageScanner scanner;
|
||||
scanner.set_config(zbar::ZBAR_QRCODE, zbar::ZBAR_CFG_ENABLE, 1);
|
||||
// zbar::ImageScanner scanner;
|
||||
// scanner.set_config(zbar::ZBAR_QRCODE, zbar::ZBAR_CFG_ENABLE, 1);
|
||||
|
||||
cv::Mat imGray;
|
||||
cv::cvtColor(im, imGray, cv::COLOR_BGR2GRAY);
|
||||
// cv::Mat imGray;
|
||||
// cv::cvtColor(im, imGray, cv::COLOR_BGR2GRAY);
|
||||
|
||||
zbar::Image image(im.cols, im.rows, "Y800", (uchar *) imGray.data, im.cols * im.rows);
|
||||
scanner.scan(image);
|
||||
// zbar::Image image(im.cols, im.rows, "Y800", (uchar *) imGray.data, im.cols * im.rows);
|
||||
// scanner.scan(image);
|
||||
|
||||
std::string result = "";
|
||||
// std::string result = "";
|
||||
|
||||
for (zbar::Image::SymbolIterator symbol = image.symbol_begin(); symbol != image.symbol_end(); ++symbol) {
|
||||
result = symbol->get_data();
|
||||
}
|
||||
// for (zbar::Image::SymbolIterator symbol = image.symbol_begin(); symbol != image.symbol_end(); ++symbol) {
|
||||
// result = symbol->get_data();
|
||||
// }
|
||||
|
||||
return result;
|
||||
// return result;
|
||||
}
|
||||
|
||||
void AdjustPictureDialog::computeContrastLookupTable() {
|
||||
|
||||
Reference in New Issue
Block a user