Skip to content

Commit

Permalink
EXAMPLE: Encode and decode QR codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed May 23, 2024
1 parent 62c09d2 commit f902237
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:

- name: Install Rebol for extension test
uses: oldes/install-rebol@v3.17.0
with:
product: Bulk # used `resize` in tests

- name: Test extension
run: ./rebol3.exe test.r3
Expand Down Expand Up @@ -72,6 +74,8 @@ jobs:
- name: Install Rebol for extension test
uses: oldes/install-rebol@v3.17.0
with:
product: Bulk # used `resize` in tests

- name: Test extension
run: ./rebol3 test.r3
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

[![Rebol-OpenCV CI](https://github.com/Oldes/Rebol-OpenCV/actions/workflows/main.yml/badge.svg)](https://github.com/Oldes/Rebol-OpenCV/actions/workflows/main.yml)
[![Gitter](https://badges.gitter.im/rebol3/community.svg)](https://app.gitter.im/#/room/#Rebol3:gitter.im)

Expand Down Expand Up @@ -412,6 +413,23 @@ with cv [
]
```

### Encode and decode QR codes

```rebol
with cv [
mat: qrcode-encode "Hello Rebol, hello OpenCV!"
mat: resize/with :mat 600% INTER_NEAREST
;; display the result...
imshow :mat
waitKey 0
destroyAllWindows
;; save as PNG image...
imwrite %tmp/test-qrcode.png :mat
;; decode QRCode from file:
probe qrcode-decode %tmp/test-qrcode.png
]
```


* * * *
This file was generated using [examples.r3](examples.r3) script.
20 changes: 19 additions & 1 deletion examples.r3
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,25 @@ example "Computing absolute difference between 2 video frames" {
]
```
}


;---------------------------------------------------------------------------------------

example "Encode and decode QR codes" {
```rebol
with cv [
mat: qrcode-encode "Hello Rebol, hello OpenCV!"
mat: resize/with :mat 600% INTER_NEAREST
;; display the result...
imshow :mat
waitKey 0
destroyAllWindows
;; save as PNG image...
imwrite %tmp/test-qrcode.png :mat
;; decode QRCode from file:
probe qrcode-decode %tmp/test-qrcode.png
]
```
}

;---------------------------------------------------------------------------------------
] ; end of examples block
Expand Down
1 change: 0 additions & 1 deletion test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,4 @@ prin "From image: "
probe cv/qrcode-decode img

prin "From file: "

probe cv/qrcode-decode %tmp/qrcode.png

0 comments on commit f902237

Please sign in to comment.