mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2026-02-01 02:25:13 -06:00
feat: Add document scanner package
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#include "conversion_utils.hpp"
|
||||
using namespace cv;
|
||||
uint8_t * ConversionUtils::matrix_to_bytearray(Mat mat)
|
||||
{
|
||||
int size = mat.total() * mat.elemSize();
|
||||
uint8_t *bytes = (uint8_t *)malloc(size);
|
||||
std::memcpy(bytes, mat.data, size * sizeof(uint8_t));
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Mat ConversionUtils::bytearray_to_matrix(uint8_t *bytes, int byteCount)
|
||||
{
|
||||
std::vector<uint8_t> buf(bytes, bytes + byteCount);
|
||||
return imdecode(buf, IMREAD_COLOR);
|
||||
}
|
||||
Reference in New Issue
Block a user