mirror of https://github.com/status-im/qzxing.git
fixing compilation errors
This commit is contained in:
parent
d601d8e74c
commit
7eb571c2ae
|
@ -101,7 +101,7 @@ CameraImageWrapper *CameraImageWrapper::Factory(const QImage &sourceImage, int m
|
||||||
return new CameraImageWrapper(sourceImage);
|
return new CameraImageWrapper(sourceImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>> > CameraImageWrapper::getOriginalImage()
|
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>> CameraImageWrapper::getOriginalImage()
|
||||||
{
|
{
|
||||||
return imageBytesPerRow;
|
return imageBytesPerRow;
|
||||||
}
|
}
|
||||||
|
@ -167,11 +167,11 @@ QSharedPointer<std::vector<zxing::byte>> CameraImageWrapper::getRowP(int y, QSha
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
|
|
||||||
if (row->size() != width)
|
if (row->size() != width)
|
||||||
row.reset(QSharedPointer<std::vector<zxing::byte>>(width));
|
row.reset(new std::vector<zxing::byte>(width));
|
||||||
|
|
||||||
Q_ASSERT(y >= 0 && y < getHeight());
|
Q_ASSERT(y >= 0 && y < getHeight());
|
||||||
|
|
||||||
return imageBytesPerRow[y];
|
return (*imageBytesPerRow)[y];
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<std::vector<zxing::byte>> CameraImageWrapper::getMatrixP() const
|
QSharedPointer<std::vector<zxing::byte>> CameraImageWrapper::getMatrixP() const
|
||||||
|
@ -195,13 +195,13 @@ void CameraImageWrapper::updateImageAsGrayscale(const QImage &origin)
|
||||||
const int width = getWidth();
|
const int width = getWidth();
|
||||||
const int height = getHeight();
|
const int height = getHeight();
|
||||||
|
|
||||||
imageBytes = QSharedPointer<std::vector<zxing::byte>>(height*width);
|
imageBytes = QSharedPointer<std::vector<zxing::byte>>(new std::vector<zxing::byte>(height*width));
|
||||||
imageBytesPerRow = QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>(height);
|
imageBytesPerRow = QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>>(new std::vector<QSharedPointer<std::vector<zxing::byte>>>(height));
|
||||||
zxing::byte* m = &imageBytes[0];
|
zxing::byte* m = &(*imageBytes)[0];
|
||||||
|
|
||||||
for(int j=0; j<height; j++)
|
for(int j=0; j<height; j++)
|
||||||
{
|
{
|
||||||
QSharedPointer<std::vector<zxing::byte>> line(width);
|
QSharedPointer<std::vector<zxing::byte>> line(new std::vector<zxing::byte>(width));
|
||||||
for(int i=0; i<width; i++)
|
for(int i=0; i<width; i++)
|
||||||
{
|
{
|
||||||
pixel = origin.pixel(i,j);
|
pixel = origin.pixel(i,j);
|
||||||
|
@ -209,12 +209,12 @@ void CameraImageWrapper::updateImageAsGrayscale(const QImage &origin)
|
||||||
pixelGrayscale = gray(qRed(pixel),qGreen(pixel),qBlue(pixel));
|
pixelGrayscale = gray(qRed(pixel),qGreen(pixel),qBlue(pixel));
|
||||||
else
|
else
|
||||||
pixelGrayscale = pixel & 0xFF;
|
pixelGrayscale = pixel & 0xFF;
|
||||||
line[i] = pixelGrayscale;
|
(*line)[i] = pixelGrayscale;
|
||||||
}
|
}
|
||||||
imageBytesPerRow[j] = line;
|
(*imageBytesPerRow)[j] = line;
|
||||||
|
|
||||||
#if __cplusplus > 199711L
|
#if __cplusplus > 199711L
|
||||||
memcpy(m, line->values().data(), width);
|
memcpy(m, (*line).data(), width); ///the below line is also usable
|
||||||
#else
|
#else
|
||||||
memcpy(m, &line[0], width);
|
memcpy(m, &line[0], width);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
|
|
||||||
static CameraImageWrapper* Factory(const QImage& image, int maxWidth=-1, int maxHeight=-1, bool smoothTransformation=false);
|
static CameraImageWrapper* Factory(const QImage& image, int maxWidth=-1, int maxHeight=-1, bool smoothTransformation=false);
|
||||||
|
|
||||||
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>> > getOriginalImage();
|
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>> > > getOriginalImage();
|
||||||
QSharedPointer<GreyscaleLuminanceSource> getDelegate() { return delegate; }
|
QSharedPointer<GreyscaleLuminanceSource> getDelegate() { return delegate; }
|
||||||
|
|
||||||
QSharedPointer<std::vector<zxing::byte>> getRow(int y, QSharedPointer<std::vector<zxing::byte>> row) const;
|
QSharedPointer<std::vector<zxing::byte>> getRow(int y, QSharedPointer<std::vector<zxing::byte>> row) const;
|
||||||
|
@ -53,7 +53,7 @@ private:
|
||||||
void updateImageAsGrayscale(const QImage &origin);
|
void updateImageAsGrayscale(const QImage &origin);
|
||||||
|
|
||||||
QSharedPointer<GreyscaleLuminanceSource> delegate;
|
QSharedPointer<GreyscaleLuminanceSource> delegate;
|
||||||
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>> imageBytesPerRow;
|
QSharedPointer<std::vector<QSharedPointer<std::vector<zxing::byte>>>> imageBytesPerRow;
|
||||||
QSharedPointer<std::vector<zxing::byte>> imageBytes;
|
QSharedPointer<std::vector<zxing::byte>> imageBytes;
|
||||||
|
|
||||||
static const zxing::byte B_TO_GREYSCALE[256];
|
static const zxing::byte B_TO_GREYSCALE[256];
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace zxing
|
||||||
int width = getWidth();
|
int width = getWidth();
|
||||||
for (int i = 0; i < width; i++)
|
for (int i = 0; i < width; i++)
|
||||||
{
|
{
|
||||||
row[i] = 0xFF - row[i];
|
(*row)[i] = 0xFF - (*row)[i];
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,10 @@ namespace zxing
|
||||||
{
|
{
|
||||||
QSharedPointer<std::vector<zxing::byte>> matrix = delegate->getMatrix();
|
QSharedPointer<std::vector<zxing::byte>> matrix = delegate->getMatrix();
|
||||||
int length = getWidth() * getHeight();
|
int length = getWidth() * getHeight();
|
||||||
QSharedPointer<std::vector<zxing::byte>> invertedMatrix(length);
|
QSharedPointer<std::vector<zxing::byte>> invertedMatrix(new std::vector<zxing::byte>(length));
|
||||||
for (int i = 0; i < length; i++)
|
for (int i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
invertedMatrix[i] = 0xFF - matrix[i];
|
(*invertedMatrix)[i] = 0xFF - (*matrix)[i];
|
||||||
}
|
}
|
||||||
return invertedMatrix;
|
return invertedMatrix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ LuminanceSource::operator std::string() const
|
||||||
row = getRow(y, row);
|
row = getRow(y, row);
|
||||||
for (int x = 0; x < getWidth(); x++)
|
for (int x = 0; x < getWidth(); x++)
|
||||||
{
|
{
|
||||||
int luminance = row[x]; // & 0xFF;
|
int luminance = (*row)[x]; // & 0xFF;
|
||||||
char c;
|
char c;
|
||||||
if (luminance < 0x40)
|
if (luminance < 0x40)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <zxing/Result.h>
|
#include <zxing/Result.h>
|
||||||
|
|
||||||
using zxing::Result;
|
using zxing::Result;
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
using zxing::String;
|
using zxing::String;
|
||||||
using zxing::ResultPoint;
|
using zxing::ResultPoint;
|
||||||
|
|
|
@ -33,7 +33,7 @@ using std::vector;
|
||||||
using zxing::aztec::Detector;
|
using zxing::aztec::Detector;
|
||||||
using zxing::aztec::Point;
|
using zxing::aztec::Point;
|
||||||
using zxing::aztec::AztecDetectorResult;
|
using zxing::aztec::AztecDetectorResult;
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
using zxing::ResultPoint;
|
using zxing::ResultPoint;
|
||||||
using zxing::BitArray;
|
using zxing::BitArray;
|
||||||
|
|
|
@ -25,7 +25,7 @@ using zxing::BitArray;
|
||||||
|
|
||||||
|
|
||||||
// VC++
|
// VC++
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
|
|
||||||
namespace zxing {
|
namespace zxing {
|
||||||
|
|
|
@ -47,15 +47,15 @@ public:
|
||||||
int getSizeInBytes() const;
|
int getSizeInBytes() const;
|
||||||
|
|
||||||
bool get(int i) const {
|
bool get(int i) const {
|
||||||
return (bits[i / 32] & (1 << (i & 0x1F))) != 0;
|
return ((*bits)[i / 32] & (1 << (i & 0x1F))) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(int i) {
|
void set(int i) {
|
||||||
bits[i / 32] |= 1 << (i & 0x1F);
|
(*bits)[i / 32] |= 1 << (i & 0x1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flip(int i) {
|
void flip(int i) {
|
||||||
bits[i / 32] ^= 1 << (i & 0x1F);
|
(*bits)[i / 32] ^= 1 << (i & 0x1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNextSet(int from);
|
int getNextSet(int from);
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
|
|
||||||
static QSharedPointer<std::vector<int>> makeArray(int size) {
|
static QSharedPointer<std::vector<int>> makeArray(int size) {
|
||||||
return QSharedPointer<std::vector<int>>((size + 31) / 32);
|
return QSharedPointer<std::vector<int>>(new std::vector<int>((size + 31) / 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
void reverse();
|
void reverse();
|
||||||
|
|
|
@ -28,7 +28,7 @@ using std::ostringstream;
|
||||||
using zxing::BitMatrix;
|
using zxing::BitMatrix;
|
||||||
using zxing::BitArray;
|
using zxing::BitArray;
|
||||||
|
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
void BitMatrix::init(int width, int height) {
|
void BitMatrix::init(int width, int height) {
|
||||||
if (width < 1 || height < 1) {
|
if (width < 1 || height < 1) {
|
||||||
|
|
|
@ -46,12 +46,12 @@ public:
|
||||||
|
|
||||||
bool get(int x, int y) const {
|
bool get(int x, int y) const {
|
||||||
int offset = y * rowSize + (x >> 5);
|
int offset = y * rowSize + (x >> 5);
|
||||||
return ((((unsigned)bits[offset]) >> (x & 0x1f)) & 1) != 0;
|
return ((((unsigned)(*bits)[offset]) >> (x & 0x1f)) & 1) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set(int x, int y) {
|
void set(int x, int y) {
|
||||||
int offset = y * rowSize + (x >> 5);
|
int offset = y * rowSize + (x >> 5);
|
||||||
bits[offset] |= 1 << (x & 0x1f);
|
(*bits)[offset] |= 1 << (x & 0x1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void flip(int x, int y);
|
void flip(int x, int y);
|
||||||
|
|
|
@ -1,36 +1,36 @@
|
||||||
#include "Counted.h"
|
//#include "Counted.h"
|
||||||
|
|
||||||
namespace zxing {
|
//namespace zxing {
|
||||||
|
|
||||||
Counted::Counted() :
|
//Counted::Counted() :
|
||||||
count_(0)
|
// count_(0)
|
||||||
{
|
//{
|
||||||
}
|
//}
|
||||||
|
|
||||||
Counted::~Counted()
|
//Counted::~Counted()
|
||||||
{
|
//{
|
||||||
}
|
//}
|
||||||
|
|
||||||
Counted *Counted::retain()
|
//Counted *Counted::retain()
|
||||||
{
|
//{
|
||||||
count_++;
|
// count_++;
|
||||||
return this;
|
// return this;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void Counted::release()
|
//void Counted::release()
|
||||||
{
|
//{
|
||||||
count_--;
|
// count_--;
|
||||||
if (count_ == 0) {
|
// if (count_ == 0) {
|
||||||
count_ = 0xDEADF001;
|
// count_ = 0xDEADF001;
|
||||||
delete this;
|
// delete this;
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
size_t Counted::count() const
|
//size_t Counted::count() const
|
||||||
{
|
//{
|
||||||
return count_;
|
// return count_;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
|
@ -26,7 +26,7 @@ using namespace zxing;
|
||||||
|
|
||||||
DecoderResult::DecoderResult(QSharedPointer<std::vector<zxing::byte>> rawBytes,
|
DecoderResult::DecoderResult(QSharedPointer<std::vector<zxing::byte>> rawBytes,
|
||||||
QSharedPointer<String> text,
|
QSharedPointer<String> text,
|
||||||
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>> >& byteSegments,
|
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>>>>& byteSegments,
|
||||||
string const& ecLevel, string charSet) :
|
string const& ecLevel, string charSet) :
|
||||||
rawBytes_(rawBytes),
|
rawBytes_(rawBytes),
|
||||||
text_(text),
|
text_(text),
|
||||||
|
|
|
@ -32,14 +32,14 @@ class DecoderResult {
|
||||||
private:
|
private:
|
||||||
QSharedPointer<std::vector<zxing::byte>> rawBytes_;
|
QSharedPointer<std::vector<zxing::byte>> rawBytes_;
|
||||||
QSharedPointer<String> text_;
|
QSharedPointer<String> text_;
|
||||||
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>> > byteSegments_;
|
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>>>> byteSegments_;
|
||||||
std::string ecLevel_;
|
std::string ecLevel_;
|
||||||
std::string charSet_;
|
std::string charSet_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DecoderResult(QSharedPointer<std::vector<zxing::byte>> rawBytes,
|
DecoderResult(QSharedPointer<std::vector<zxing::byte>> rawBytes,
|
||||||
QSharedPointer<String> text,
|
QSharedPointer<String> text,
|
||||||
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>> >& byteSegments,
|
QSharedPointer<std::vector< QSharedPointer<std::vector<zxing::byte>>>>& byteSegments,
|
||||||
std::string const& ecLevel,
|
std::string const& ecLevel,
|
||||||
std::string charSet = "");
|
std::string charSet = "");
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
using zxing::Binarizer;
|
using zxing::Binarizer;
|
||||||
|
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::BitArray;
|
using zxing::BitArray;
|
||||||
using zxing::BitMatrix;
|
using zxing::BitMatrix;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <zxing/common/GreyscaleRotatedLuminanceSource.h>
|
#include <zxing/common/GreyscaleRotatedLuminanceSource.h>
|
||||||
#include <zxing/common/IllegalArgumentException.h>
|
#include <zxing/common/IllegalArgumentException.h>
|
||||||
|
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
using zxing::LuminanceSource;
|
using zxing::LuminanceSource;
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ GreyscaleRotatedLuminanceSource::getRow(int y, QSharedPointer<std::vector<zxing:
|
||||||
throw IllegalArgumentException("Requested row is outside the image.");
|
throw IllegalArgumentException("Requested row is outside the image.");
|
||||||
}
|
}
|
||||||
if (!row || row->size() < getWidth()) {
|
if (!row || row->size() < getWidth()) {
|
||||||
row = QSharedPointer<std::vector<zxing::byte>>(getWidth());
|
row.reset(new std::vector<zxing::byte>(getWidth()));
|
||||||
}
|
}
|
||||||
int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_));
|
int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_));
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -62,19 +62,19 @@ GreyscaleRotatedLuminanceSource::getRow(int y, QSharedPointer<std::vector<zxing:
|
||||||
<< y << endl;
|
<< y << endl;
|
||||||
}
|
}
|
||||||
for (int x = 0; x < getWidth(); x++) {
|
for (int x = 0; x < getWidth(); x++) {
|
||||||
row[x] = greyData_[offset];
|
(*row)[x] = (*greyData_)[offset];
|
||||||
offset += dataWidth_;
|
offset += dataWidth_;
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<std::vector<zxing::byte>> GreyscaleRotatedLuminanceSource::getMatrix() const {
|
QSharedPointer<std::vector<zxing::byte>> GreyscaleRotatedLuminanceSource::getMatrix() const {
|
||||||
QSharedPointer<std::vector<zxing::byte>> result (getWidth() * getHeight());
|
QSharedPointer<std::vector<zxing::byte>> result (new std::vector<zxing::byte>(getWidth() * getHeight()));
|
||||||
for (int y = 0; y < getHeight(); y++) {
|
for (int y = 0; y < getHeight(); y++) {
|
||||||
zxing::byte* row = &result[y * getWidth()];
|
zxing::byte* row = &(*result)[y * getWidth()];
|
||||||
int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_));
|
int offset = (left_ * dataWidth_) + (dataWidth_ - 1 - (y + top_));
|
||||||
for (int x = 0; x < getWidth(); x++) {
|
for (int x = 0; x < getWidth(); x++) {
|
||||||
row[x] = greyData_[offset];
|
row[x] = (*greyData_)[offset];
|
||||||
offset += dataWidth_;
|
offset += dataWidth_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ HybridBinarizer::calculateThresholdForBlock(QSharedPointer<std::vector<zxing::by
|
||||||
int top = cap(y, 2, subHeight - 3);
|
int top = cap(y, 2, subHeight - 3);
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (int z = -2; z <= 2; z++) {
|
for (int z = -2; z <= 2; z++) {
|
||||||
int *blackRow = &blackPoints[(top + z) * subWidth];
|
int *blackRow = &(*blackPoints)[(top + z) * subWidth];
|
||||||
sum += blackRow[left - 2];
|
sum += blackRow[left - 2];
|
||||||
sum += blackRow[left - 1];
|
sum += blackRow[left - 1];
|
||||||
sum += blackRow[left];
|
sum += blackRow[left];
|
||||||
|
@ -140,7 +140,7 @@ void HybridBinarizer::thresholdBlock(QSharedPointer<std::vector<zxing::byte>> lu
|
||||||
y < BLOCK_SIZE;
|
y < BLOCK_SIZE;
|
||||||
y++, offset += stride) {
|
y++, offset += stride) {
|
||||||
for (int x = 0; x < BLOCK_SIZE; x++) {
|
for (int x = 0; x < BLOCK_SIZE; x++) {
|
||||||
int pixel = luminances[offset + x] & 0xff;
|
int pixel = (*luminances)[offset + x] & 0xff;
|
||||||
if (pixel <= threshold) {
|
if (pixel <= threshold) {
|
||||||
matrix->set(xoffset + x, yoffset + y);
|
matrix->set(xoffset + x, yoffset + y);
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,9 @@ void HybridBinarizer::thresholdBlock(QSharedPointer<std::vector<zxing::byte>> lu
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
inline int getBlackPointFromNeighbors(QSharedPointer<std::vector<int>> blackPoints, int subWidth, int x, int y) {
|
inline int getBlackPointFromNeighbors(QSharedPointer<std::vector<int>> blackPoints, int subWidth, int x, int y) {
|
||||||
return (blackPoints[(y-1)*subWidth+x] +
|
return ((*blackPoints)[(y-1)*subWidth+x] +
|
||||||
2*blackPoints[y*subWidth+x-1] +
|
2*(*blackPoints)[y*subWidth+x-1] +
|
||||||
blackPoints[(y-1)*subWidth+x-1]) >> 2;
|
(*blackPoints)[(y-1)*subWidth+x-1]) >> 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
|
||||||
int height) {
|
int height) {
|
||||||
const int minDynamicRange = 24;
|
const int minDynamicRange = 24;
|
||||||
|
|
||||||
QSharedPointer<std::vector<int>> blackPoints (subHeight * subWidth);
|
QSharedPointer<std::vector<int>> blackPoints (new std::vector<int>(subHeight * subWidth));
|
||||||
for (int y = 0; y < subHeight; y++) {
|
for (int y = 0; y < subHeight; y++) {
|
||||||
int yoffset = y << BLOCK_SIZE_POWER;
|
int yoffset = y << BLOCK_SIZE_POWER;
|
||||||
int maxYOffset = height - BLOCK_SIZE;
|
int maxYOffset = height - BLOCK_SIZE;
|
||||||
|
@ -184,7 +184,7 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
|
||||||
yy < BLOCK_SIZE;
|
yy < BLOCK_SIZE;
|
||||||
yy++, offset += width) {
|
yy++, offset += width) {
|
||||||
for (int xx = 0; xx < BLOCK_SIZE; xx++) {
|
for (int xx = 0; xx < BLOCK_SIZE; xx++) {
|
||||||
int pixel = luminances[offset + xx] & 0xFF;
|
int pixel = (*luminances)[offset + xx] & 0xFF;
|
||||||
sum += pixel;
|
sum += pixel;
|
||||||
// still looking for good contrast
|
// still looking for good contrast
|
||||||
if (pixel < min) {
|
if (pixel < min) {
|
||||||
|
@ -200,8 +200,8 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
|
||||||
// finish the rest of the rows quickly
|
// finish the rest of the rows quickly
|
||||||
for (yy++, offset += width; yy < BLOCK_SIZE; yy++, offset += width) {
|
for (yy++, offset += width; yy < BLOCK_SIZE; yy++, offset += width) {
|
||||||
for (int xx = 0; xx < BLOCK_SIZE; xx += 2) {
|
for (int xx = 0; xx < BLOCK_SIZE; xx += 2) {
|
||||||
sum += luminances[offset + xx] & 0xFF;
|
sum += (*luminances)[offset + xx] & 0xFF;
|
||||||
sum += luminances[offset + xx + 1] & 0xFF;
|
sum += (*luminances)[offset + xx + 1] & 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ QSharedPointer<std::vector<int>> HybridBinarizer::calculateBlackPoints(QSharedPo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blackPoints[y * subWidth + x] = average;
|
(*blackPoints)[y * subWidth + x] = average;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return blackPoints;
|
return blackPoints;
|
||||||
|
|
|
@ -46,8 +46,8 @@ QSharedPointer<PerspectiveTransform> PerspectiveTransform::squareToQuadrilateral
|
||||||
float dy3 = y0 - y1 + y2 - y3;
|
float dy3 = y0 - y1 + y2 - y3;
|
||||||
QSharedPointer<PerspectiveTransform> result;
|
QSharedPointer<PerspectiveTransform> result;
|
||||||
if (dx3 == 0.0f && dy3 == 0.0f) {
|
if (dx3 == 0.0f && dy3 == 0.0f) {
|
||||||
result = new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0f,
|
result.reset(new PerspectiveTransform(x1 - x0, x2 - x1, x0, y1 - y0, y2 - y1, y0, 0.0f,
|
||||||
0.0f, 1.0f);
|
0.0f, 1.0f));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -58,8 +58,8 @@ QSharedPointer<PerspectiveTransform> PerspectiveTransform::squareToQuadrilateral
|
||||||
float denominator = dx1 * dy2 - dx2 * dy1;
|
float denominator = dx1 * dy2 - dx2 * dy1;
|
||||||
float a13 = (dx3 * dy2 - dx2 * dy3) / denominator;
|
float a13 = (dx3 * dy2 - dx2 * dy3) / denominator;
|
||||||
float a23 = (dx1 * dy3 - dx3 * dy1) / denominator;
|
float a23 = (dx1 * dy3 - dx3 * dy1) / denominator;
|
||||||
result = new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0
|
result.reset(new PerspectiveTransform(x1 - x0 + a13 * x1, x3 - x0 + a23 * x3, x0, y1 - y0
|
||||||
+ a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0f);
|
+ a13 * y1, y3 - y0 + a23 * y3, y0, a13, a23, 1.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using zxing::String;
|
using zxing::String;
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
String::String(const std::string &text) :
|
String::String(const std::string &text) :
|
||||||
text_(text) {
|
text_(text) {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::ResultPoint;
|
using zxing::ResultPoint;
|
||||||
using zxing::TwoInts;
|
using zxing::TwoInts;
|
||||||
using zxing::MonochromeRectangleDetector;
|
using zxing::MonochromeRectangleDetector;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::ResultPoint;
|
using zxing::ResultPoint;
|
||||||
using zxing::WhiteRectangleDetector;
|
using zxing::WhiteRectangleDetector;
|
||||||
using zxing::common::detector::MathUtils;
|
using zxing::common::detector::MathUtils;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
using zxing::GenericGF;
|
using zxing::GenericGF;
|
||||||
using zxing::GenericGFPoly;
|
using zxing::GenericGFPoly;
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
QSharedPointer<GenericGF> GenericGF::AZTEC_DATA_12(new GenericGF(0x1069, 4096, 1));
|
QSharedPointer<GenericGF> GenericGF::AZTEC_DATA_12(new GenericGF(0x1069, 4096, 1));
|
||||||
QSharedPointer<GenericGF> GenericGF::AZTEC_DATA_10(new GenericGF(0x409, 1024, 1));
|
QSharedPointer<GenericGF> GenericGF::AZTEC_DATA_10(new GenericGF(0x409, 1024, 1));
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
using zxing::GenericGFPoly;
|
using zxing::GenericGFPoly;
|
||||||
|
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
// VC++
|
// VC++
|
||||||
using zxing::GenericGF;
|
using zxing::GenericGF;
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <zxing/IllegalStateException.h>
|
#include <zxing/IllegalStateException.h>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
using zxing::ReedSolomonDecoder;
|
using zxing::ReedSolomonDecoder;
|
||||||
using zxing::GenericGFPoly;
|
using zxing::GenericGFPoly;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <zxing/ChecksumException.h>
|
#include <zxing/ChecksumException.h>
|
||||||
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
#include <zxing/common/reedsolomon/ReedSolomonException.h>
|
||||||
|
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::DecoderResult;
|
using zxing::DecoderResult;
|
||||||
//using zxing::datamatrix::Decoder;
|
//using zxing::datamatrix::Decoder;
|
||||||
//using zxing::datamatrix::DataBlock;
|
//using zxing::datamatrix::DataBlock;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using std::abs;
|
using std::abs;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::BitMatrix;
|
using zxing::BitMatrix;
|
||||||
using zxing::ResultPoint;
|
using zxing::ResultPoint;
|
||||||
using zxing::DetectorResult;
|
using zxing::DetectorResult;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <zxing/ResultPoint.h>
|
#include <zxing/ResultPoint.h>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::Result;
|
using zxing::Result;
|
||||||
using zxing::multi::GenericMultipleBarcodeReader;
|
using zxing::multi::GenericMultipleBarcodeReader;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ using std::abs;
|
||||||
using std::min;
|
using std::min;
|
||||||
using std::sort;
|
using std::sort;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::BitMatrix;
|
using zxing::BitMatrix;
|
||||||
using zxing::ReaderException;
|
using zxing::ReaderException;
|
||||||
using zxing::qrcode::FinderPattern;
|
using zxing::qrcode::FinderPattern;
|
||||||
|
|
|
@ -31,7 +31,7 @@ using std::string;
|
||||||
using zxing::NotFoundException;
|
using zxing::NotFoundException;
|
||||||
using zxing::FormatException;
|
using zxing::FormatException;
|
||||||
using zxing::ChecksumException;
|
using zxing::ChecksumException;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::Result;
|
using zxing::Result;
|
||||||
using zxing::oned::CodaBarReader;
|
using zxing::oned::CodaBarReader;
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ using std::string;
|
||||||
using zxing::NotFoundException;
|
using zxing::NotFoundException;
|
||||||
using zxing::FormatException;
|
using zxing::FormatException;
|
||||||
using zxing::ChecksumException;
|
using zxing::ChecksumException;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::Result;
|
using zxing::Result;
|
||||||
using zxing::oned::Code128Reader;
|
using zxing::oned::Code128Reader;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::Result;
|
using zxing::Result;
|
||||||
using zxing::String;
|
using zxing::String;
|
||||||
using zxing::NotFoundException;
|
using zxing::NotFoundException;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using std::string;
|
using std::string;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::Result;
|
using zxing::Result;
|
||||||
using zxing::String;
|
using zxing::String;
|
||||||
using zxing::NotFoundException;
|
using zxing::NotFoundException;
|
||||||
|
|
|
@ -22,7 +22,7 @@ using std::vector;
|
||||||
using zxing::oned::EAN8Reader;
|
using zxing::oned::EAN8Reader;
|
||||||
|
|
||||||
// VC++
|
// VC++
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::BitArray;
|
using zxing::BitArray;
|
||||||
|
|
||||||
EAN8Reader::EAN8Reader() : decodeMiddleCounters(4, 0) {}
|
EAN8Reader::EAN8Reader() : decodeMiddleCounters(4, 0) {}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <zxing/ReaderException.h>
|
#include <zxing/ReaderException.h>
|
||||||
|
|
||||||
using zxing::oned::UPCAReader;
|
using zxing::oned::UPCAReader;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::Result;
|
using zxing::Result;
|
||||||
|
|
||||||
// VC++
|
// VC++
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::String;
|
using zxing::String;
|
||||||
using zxing::oned::UPCEReader;
|
using zxing::oned::UPCEReader;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ using zxing::pdf417::decoder::BitMatrixParser;
|
||||||
|
|
||||||
// VC++
|
// VC++
|
||||||
|
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::BitMatrix;
|
using zxing::BitMatrix;
|
||||||
|
|
||||||
const int BitMatrixParser::MAX_ROWS = 90;
|
const int BitMatrixParser::MAX_ROWS = 90;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
using std::string;
|
using std::string;
|
||||||
using zxing::pdf417::DecodedBitStreamParser;
|
using zxing::pdf417::DecodedBitStreamParser;
|
||||||
|
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::DecoderResult;
|
using zxing::DecoderResult;
|
||||||
using zxing::String;
|
using zxing::String;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
using zxing::pdf417::decoder::Decoder;
|
using zxing::pdf417::decoder::Decoder;
|
||||||
using zxing::pdf417::decoder::ec::ErrorCorrection;
|
using zxing::pdf417::decoder::ec::ErrorCorrection;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::DecoderResult;
|
using zxing::DecoderResult;
|
||||||
|
|
||||||
// VC++
|
// VC++
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <zxing/pdf417/decoder/ec/ModulusGF.h>
|
#include <zxing/pdf417/decoder/ec/ModulusGF.h>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
using zxing::pdf417::decoder::ec::ErrorCorrection;
|
using zxing::pdf417::decoder::ec::ErrorCorrection;
|
||||||
using zxing::pdf417::decoder::ec::ModulusPoly;
|
using zxing::pdf417::decoder::ec::ModulusPoly;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <zxing/pdf417/decoder/ec/ModulusGF.h>
|
#include <zxing/pdf417/decoder/ec/ModulusGF.h>
|
||||||
#include <zxing/pdf417/decoder/ec/ModulusPoly.h>
|
#include <zxing/pdf417/decoder/ec/ModulusPoly.h>
|
||||||
|
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::pdf417::decoder::ec::ModulusGF;
|
using zxing::pdf417::decoder::ec::ModulusGF;
|
||||||
using zxing::pdf417::decoder::ec::ModulusPoly;
|
using zxing::pdf417::decoder::ec::ModulusPoly;
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ using std::min;
|
||||||
using std::abs;
|
using std::abs;
|
||||||
using zxing::pdf417::detector::LinesSampler;
|
using zxing::pdf417::detector::LinesSampler;
|
||||||
using zxing::pdf417::decoder::BitMatrixParser;
|
using zxing::pdf417::decoder::BitMatrixParser;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::BitMatrix;
|
using zxing::BitMatrix;
|
||||||
using zxing::NotFoundException;
|
using zxing::NotFoundException;
|
||||||
using zxing::Point;
|
using zxing::Point;
|
||||||
|
|
|
@ -28,7 +28,7 @@ using std::numeric_limits;
|
||||||
using zxing::pdf417::detector::Detector;
|
using zxing::pdf417::detector::Detector;
|
||||||
using zxing::common::detector::Math;
|
using zxing::common::detector::Math;
|
||||||
using zxing::common::detector::MathUtils;
|
using zxing::common::detector::MathUtils;
|
||||||
using zxing::Ref;
|
|
||||||
|
|
||||||
using zxing::DetectorResult;
|
using zxing::DetectorResult;
|
||||||
using zxing::ResultPoint;
|
using zxing::ResultPoint;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <zxing/qrcode/detector/AlignmentPattern.h>
|
#include <zxing/qrcode/detector/AlignmentPattern.h>
|
||||||
|
|
||||||
using std::abs;
|
using std::abs;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::qrcode::AlignmentPattern;
|
using zxing::qrcode::AlignmentPattern;
|
||||||
|
|
||||||
AlignmentPattern::AlignmentPattern(float posX, float posY, float estimatedModuleSize) :
|
AlignmentPattern::AlignmentPattern(float posX, float posY, float estimatedModuleSize) :
|
||||||
|
|
|
@ -37,7 +37,7 @@ using std::abs;
|
||||||
using std::min;
|
using std::min;
|
||||||
using std::max;
|
using std::max;
|
||||||
using zxing::qrcode::Detector;
|
using zxing::qrcode::Detector;
|
||||||
using zxing::Ref;
|
|
||||||
using zxing::BitMatrix;
|
using zxing::BitMatrix;
|
||||||
using zxing::ResultPointCallback;
|
using zxing::ResultPointCallback;
|
||||||
using zxing::DetectorResult;
|
using zxing::DetectorResult;
|
||||||
|
|
|
@ -133,7 +133,7 @@ protected:
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
|
|
||||||
for (size_t i = 0; i < expected.size(); i++) {
|
for (size_t i = 0; i < expected.size(); i++) {
|
||||||
if (expected[i] != received[i]) {
|
if (expected[i] != (*received)[i]) {
|
||||||
qDebug() << QString::fromStdString(message) << ". Mismatch at " << QString::number(i) /*<< ". Expected " + arrayToString(expected) + ", got " +
|
qDebug() << QString::fromStdString(message) << ". Mismatch at " << QString::number(i) /*<< ". Expected " + arrayToString(expected) + ", got " +
|
||||||
arrayToString(Arrays.copyOf(received, expected.length)))*/;
|
arrayToString(Arrays.copyOf(received, expected.length)))*/;
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
|
@ -145,9 +145,9 @@ protected:
|
||||||
const std::vector<zxing::byte> &expected,
|
const std::vector<zxing::byte> &expected,
|
||||||
const QSharedPointer<std::vector<int>> &received)
|
const QSharedPointer<std::vector<int>> &received)
|
||||||
{
|
{
|
||||||
QSharedPointer<std::vector<zxing::byte>> received_copy(received->size());
|
QSharedPointer<std::vector<zxing::byte>> received_copy(new std::vector<zxing::byte>(received->size()));
|
||||||
for(int i=0; i<received_copy->size(); i++)
|
for(int i=0; i<received_copy->size(); i++)
|
||||||
received_copy[i] = received[i];
|
(*received_copy)[i] = (*received)[i];
|
||||||
|
|
||||||
assertDataEquals(message, expected, received_copy);
|
assertDataEquals(message, expected, received_copy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ void QRCodeTests::test()
|
||||||
|
|
||||||
// Set the matrix.
|
// Set the matrix.
|
||||||
qrCode.setMatrix(matrix);
|
qrCode.setMatrix(matrix);
|
||||||
assertSame(matrix, qrCode.getMatrix());
|
assertSame(matrix.data(), qrCode.getMatrix().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QRCodeTests::testToString1() {
|
void QRCodeTests::testToString1() {
|
||||||
|
|
Loading…
Reference in New Issue