Skip to content

Commit

Permalink
decode inverted qr codes by inverting image color (#72) (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyTheCo authored Feb 18, 2024
1 parent 4e96a58 commit e7483b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 0 additions & 1 deletion QrDec/include/qrcodedec.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#include<opencv2/opencv.hpp>
#include <opencv2/objdetect.hpp>
#include<string>

Expand Down
5 changes: 5 additions & 0 deletions QrDec/qrcodedec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
std::string QRDecoder::decode_grey(unsigned char* img,int rows ,int cols)
{
cv::Mat greyImg = cv::Mat(rows,cols, CV_8UC1, img);
const auto str=detectAndDecode(greyImg);
if(str!="")
return str;
cv::bitwise_not(greyImg,greyImg);

return detectAndDecode(greyImg);
}

Expand Down

0 comments on commit e7483b6

Please sign in to comment.