This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

*/

석촌호수 루미나리에 축제

석촌호수에서 10/28부터 23년 1월 31일까지 석촌호수의 가을과 겨울 그리고 루미나리에 빛 축제가 열린다.

시작하기 하루 전인데 테스트인지 일부 조명이 들어와 있다.







조명이 안들와 있는 것이  많았다. 주말에 다시 한번.


더보기 

 - 석촌호수

 - 루미나리에


러버덕 뒷태

석촌호수 동호에서 러버덕의 뒷태를 보았다. ^^


석촌호수 다리 중간에서 바라본 러버덕

러버덕 다른 사진

초대형 러버덕(Rubber Duck)

잠실 석촌호수 동호에 초대형 고무 오리가 떴다. 

9월 30일 




러버덕 다른 사진

#Rubber Duck, #러버덕, #석촌호수, #롯데월드

석촌호수에서 본 롯데타워

주말 늦은 밤에 석촌호수에서 바라본 롯데타워 태풍이 올라오기 전이라 밤 하늘이 맑다.
호수에 비친 롯데타워도 볼만하다.
 

하늘

골목사이에 비친 하늘

Python으로 QR Code Reader 만들기

개발 환경

  • Windows 10
  • VisualStudio Code
  • Python : 3.7.9

QR Code를 읽을 수 있는 프로그램을 찾다가 아래 참조에서 찾은 코드를 소개 한다. 기존 개발 환경 VS Code에서 바로 테스트 할 수 있다. 

필요한 파이썬 라이브러리

  • OpenCV : 이미지 처리, 컴퓨터 비젼 및 기계 학습 라이브러리
  • Numpy : 행렬이나 일반적으로 대규모 다차원 배열을 쉽게 처리 할 수 있도록 지원하는  라이브러리
  • pyzbar : 주어진 이미지에서 Bar code, QR Code를 읽는다. EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 및 QR Code를 지원

라이브러리 설치

  • OpenCV 설치
   > pip install opencv-python                                          

       혹은  

   > pip install opencv-contrib-python                                  
  •  numpy 설치
   > pip install numpy                                                  
  • pyzbar 설치

       > pip install pyzbar                                                 

    코드

    • 필요 라이브러리 import
    • import cv2
      import numpy as np
      from pyzbar.pyzbar import decode

      • 카메라로부터 이미지 캡쳐 
      • cap = cv2.VideoCapture(0)
        while True:
            ret, frame = cap.read()
            decoder(frame)
            cv2.imshow('Image', frame)
            code = cv2.waitKey(10)
            if code == ord('q'):
                break
        •  주어진 이미지로부터 QR Code를 얻는 함수 
        • def decoder(image):
              gray_img = cv2.cvtColor(image,0)
              barcode = decode(gray_img)

              for obj in barcode:
                  points = obj.polygon
                  (x,y,w,h) = obj.rect
                  pts = np.array(points, np.int32)
                  pts = pts.reshape((-1, 1, 2))
                  cv2.polylines(image, [pts], True, (0, 255, 0), 3)

                  barcodeData = obj.data.decode("utf-8")
                  barcodeType = obj.type
                  string = "Data " + str(barcodeData) + " | Type " + str(barcodeType)
                 
                  cv2.putText(frame, string, (x,y), cv2.FONT_HERSHEY_SIMPLEX,0.8,(255,0,0), 2)
                  print("Barcode: "+barcodeData +" | Type: "+barcodeType)

          •  최종 코드  
          • cap = cv2.VideoCapture(0)
            while True:
            import cv2
            import numpy as np
            from pyzbar.pyzbar import decode

            def decoder(image):
                gray_img = cv2.cvtColor(image,0)
                barcode = decode(gray_img)

                for obj in barcode:
                    points = obj.polygon
                    (x,y,w,h) = obj.rect
                    pts = np.array(points, np.int32)
                    pts = pts.reshape((-1, 1, 2))
                    cv2.polylines(image, [pts], True, (0, 255, 0), 3)

                    barcodeData = obj.data.decode("utf-8")
                    barcodeType = obj.type
                    string = "Data " + str(barcodeData) + " | Type " + str(barcodeType)
                   
                    cv2.putText(frame, string, (x,y), cv2.FONT_HERSHEY_SIMPLEX,0.8,(255,0,0), 2)
                    print("Barcode: "+barcodeData +" | Type: "+barcodeType)

            cap = cv2.VideoCapture(0)
            while True:
                ret, frame = cap.read()
                decoder(frame)
                cv2.imshow('Image', frame)
                code = cv2.waitKey(10)
                if code == ord('q'):
                    break

          참조 

          VS Code 에서 Python OpenCV 설치하기


          VS Code TERMINAL 창에서 "pip install opencv-contrib-python" 을 입력하면 설치 완료



          참고