Skip to content

GS1_128 initiative: air, water, and barcodes shall be free #1234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 of 13 tasks
stonebig opened this issue May 28, 2023 · 7 comments
Open
5 of 13 tasks

GS1_128 initiative: air, water, and barcodes shall be free #1234

stonebig opened this issue May 28, 2023 · 7 comments

Comments

@stonebig
Copy link
Contributor

stonebig commented May 28, 2023

Battle-Plan

  • phase1: the Barcode,
    • Proof-of-Concept Notebook that we can go till there : we can generate a full GS1_128 Barcode on Jupyterlite
    • workaround till 'true' GS1_128: legend and FNC1
    • QRcode basic writer, via qrcode package (works on jupyterlite)
    • QRcode basic camera reader, via opencv-python (but camera capture may need a trick for Jupyterlite)
    • provide said Proof-of-Concept Notebooks in WinPython, with Simple Code
  • phase2: more simple integration
    • QRcode GS1_128: writing
    • Control Key checker,
    • SSCC and GTIN generators
    • API SSCC Generators
  • phase3: more versatility industry 4.0
    • QrCode: reading back GS1
    • Datamatrix: reading back GS1
  • phase4: printing simply a full label
    • simple layout system... how to do it simple... chatGPT and eco-system to the rescue ?
    • WebApp
@stonebig
Copy link
Contributor Author

stonebig commented May 28, 2023

hum:

  • a barcode solution can work even in JupyterLite: python-barcode
  • GS1-128 in python-barcode:
    - [x] legend not to the standard, miss the '(00)' Application Identifiers highlight, to workaround
    - [x] legend not as FailSafe as it could: misses the spacing on (00), for when things are to retype by handt, to workaround
    - [ ] toolchain depend of a "file" step ?? documentation not clear on how to avoide this, help appreciated
    - [ ] FNC1 seems pre-fixed in front of the string and sent to Code128, even if it's already pre-fixed... u'\xf1'
    - [ ] propose upstream to provide patches if interested and no-one active on this
  • check python-barcode vs ean128 grand zebu sensei,
  • re-program workaround in a more "readable/universal" way: simple readable Python

@stonebig
Copy link
Contributor Author

stonebig commented May 28, 2023

Phase1 progress:

  • works on Jupyterlite (even with the file step...)
import micropip
await micropip.install("python-barcode")
import barcode
barcode.PROVIDED_BARCODES
from barcode.writer import ImageWriter
gs1_128 = barcode.get_barcode_class('gs1_128')
from IPython.display import SVG, display
gs1_128 = barcode.get_barcode_class('gs1_128')
my_gs1 = gs1_128('00006141411234567890', writer=ImageWriter)
fullname = my_gs1.save('gs1_barcode')
display(SVG(fullname))

image

  • a true GS1_128 legend
    image

@stonebig stonebig changed the title EAN128 GS1_128 May 28, 2023
@stonebig stonebig changed the title GS1_128 GS1_128 initiative May 29, 2023
@stonebig stonebig changed the title GS1_128 initiative GS1_128 initiative: air, water, and barcodes shall be free May 29, 2023
@stonebig
Copy link
Contributor Author

stonebig commented May 29, 2023

phase1: QRcode , using awesome stupid simple tutorial from https://www.youtube.com/watch?v=iAAKghEiUjY&t=65s

  • QRcode writer: use qrcode
# writing QRcode "de base"


# check jupyterlite ok
import micropip
await micropip.install("qrcode")

import qrcode
from IPython.display import Image, display
img = qrcode.make('artisou à croûte')
img.save("test.png")
display(Image(filename='test.png'))

image

  • QRcode reader: use opencv-python, but camera taking requires massage on Jupyterlite (but panel can do, so there is a way)
# reading QRcode
# import the opencv library
import cv2

# define a video capture object
vid = cv2.VideoCapture(0)

detector = cv2.QRCodeDetector()

while True:

    # Capture the video frame by frame
    ret, frame = vid.read()

    data, bbox, straight_qrcode = detector.detectAndDecode(frame)
    if len(data) > 0:
        print(data)

    # Display the resulting frame
    cv2.imshow('frame', frame)

    # the 'q' button is set as the
    # quitting button you may use any
    # desired button of your choice
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# After the loop release the cap object
vid.release()
# Destroy all the windows
cv2.destroyAllWindows()

image

@stonebig
Copy link
Contributor Author

stonebig commented May 29, 2023

phase2:

  • prefixes
    image

  • Datamatrix pre-work:

    • 'xf1' for Code128 is to deplace per ']d2' for Datamatrix

image

image

  • QRcode prework:
    • 'xf1' is to replace per ']Q3' for QRcode
      image

image

image
image

norm QR_standard

https://www.swisseduc.ch/informatik/theoretische_informatik/qr_codes/docs/qr_standard.pdf
image

  • QRcode augmented... what is that ?

image

image
image

image

@stonebig
Copy link
Contributor Author

stonebig commented May 29, 2023

phase 2:

image

shall be (01)00799439956618(200)//https:barcodeaustralia.com

@stonebig
Copy link
Contributor Author

phase3:

import numpy as np
import cv2
from pylibdmtx import pylibdmtx

if __name__ == '__main__':

    image = cv2.imread('datamatrix_sample.png', cv2.IMREAD_UNCHANGED);
    gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    ret,thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)

    msg = pylibdmtx.decode(thresh)
    print(msg)

@stonebig
Copy link
Contributor Author

this blows my mind... can we dream to do it ?

image

@stonebig stonebig added the Experiment Experiment label May 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant