Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
yushulx committed Dec 19, 2024
1 parent 77a9430 commit 1c1e04e
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions litecam/examples/barcode/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,30 @@ int main()
0, 0);
CCapturedResult *result = cvr->Capture(&data, "");

CDecodedBarcodesResult *barcodeResult = result->GetDecodedBarcodesResult();
if (barcodeResult)
if (result)
{
int count = barcodeResult->GetItemsCount();
for (int i = 0; i < count; i++)
CDecodedBarcodesResult *barcodeResult = result->GetDecodedBarcodesResult();
if (barcodeResult)
{
const CBarcodeResultItem *barcodeResultItem = barcodeResult->GetItem(i);
CPoint *points = barcodeResultItem->GetLocation().points;

std::vector<std::pair<int, int>> corners = {
{points[0][0], points[0][1]},
{points[1][0], points[1][1]},
{points[2][0], points[2][1]},
{points[3][0], points[3][1]}};

window.DrawContour(corners);

window.DrawText(barcodeResultItem->GetText(), points[0][0], points[0][1], 24, textColor);
int count = barcodeResult->GetItemsCount();
for (int i = 0; i < count; i++)
{
const CBarcodeResultItem *barcodeResultItem = barcodeResult->GetItem(i);
CPoint *points = barcodeResultItem->GetLocation().points;

std::vector<std::pair<int, int>> corners = {
{points[0][0], points[0][1]},
{points[1][0], points[1][1]},
{points[2][0], points[2][1]},
{points[3][0], points[3][1]}};

window.DrawContour(corners);

window.DrawText(barcodeResultItem->GetText(), points[0][0], points[0][1], 24, textColor);
}
}

result->Release();
}
}

Expand Down

0 comments on commit 1c1e04e

Please sign in to comment.