Skip to content

Commit

Permalink
fix bug: convert gray images (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
oneLOH authored Jun 7, 2024
1 parent 1cbed85 commit ee84b59
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/tag/tag_extract.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ tag_extract(std::string image_dir) {

for (auto &image_name : image_vec) {
std::string img_path = image_dir + image_name;
cv::Mat frame, gray;
frame = cv::imread(img_path.c_str(), cv::IMREAD_IGNORE_ORIENTATION);
cv::cvtColor(frame, gray, cv::COLOR_BGR2GRAY);
cv::Mat image, gray;
image = cv::imread(img_path.c_str(), cv::IMREAD_IGNORE_ORIENTATION);
if (image.type() != CV_8UC1) {
cv::cvtColor(image, gray, cv::COLOR_RGB2GRAY);
} else {
gray = image;
}

image_u8_t im = {.width = gray.cols,
.height = gray.rows,
.stride = gray.cols,
Expand Down

0 comments on commit ee84b59

Please sign in to comment.