• Foydalanilgan internet saytlar
  • O'zbekiston respublikasi raqamli texnologiyalar vazirligi muhammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti




    Download 1,32 Mb.
    bet15/15
    Sana20.05.2024
    Hajmi1,32 Mb.
    #246844
    1   ...   7   8   9   10   11   12   13   14   15
    Bog'liq
    SHAXZOD (induvidual loyiha 2)

    Foydalanilgan adabiyotlar:

    1. Simões, J., & Ribeiro, R. (2017). A Survey on Text Detection and Extraction in Natural Scenes. Journal of Imaging, 3(3), 40. doi:10.3390/jimaging3030040


    2. Mishra, A., Alahari, K., & Jawahar, C. V. (2012). Scene Text Recognition using Higher Order Language Priors. In Proceedings of the European Conference on Computer Vision (ECCV) (pp. 548-562). Springer.
    3. Wang, K., Babenko, B., & Belongie, S. (2011). End-to-end Scene Text Recognition. In Proceedings of the IEEE International Conference on Computer Vision (ICCV) (pp. 1457-1464). IEEE.
    4. Liu, Y., Jin, L., Zhang, S., Zhang, C., & Lu, X. (2019). Deep Text Recognition in Natural Scene Images: A Survey. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 41(11), 2592-2606. doi:10.1109/TPAMI.2018.2876851
    5. Shi, B., Bai, X., & Yao, C. (2017). An End-to-End Trainable Neural Network for Image-based Sequence Recognition and Its Application to Scene Text Recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 39(11), 2298-2304. doi:10.1109/TPAMI.2016.2635203
    6. Ronneberger, O., Fischer, P., & Brox, T. (2015). U-Net: Convolutional Networks for Biomedical Image Segmentation. In Proceedings of the International Conference on Medical Image Computing and Computer-Assisted Intervention (MICCAI) (pp. 234-241). Springer.
    7. International Research Journal of Engineering and Technology (IRJET). Text Detection and Recognition: A Review

    Foydalanilgan internet saytlar
    https://colab.research.google.com/
    https://www.mygreatlearning.com/blog/introduction-to-image-pre-processing/
    https://www.ibm.com/blog/optical-character-recognition/
    https://nanonets.com/blog/ocr-with-tesseract/
    https://www.researchgate.net/publication/274838198_A_Technical_Review_on_Text_Recognition_from_Images

    Ilova:
    # Kerakli kutubxonalarni o'rnatish
    !sudo apt install tesseract-ocr
    !pip install pytesseract
    !pip install opencv-python

    from google.colab import files


    import re
    import cv2
    import pytesseract
    from PIL import Image
    import IPython.display as display
    from io import BytesIO
    import base64

    # Tasvirda OCRni bajarish


    def perform_ocr(image_path):
    # OpenCV yordamida rasmni o'qish
    img = cv2.imread(image_path)

    # Tasvirni kulrang rangga aylantirish


    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

    # Pytesseract yordamida OCR ni bajarish


    text = pytesseract.image_to_string(Image.fromarray(gray))

    # Qo'shimcha bo'sh qatorlarni olib tashlash


    lines = text.split('\n')
    filtered_lines = []
    empty_line_count = 0

    for line in lines:


    if line.strip() == '':
    empty_line_count += 1
    if empty_line_count <= 1:
    filtered_lines.append(line)
    else:
    empty_line_count = 0
    filtered_lines.append(line)

    result_text = '\n'.join(filtered_lines)

    return result_text

    # Tasvir va matnni yonma-yon ko'rsatish funktsiyasi


    def display_image_with_text(image_path, text):
    # Ko'rish uchun tasvir hajmini o'zgartirish
    img = Image.open(image_path)
    img.thumbnail((300, 300)) # O'lchamni sozlash
    img_byte_array = BytesIO()
    img.save(img_byte_array, format='PNG', quality=95) # Tasvir sifatini yaxshilash
    img_data = img_byte_array.getvalue()

    # Matn boshlanishidan oldin va keyin 5 qator bo'sh joy qo'shish


    text = '\n' * 5 + text.strip() + '\n' * 5

    # HTML yordamida rasm va matnni yonma-yon ko'rsatish


    display.display(display.HTML(f"

    {text}
    "))

    # Tasvirlarni tsiklda qayta ishlash


    while True:
    # Rasmni yuklash
    uploaded_files = files.upload()

    if not uploaded_files:


    break # Hech qanday fayl yuklanmaganda tsikldan chiqarish

    # Har bir yuklangan rasmni qayta ishlash va namoyish qilish


    for image_filename, image_content in uploaded_files.items():
    # Rasmni saqlash
    with open(image_filename, 'wb') as f:
    f.write(image_content)

    # Rasmda OCRni bajarish


    result_text = perform_ocr(image_filename)

    # Rasm va matnni ko'rsatish


    display_image_with_text(image_filename, result_text)

    # Qayta ishlangan rasm uchun yuklab olish havolasini taqdim etish


    download_link = f'Yuklangan {image_filename}'
    display.display(display.HTML(download_link))

    # Davom etishni so'rash


    user_input = input("Yana rasm yuklashni xohlaysizmi? (xa/yo'q): ").lower()
    if user_input != 'xa':
    break # Agar foydalanuvchi davom etishni istamasa, tsikldan chiqish
    Download 1,32 Mb.
    1   ...   7   8   9   10   11   12   13   14   15




    Download 1,32 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    O'zbekiston respublikasi raqamli texnologiyalar vazirligi muhammad al-xorazmiy nomidagi toshkent axborot texnologiyalari universiteti

    Download 1,32 Mb.