Ferreira AM et al.
J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887
Artigo completo
CBIS 2026

Image preprocessing techniques for text extraction from food labels aiming at allergen identification

Técnicas de pré-processamento de imagens para extração de texto de rótulos de alimentos visando a identificação de alérgenos
Andreia Martins Ferreira1iD, Ana Trindade Winck1iD
1 Universidade Federal de Ciências da Saúde de Porto Alegre (UFCSPA), Porto Alegre (RS), Brasil.

Article information

Type Artigo completo · CBIS 2026
Identifier e1887
DOI 10.59681/2175-4411.v18.iEspecial.2026.1887
Received 17 May 2026
Accepted 20 July 2026
Review process Double Blind Review
Handling editorJuliano de Souza Gaspar
Access Open, CC BY 4.0
Corresponding authorAna Trindade Winck
anatw@ufcspa.edu.br

License

This is an open access article published under the Creative Commons CC BY 4.0 license, which permits use, distribution, and reproduction in any medium, provided the original work is properly cited.
CC BY 4.0
Abstract
Objective: To evaluate image preprocessing techniques to optimize optical character recognition (OCR)-based text extraction from food labels, contributing to the development of digital solutions that support consumers with food hypersensitivity in the autonomous identification of allergens. Method: Contrast-limited adaptive histogram equalization (CLAHE), adaptive binarization, Gaussian filter, and morphological filters were tested in combination with TesseractOCR and EasyOCR on 87 labels with variations in packaging, color, font, and material. Results: EasyOCR achieved 55% similarity with high computational cost; TesseractOCR reached 48% with the complete pipeline, 46% with equalization and binarization only, and 37% without preprocessing. Conclusion: Preprocessing consistently improved text recognition; however, the visual diversity of food labels remains an obstacle for digital health solutions aimed at the self-care of individuals with food allergies.
Keywords: Food Labeling; Food Hypersensitivity; Image Processing; Computer-Assisted.
Resumo
Objetivo: Avaliar técnicas de pré-processamento de imagens para otimizar a extração de texto por reconhecimento óptico de caracteres (OCR) em rótulos alimentícios, contribuindo para o desenvolvimento de soluções digitais que apoiem consumidores com hipersensibilidade alimentar na identificação autônoma de alérgenos. Método: Foram testados equalização adaptativa de histograma com limitação de contraste (CLAHE), binarização adaptativa, filtro gaussiano e morfologia matemática, combinados com TesseractOCR e EasyOCR, em 87 rótulos com variações de embalagem, cor, fonte e material. Resultados: O EasyOCR atingiu 55% de similaridade, com alto custo computacional; o TesseractOCR alcançou 48% com o pipeline completo, 46% apenas com equalização e binarização, e 37% sem pré-processamento. Conclusão: O pré-processamento melhorou consistentemente o reconhecimento de texto, mas a diversidade visual dos rótulos permanece um obstáculo para soluções digitais de saúde voltadas ao autocuidado de pessoas com alergias alimentares.
Descritores: Rotulagem de Alimentos; Hipersensibilidade Alimentar; Processamento de Imagem Assistida por Computador.

Paper presented at the 21st Brazilian Congress of Health Informatics (CBIS 2026), held from September 23 to 25, 2026, in Brasília (DF), Brazil, and published in the CBIS 2026 section of the Journal of Health Informatics.

HOW TO CITE THIS ARTICLE: Ferreira AM, Winck AT. Image preprocessing techniques for text extraction from food labels aiming at allergen identification. J Health Inform 2026;18:e1887. doi: https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.18871
Ferreira AM et al.J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887

1 Introduction

Food allergy is a major public health issue, defined by the World Health Organization (WHO) as a hypersensitivity reaction involving the immune system [1]. These reactions, often IgE-mediated, can trigger severe symptoms like hives and vomiting, and can even lead to death [2]. In Brazil, an estimated 6-8% of children and around 3% of adults have some form of food hypersensitivity, with common allergens including milk, eggs, and wheat [3,4].

Preventing allergic reactions primarily involves avoiding trigger foods, making accurate food labels essential [4]. Global efforts, such as the WHO's 1992 Codex Alimentarius, established labeling recommendations [5]. In Brazil, the “Põe no Rótulo” campaign, in 2014, championed clear labeling [6], leading to the Brazilian Health Regulatory Agency's (ANVISA) Collegiate Board Resolution (RDC) No. 26/2015 (later RDC No. 727/2022), which mandated readable allergen warnings on processed foods [7,8]. Additionally, RDC No. 727/2022 lists the 18 main allergen-causing foods, including milk, eggs, soy, and wheat, among others. However, for a single food item, a variety of terms may appear on the label. For instance, there are 43 distinct terms or ingredients representing the presence of milk, 40 for wheat, 35 for soy, and 23 for eggs [9]. It is also worth noting that among these identified variations, spelling differences may also occur, further expanding the variability of terms and, consequently, the difficulty in interpreting them. Furthermore, factors like variations in packaging materials (e.g., polypropylene, polyethylene, biaxially oriented polypropylene film) and colors can impede label readability. These material differences, alongside texture and color variations, pose a challenge for consumers.

Individual challenges, such as difficulties in reading or interpreting, further complicate label comprehension. Data from the 2022 Continuous National Household Sample Survey (PNAD Contínua) indicates that 8.9% of the Brazilian population has some form of disability, including visual impairments (3.1%) and learning disabilities (2.6%). Packaging size, information distribution, or font contrast can exacerbate these difficulties [10].

Given these complexities, ensuring allergic consumers correctly read ingredient lists remains challenging. Mobile applications, such as “Desrotulando” and “Loomos,” offer assistance. This work utilizes “Aillergic” [11], an application designed to identify allergens from food label images. “Aillergic” integrates natural language processing (NLP) [12] and optical character recognition (OCR) [13] application program‐ming interfaces (APIs): the OCR extracts text from images, connecting the captured images to the NLP algorithm. Although the OCR API [13] is functional,

refining image preprocessing is needed to improve results across diverse labels and packaging.

This study is part of a broader project validating a mobile application for allergen identification on food labels. Specifically, this work comparatively analyzes OCR tools and digital image preprocessing techniques to enhance image quality, thereby optimizing Aillergic’s OCR API results and improving the accuracy of allergen identification.

2 Methods

The methodology adopted for the development of the study consists of five stages: i) definition of possible digital image preprocessing techniques based on the issues identified in the first version of the application; ii) small-scale testing to narrow down the tools to be used; iii) creation of an image database for testing; iv) development of a representational state transfer (REST) API; and v) testing.

2.1 Definition Of Pre-processing Techniques

Image preprocessing consists of applying techniques intended to improve the quality and interpretability of input images, including distortion correction, enhancement of relevant features, and noise reduction through filtering methods [14]. Preprocessing strategies vary according to the characteristics of the image and the objectives of subsequent processing stages. In the present study, the selected techniques were based on literature focused on OCR optimization, particularly for the TesseractOCR engine.

A color model defines a three-dimensional coordinate system in which each color is represented by a single point, with RGB (red, green, blue) being the most common hardware-oriented model [15]. Grayscale conversion reduces this three-channel representation to a single intensity channel; the luminosity method was adopted, which applies a weighted average prioritizing green tones in accordance with human visual perception [16].

Contrast refers to the difference in gray levels across an image and can directly affect OCR interpretation [17]. Contrast-limited adaptive histogram equalization (CLAHE) applies localized histogram equalization with contrast limiting, reducing the risk of noise amplification compared to global equalization [18].

Binarization converts an image into a binary black-and-white representation by classifying each pixel as foreground or background according to a threshold value [19]. TesseractOCR uses Otsu's global thresholding by default, which may underperform on images with uneven illumination or colored backgrounds [20]; adaptive thresholding, which dynamically adjusts the threshold according to local image characteristics, was adopted after yielding superior results.

https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.18872
Ferreira AM et al.J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887

Noise refers to unwanted variations in pixel values arising from image capture conditions or compression artifacts, corrected through spatial filters, which are matrix-based operations applied via convolution across image pixels [15]. Two filters were evaluated: the Gaussian filter, a linear low-pass filter effective against additive random noise, and the median filter, a nonlinear edge-preserving filter for salt-and-pepper noise [21]. The Gaussian filter was retained in the final pipeline, applied prior to binarization.

Mathematical morphology provides set-theory-based operations for shape analysis, whose fundamental operations, erosion and dilation, are combined into opening (erosion followed by dilation) and closing (dilation followed by erosion) to remove noise and fill gaps in binary images [15]. In this study, opening followed by closing was applied after binarization to reduce impulse noise caused by label textures, which could otherwise be misinterpreted by the OCR engine as punctuation or accent marks.

During the validation tests of the first version of the Aillergic OCR API [13], labels on cylindrical packaging, colored backgrounds, and low-contrast images yielded results below expectations. Based on these findings, we adopted CLAHE, adaptive binarization, Gaussian filtering prior to binarization, and morphological filtering after binarization. Additionally, EasyOCR, a Python library applying deep learning for text recognition in natural scenes [22], was introduced for comparative evaluation against TesseractOCR [23].

2.2 Definition Of The Image Database

Currently, no publicly available datasets or image repositories specifically focused on ingredient lists in Portuguese were identified, and access to the 72 images used in the validation of the first version of the application could not be obtained. Therefore, a new dataset of 87 images was created, with a greater focus on labels from packaging types that present challenges for OCR extraction, such as aluminum cans, chocolates in blister packs, and cylindrical containers. The dataset is publicly available on Kaggle, along with the official transcription of each label.

2.3 Development Of The Rest Api

The first version of the Aillergic OCR API was developed in Java using Spring Boot [13]. However, one of the issues encountered was the limitation of libraries such as OpenCV in Java, as the most recent updates to image processing tools are primarily focused on Python. To facilitate the execution of pre-OCR pipelines and improve integration with the OCR engine itself, the current version of the API was developed in Python 3

using the Django framework. The API includes two endpoints: a POST endpoint for submitting an image for OCR processing, and a GET endpoint for retrieving information stored in the database.

The database used is a non-relational MongoDB database [24], designed to store the original product description and the transcription generated by the OCR (for better visualization, the transcripts were also included in the Kaggle dataset).

2.4 Testing And Evaluation

OCR performance was evaluated using Levenshtein distance similarity, which quantifies the proportion of character-level edits required to transform the OCR output into the official transcription. Each of the 87 images was submitted to the API under different preprocessing configurations, and the resulting transcriptions were compared against the manually validated ground-truth labels available in the dataset. Similarity scores were computed per image and averaged across the dataset for each preprocessing combination. EasyOCR was evaluated under the same metric for selected pipeline configurations, enabling direct comparison with TesseractOCR results.

2.5 Ethical Aspects

All stages of the project were conducted using texts available on labels of industrialized food products, without the application, testing, or validation involving human participants. Therefore, as this is a technological study that does not involve research with human subjects, it is in accordance with Resolution No. 510, of April 7, 2016, of the Brazilian National Health Council, and does not require submission to a Research Ethics Committee.

3 Results

Considering that the main focus for improving the first version of the API was to enhance results for low-quality images, colored labels, packaging with high reflectivity, and difficult-to-read labels, the primary emphasis of the tests was on reducing image noise and standardizing color scales to optimize OCR performance.

The initial proposed pipeline consisted of converting the image to grayscale, performing histogram equalization, followed by binarization. However, the issue with this flow was that different types of packaging require different adjustments, and applying these processes indiscriminately to all input images substantially worsened the results.

https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.18873
Ferreira AM et al.J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887
Figure 1. Example of preprocessing in a package with adequate contrast: (a) original image; and (b) grayscale conversion.
Source: Prepared by the authors (2026).

To address this, the first preprocessing algorithm tested on all 87 images conditioned the modifications as follows: all images are initially converted to grayscale, and then the predominant background color is analyzed to determine an average contrast level for the label: if the contrast is adequate for OCR, which typically occurs when the packaging has a gray or black background, the algorithm proceeds; if not, histogram equalization is applied. Figure 1 illustrates an example of a package in which grayscale conversion alone was sufficient to preserve readability, without the need for histogram equalization.

During initial tests, both global and adaptive histogram equalization techniques were evaluated on a smaller image set, with adaptive equalization producing better results in the current context. Thus, CLAHE equalization is applied to images with colored backgrounds, and from the equalized image, inversion and binarization are performed so that the resulting image has a white background with black text, which is ideal for OCR tools. Adaptive thresholding yielded better binarization results compared to Otsu’s method.

One issue encountered was noise caused by image capture and binarization. Tests with median and Gaussian filters before binarization resulted in a Levenshtein distance similarity of around 44% in both cases. Applying only morphological filters raised this value from 44% to 46%, while combining both, with a filter before binarization (in this case, Gaussian) and morphological filtering after, increased the Levenshtein distance similarity to 48%. As both noise reduction approaches yielded improvements, they were included in the final comparative analysis. Figure 2 demonstrates the effect of morphological filtering on a colorful reflective label after adaptive binarization.

The worst Levenshtein distance similarity results were observed in thin cylindrical packaging (first row of Figure 3), metallic low-contrast packaging (second row of Figure 3), and labels containing small or bordered fonts (third row of Figure 3). In contrast, packages with good contrast between text and background, low glare, and adequate character spacing achieved better OCR performance (fourth row of Figure 3).

Figure 2. Example of morphological filtering applied to a reflective colorful label: (a) original image; (b) grayscale and binarization; and (c‌) morphological filtering result.
Source: Prepared by the authors (2026).
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.18874
Ferreira AM et al.J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887
Figure 3. Preprocessing effects in different packaging (rows), including cylindrical, metallic low-contrast, labels with small or bordered fonts, and labels with good contrast and spacing. Columns show: (a) original image; (b) grayscale conversion; and (c‌) morphological filtering.
Source: Prepared by the authors (2026).
Table 1. Preliminary preprocessing strategies evaluated for OCR enhancement
Preprocessing combinationOCR ToolSimilarity
No preprocessingTesseractOCR37%
Grayscale + CLAHE + adaptive binarizationTesseractOCR46%
Grayscale + CLAHE + median filter + adaptive binarizationTesseractOCR44%
Grayscale + CLAHE + Gaussian filter + adaptive binarizationTesseractOCR44%
Grayscale + CLAHE + adaptive binarization + morphological filtersTesseractOCR46%
Grayscale + CLAHE + Gaussian filter + adaptive binarization + morphological filtersTesseractOCR48%
Grayscale + CLAHE + adaptive binarizationEasyOCR55%
Source: Prepared by the authors (2026).

Although the overall similarity values did not exceed 50% when using TesseractOCR as the OCR tool, the proposed preprocessing strategies improved OCR performance when compared to the first version of the application [13], which did not include preprocessing steps such as grayscale conversion. Using the same image dataset, the first version achieved only 37% Levenshtein distance similarity.

Table 1 summarizes the initial preprocessing combinations evaluated during the exploratory phase of the study. These experiments supported the

definition of a conditional preprocessing workflow for OCR enhancement in food label images. Only the post low-contrast background validation workflow is reported in the table, as 86 out of 87 images underwent this validation; the single exception did not affect the final similarity percentage.

Thus, based on the exploratory preprocessing experiments and qualitative analysis, a final conditional workflow was established, as illustrated in Figure 4.

Figure 4. Final workflow derived from experimental evaluation.
Fluxo final de pré-processamento e OCR Input image of food label OCR Extraction Grayscale conversion Low-contrast background? CLAHE Gaussian Filter Inversion Adaptive Binarization Opening and Closing TesseractOCR Yes No
Source: Prepared by the authors (2026).
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.18875
Ferreira AM et al.J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887
Table 2. Comparison between different methods tested and generative AI
ImageTesseractOCR
(full image)
TesseractOCR
(ingredient list focused)
EasyOCR
(ingredient list focused)
Gemini
(full image)
Energy drink can0%48.83%48.83%82.00%
Sardine can 10%48.40%68.81%93.00%
Sardine can 20%34.84%36.19%100.00%
Soft drink bottle0%29.00%22.22%97.00%
Soft drink can0%50.45%45.41%87.00%
Source: Prepared by the authors (2026).

4 Discussion

Although there are legally established standards for information related to ingredients, there is no standardization in how such information is presented: variations in colors, fonts, font sizes, order of alerts, and even the arrangement of the ingredient list on the packaging can affect the interpretation of the information. Furthermore, there is a wide variety of packaging materials and shapes. Combined, these factors make it difficult to establish a standardized approach for recognizing ingredient lists, making each image uploaded by the user nearly unique. This variability complicates the creation of a unified OCR preprocessing workflow, since correcting an issue encountered in the transcription of one text may introduce failures in another image that initially presented a good Levenshtein distance similarity percentage.

Another challenge in optimizing OCR is parameter tuning. Although the conditional preprocessing workflow illustrated in Figure 4 applies enhancement steps only when necessary, it is not possible to achieve ideal results for all inputs because each image presents specific, and sometimes no, preprocessing requirements that cannot be addressed by universal parameters. One example encountered during the project development involved kernel sizes for sharpening blurred images. The initial sharpening filter was ultimately removed from the final workflow because it substantially worsened the results for many images. Similarly, thresholding and binarization parameters were adjusted to intermediate values in order to minimize negative impacts across different image categories, several of which are illustrated in Figure 3.

Finally, the lack of contextual focus for OCR is also a hindrance, as the tool cannot define the execution focus in images containing a lot of information (such as a full package).

One possible way to address this limitation is the use of generative artificial intelligence (AI) models for text extraction, since each prompt execution can adapt dynamically to the characteristics of the input image. To explore this possibility, preliminary tests were conducted using the Gemini 2.5 Pro model and

ChatGPT with images that had previously shown low similarity scores in the proposed preprocessing workflows, including energy drink cans, sardine cans, a colorful metallic can, and a soft drink bottle.

Although the free version of ChatGPT was unable to process the images adequately, Gemini 2.5 Pro successfully extracted the complete text from all tested images, achieving Levenshtein similarity scores between 82% and 100%. For comparison, the same images achieved 0% similarity using the preprocessing workflows developed in this study, and less than 70% similarity even when the images were manually cropped to focus exclusively on the ingredient list (Table 2).

When asked about the sources used to identify the “ingredient list” block, Gemini states that its training base is extensive and cites sources such as product databases, e-commerce data, technical and regulatory documents, web scraping from sites displaying packaging and labels in some form, and digitized tags. Considering the image database and information used for model training, even if a pre-trained model for identifying the “ingredient list” block on packaging is developed in the future, it is unlikely that results will be as good as those of a generative AI in the near future.

However, it is worth noting that implementing a generative model in the project would require paying per-token usage, which would generate high costs for Aillergic, making it unfeasible at this time.

5 Conclusion

Image processing techniques proved useful for improving OCR performance, but the lack of standardization in layouts, especially with complex designs, different packaging types, color variations, and fonts, limits optimization. As in the first version of the service, flat packages made of low-reflective materials such as cardboard, with simple layouts, yielded better results and did not require prepro‐cessing. In contrast, packages made of materials that reflect more light, such as aluminum and regenerated cellulose (cellophane), labels with elaborate layouts (such as some soft drinks and sardine cans), and cylindrical and/or small packages that complicate

https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.18876
Ferreira AM et al.J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887

image capture, showed varied results even with preprocessing.

Overall, there was an improvement in text extraction; however, in some cases, such as long aluminum cans with colored backgrounds or small candies wrapped in cellophane with extremely small text fonts, substantial improvements were not achieved. Regarding the optical character recognition tool, TesseractOCR remains the best option in terms of computational performance. Although EasyOCR yielded better results on some images with low similarity scores in TesseractOCR, it is a tool that requires high memory

consumption, increasing the application’s execution time. It is also undeniable that labels on flat packages perform better.

Regarding the API, the shift from Java to Python facilitated integration with image processing libraries and tools.

For future work, it is suggested to find alternatives to overcome the lack of layout standardization, such as training a pre-trained model for text extraction and region of interest detection; however, this also requires expanding the training image database.

Author contributions. The authors contributed equally to all stages of the article: conception and design of the study; data collection, analysis, and interpretation; drafting and critical revision of the manuscript; and approval of the final version.
Funding. This work received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.
Data and materials availability. The dataset used in this study is publicly available at https://www.kaggle.com/datasets/andreiamf/lista-ingrdientes-ptbr. The source code is publicly available at https://github.com/andreiamferreira/processamento-imagens-ocr-tcc.
Conflicts of interest. The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Use of artificial intelligence. Generative artificial intelligence tools (Gemini, Claude, and ChatGPT) were used to assist in text synthesis, content organization, grammatical revision, and bibliographic reference formatting. In the empirical component of the study, generative AI was also used for comparative evaluation purposes, as described in the Discussion section. The authors declare that generative artificial intelligence was not used for data generation, fabrication of results, or autonomous production of scientific content attributable to authorship. All final analyses, interpretations, and writing decisions were conducted and reviewed by the authors.

References

  1. Kotchetkoff ECA, Yonamine GH. Reações adversas a alimentos. In: Pinotti R, Yonamine GH, organizadoras. Alergia alimentar: alimentação, nutrição e terapia nutricional. 1. ed. Barueri: Manole; 2020. p. 2-15.
  2. Rios JLM, Pinto SMEB, Santos LNC, Silva EM, Estanislau NRA, Motta MFAMA, et al. Non-IgE mediated food allergy: food protein-induced allergic proctocolitis - An update. AAAI. 2022;6(2):225-38. doi: https://doi.org/10.5935/2526-5393.20220023
  3. Solé D, Silva LR, Cocco RR, Ferreira CT, Sarni RO, Oliveira LC, et al. Consenso Brasileiro sobre Alergia Alimentar: 2018 - Parte 1 - Etiopatogenia, clínica e diagnóstico. Documento conjunto elaborado pela Sociedade Brasileira de Pediatria e Associação Brasileira de Alergia e Imunologia. Arquivos de Asma, Alergia e Imunologia. 2018;2(1). doi: https://doi.org/10.5935/2526-5393.20180004
  4. Solé D, Silva LR, Cocco RR, Ferreira CT, Sarni RO, Oliveira LC, et al. Consenso Brasileiro sobre Alergia Alimentar: 2018 - Parte 2 - Diagnóstico, tratamento e prevenção. Documento conjunto elaborado pela Sociedade Brasileira de Pediatria e Associação Brasileira de Alergia e Imunologia. Arquivos de Asma, Alergia e Imunologia. 2018;2(1). doi: https://doi.org/10.5935/2526-5393.20180005
  5. World Health Organization; Food and Agriculture Organization of the United Nations. Codex Alimentarius: general standard for the labelling of prepackaged foods [Internet]. Rome: WHO/FAO; 2018 [cited 2026 Nov 24]. Available from: https://www.fao.org/fao-who-codexalimentarius/sh-proxy/en/?lnk=1&url=https%253A%252F%252Fworkspace.fao.org%252Fsites%252Fcodex%252FStandards%252FCXS%2B1-1985%252FCXS_001e.pdf
  6. Põe no Rótulo. Põe no rótulo [Internet]. [cited 2026 May 16]. Available from: https://www.poenorotulo.com.br/.
  7. Agência Nacional de Vigilância Sanitária. Resolução da Diretoria Colegiada nº 26, de 2 de julho de 2015. Requisitos para rotulagem obrigatória dos principais alimentos que causam alergias alimentares [Internet]. Brasília: Ministério da Saúde; 2015 [cited 2026 May 16]. Available from: https://bvsms.saude.gov.br/bvs/saudelegis/anvisa/2015/rdc0026_26_06_2015.pdf
  8. Agência Nacional de Vigilância Sanitária. Resolução da Diretoria Colegiada nº 727, de 1 July 2022. Resolução sobre alimentos embalados [Internet]. Brasília: Ministério da Saúde; 2022 [cited 2026 May 16]. Available from: https://antigo.anvisa.gov.br/documents/10181/2718376/RDC_727_2022_.pdf
  9. Pereira RA, Guedes FM, Gadelha GA, Menin G, Menezes GP, Amantéa SL, et al. Alérgenos alimentares em rótulos de produtos alimentícios: uma unificação da nomenclatura. AAAI. 2024;8(2):125-8. doi: https://doi.org/10.5935/2526-5393.20230084
  10. Instituto Brasileiro de Geografia e Estatística. Pesquisa nacional por amostra de domicílios contínua: pessoas com deficiência 2022 [Internet]. Rio de Janeiro: IBGE; 2023 [cited 2026 Oct 18]. Available from: https://biblioteca.ibge.gov.br/visualizacao/livros/liv102013_informativo.pdf
  11. Menezes GP, Pereira RA, Guedes FM, Winck AT. Desenvolvimento de um aplicativo móvel para leitura e identificação de alérgenos em rótulos alimentares. In: Anais do XX Congresso Brasileiro de Informática em Saúde. São Paulo; 2024. p. 91-95. doi:10.5281/zenodo.14337625
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.18877
Ferreira AM et al.J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887

  1. Gadelha GA, Pereira RA, Guedes FM, Winck AT. Processamento de Linguagem Natural na Identificação de Alérgenos em Rótulos Alimentares: Uma Aplicação no Contexto Brasileiro. J Health Inform. 2024;16(Especial). doi: https://doi.org/10.59681/2175-4411.v16.iespecial.2024.1325
  2. Menin G, Pereira RA, Guedes FM, Winck AT. API REST para reconhecimento óptico de caracteres em rótulos alimentares. J Health Inform. 2024;16(Especial). doi: https://doi.org/10.59681/2175-4411.v16.iespecial.2024.1316
  3. Sonka M, Hlavac V, Boyle R. Image pre-processing. In: Image Processing, Analysis and Machine Vision. Boston, MA: Springer US; 1993. p. 56-111. doi: https://doi.org/10.1007/978-1-4899-3216-7_4
  4. Gonzalez RC, Woods RE. Processamento digital de imagens. 3. ed. São Paulo: Pearson; 2010.
  5. Nogueira RCA. Análise de conversão de imagem colorida para tons de cinza via contraste percebido [Internet] [undergraduate thesis]. Recife: Universidade Federal de Pernambuco; 2016 [cited 2026 May 6]. Available from: https://www.cin.ufpe.br/~tg/2016-1/rcan.pdf
  6. Al-amri SS, Kalyankar NV, Khamitkar SD. Linear and non-linear contrast enhancement image. Int J Comput Sci Netw Secur. 2010;10(2):139. [cited 2026 Oct 18]. Available from: http://paper.ijcsns.org/07_book/201002/20100222.pdf
  7. Pizer SM, Amburn P, Austin JD, Cromartie R, Geselowitz A, Greer T, et al. Adaptive histogram equalization and its variations. Computer Vision, Graphics, and Image Processing. 1987;39(3):355-68. doi: https://doi.org/10.1016/s0734-189x(87)80186-x
  8. Shine NK, Bhutani G, Keerthana TS, Rohith G. An approach for improving Optical Character Recognition using Contrast enhancement technique. J. Phys.: Conf. Ser. 2023;2466(1):012009. doi: https://doi.org/10.1088/1742-6596/2466/1/012009
  9. Yang Z, Zuo S, Zhou Y, He J, Shi J. A Review of Document Binarization: Main Techniques, New Challenges, and Trends. Electronics. 2024;13(7):1394. doi: https://doi.org/10.3390/electronics13071394
  10. Barelli F. Introdução à visão computacional: uma abordagem prática com Python e OpenCV. São Paulo: Casa do Código; 2019.
  11. Jaided AI. EasyOCR documentation [Internet]. 2024 [cited 2026 May 16]. Available from: https://www.jaided.ai/easyocr/documentation/.
  12. TesseractOCR. Tesseract documentation [Internet]. 2024 [cited 2026 May 16]. Available from: https://github.com/tesseract-ocr/tessdoc.
  13. MongoDB. Documentation [Internet]. [cited 2026 May 16]. Available from: https://www.mongodb.com/docs.

Editorial notes

The Journal of Health Informatics is a scientific journal maintained by the Brazilian Society of Health Informatics (Sociedade Brasileira de Informática em Saúde), a non-profit scientific association dedicated to the development of Health Informatics and Digital Health in Brazil. The editorial process is conducted with scientific independence, free from institutional, commercial, or sponsor interference, and follows international best practices in publication ethics.

This article was double-blind peer reviewed by specialists in the field. The editorial team used artificial intelligence tools, under human supervision, in the initial screening, in checking the text, references and numbers and, when needed, in redrawing figures, charts and tables, which the authors approved in the proof. The tools and safeguards are described in the journal's Policy on the use of artificial intelligence. Editorial decisions were made by people.

https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.18878
Ferreira AM et al.
J Health Inform. 2026;18:e1887
https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887
Artigo completo
CBIS 2026

Image preprocessing techniques for text extraction from food labels aiming at allergen identification

Técnicas de pré-processamento de imagens para extração de texto de rótulos de alimentos visando a identificação de alérgenos
Andreia Martins Ferreira1iD, Ana Trindade Winck1iD
1 Universidade Federal de Ciências da Saúde de Porto Alegre (UFCSPA), Porto Alegre (RS), Brasil.

Article information

Type Artigo completo · CBIS 2026
Identifier e1887
DOI 10.59681/2175-4411.v18.iEspecial.2026.1887
Received 17 May 2026
Accepted 20 July 2026
Review process Double Blind Review
Handling editorJuliano de Souza Gaspar
Access Open, CC BY 4.0
Corresponding authorAna Trindade Winck
anatw@ufcspa.edu.br

License

This is an open access article published under the Creative Commons CC BY 4.0 license, which permits use, distribution, and reproduction in any medium, provided the original work is properly cited.
CC BY 4.0
Abstract
Objective: To evaluate image preprocessing techniques to optimize optical character recognition (OCR)-based text extraction from food labels, contributing to the development of digital solutions that support consumers with food hypersensitivity in the autonomous identification of allergens. Method: Contrast-limited adaptive histogram equalization (CLAHE), adaptive binarization, Gaussian filter, and morphological filters were tested in combination with TesseractOCR and EasyOCR on 87 labels with variations in packaging, color, font, and material. Results: EasyOCR achieved 55% similarity with high computational cost; TesseractOCR reached 48% with the complete pipeline, 46% with equalization and binarization only, and 37% without preprocessing. Conclusion: Preprocessing consistently improved text recognition; however, the visual diversity of food labels remains an obstacle for digital health solutions aimed at the self-care of individuals with food allergies.
Keywords: Food Labeling; Food Hypersensitivity; Image Processing; Computer-Assisted.
Resumo
Objetivo: Avaliar técnicas de pré-processamento de imagens para otimizar a extração de texto por reconhecimento óptico de caracteres (OCR) em rótulos alimentícios, contribuindo para o desenvolvimento de soluções digitais que apoiem consumidores com hipersensibilidade alimentar na identificação autônoma de alérgenos. Método: Foram testados equalização adaptativa de histograma com limitação de contraste (CLAHE), binarização adaptativa, filtro gaussiano e morfologia matemática, combinados com TesseractOCR e EasyOCR, em 87 rótulos com variações de embalagem, cor, fonte e material. Resultados: O EasyOCR atingiu 55% de similaridade, com alto custo computacional; o TesseractOCR alcançou 48% com o pipeline completo, 46% apenas com equalização e binarização, e 37% sem pré-processamento. Conclusão: O pré-processamento melhorou consistentemente o reconhecimento de texto, mas a diversidade visual dos rótulos permanece um obstáculo para soluções digitais de saúde voltadas ao autocuidado de pessoas com alergias alimentares.
Descritores: Rotulagem de Alimentos; Hipersensibilidade Alimentar; Processamento de Imagem Assistida por Computador.

Paper presented at the 21st Brazilian Congress of Health Informatics (CBIS 2026), held from September 23 to 25, 2026, in Brasília (DF), Brazil, and published in the CBIS 2026 section of the Journal of Health Informatics.

HOW TO CITE THIS ARTICLE: Ferreira AM, Winck AT. Image preprocessing techniques for text extraction from food labels aiming at allergen identification. J Health Inform 2026;18:e1887. doi: https://doi.org/10.59681/2175-4411.v18.iEspecial.2026.1887

1 Introduction

Food allergy is a major public health issue, defined by the World Health Organization (WHO) as a hypersensitivity reaction involving the immune system [1]. These reactions, often IgE-mediated, can trigger severe symptoms like hives and vomiting, and can even lead to death [2]. In Brazil, an estimated 6-8% of children and around 3% of adults have some form of food hypersensitivity, with common allergens including milk, eggs, and wheat [3,4].

Preventing allergic reactions primarily involves avoiding trigger foods, making accurate food labels essential [4]. Global efforts, such as the WHO's 1992 Codex Alimentarius, established labeling recommendations [5]. In Brazil, the “Põe no Rótulo” campaign, in 2014, championed clear labeling [6], leading to the Brazilian Health Regulatory Agency's (ANVISA) Collegiate Board Resolution (RDC) No. 26/2015 (later RDC No. 727/2022), which mandated readable allergen warnings on processed foods [7,8]. Additionally, RDC No. 727/2022 lists the 18 main allergen-causing foods, including milk, eggs, soy, and wheat, among others. However, for a single food item, a variety of terms may appear on the label. For instance, there are 43 distinct terms or ingredients representing the presence of milk, 40 for wheat, 35 for soy, and 23 for eggs [9]. It is also worth noting that among these identified variations, spelling differences may also occur, further expanding the variability of terms and, consequently, the difficulty in interpreting them. Furthermore, factors like variations in packaging materials (e.g., polypropylene, polyethylene, biaxially oriented polypropylene film) and colors can impede label readability. These material differences, alongside texture and color variations, pose a challenge for consumers.

Individual challenges, such as difficulties in reading or interpreting, further complicate label comprehension. Data from the 2022 Continuous National Household Sample Survey (PNAD Contínua) indicates that 8.9% of the Brazilian population has some form of disability, including visual impairments (3.1%) and learning disabilities (2.6%). Packaging size, information distribution, or font contrast can exacerbate these difficulties [10].

Given these complexities, ensuring allergic consumers correctly read ingredient lists remains challenging. Mobile applications, such as “Desrotulando” and “Loomos,” offer assistance. This work utilizes “Aillergic” [11], an application designed to identify allergens from food label images. “Aillergic” integrates natural language processing (NLP) [12] and optical character recognition (OCR) [13] application programming interfaces (APIs): the OCR extracts text from images, connecting the captured images to the NLP algorithm. Although the OCR API [13] is functional, refining image preprocessing is needed to improve results across diverse labels and packaging.

This study is part of a broader project validating a mobile application for allergen identification on food labels. Specifically, this work comparatively analyzes OCR tools and digital image preprocessing techniques to enhance image quality, thereby optimizing Aillergic’s OCR API results and improving the accuracy of allergen identification.

2 Methods

The methodology adopted for the development of the study consists of five stages: i) definition of possible digital image preprocessing techniques based on the issues identified in the first version of the application; ii) small-scale testing to narrow down the tools to be used; iii) creation of an image database for testing; iv) development of a representational state transfer (REST) API; and v) testing.

2.1 Definition Of Pre-processing Techniques

Image preprocessing consists of applying techniques intended to improve the quality and interpretability of input images, including distortion correction, enhancement of relevant features, and noise reduction through filtering methods [14]. Preprocessing strategies vary according to the characteristics of the image and the objectives of subsequent processing stages. In the present study, the selected techniques were based on literature focused on OCR optimization, particularly for the TesseractOCR engine.

A color model defines a three-dimensional coordinate system in which each color is represented by a single point, with RGB (red, green, blue) being the most common hardware-oriented model [15]. Grayscale conversion reduces this three-channel representation to a single intensity channel; the luminosity method was adopted, which applies a weighted average prioritizing green tones in accordance with human visual perception [16].

Contrast refers to the difference in gray levels across an image and can directly affect OCR interpretation [17]. Contrast-limited adaptive histogram equalization (CLAHE) applies localized histogram equalization with contrast limiting, reducing the risk of noise amplification compared to global equalization [18].

Binarization converts an image into a binary black-and-white representation by classifying each pixel as foreground or background according to a threshold value [19]. TesseractOCR uses Otsu's global thresholding by default, which may underperform on images with uneven illumination or colored backgrounds [20]; adaptive thresholding, which dynamically adjusts the threshold according to local image characteristics, was adopted after yielding superior results.

Noise refers to unwanted variations in pixel values arising from image capture conditions or compression artifacts, corrected through spatial filters, which are matrix-based operations applied via convolution across image pixels [15]. Two filters were evaluated: the Gaussian filter, a linear low-pass filter effective against additive random noise, and the median filter, a nonlinear edge-preserving filter for salt-and-pepper noise [21]. The Gaussian filter was retained in the final pipeline, applied prior to binarization.

Mathematical morphology provides set-theory-based operations for shape analysis, whose fundamental operations, erosion and dilation, are combined into opening (erosion followed by dilation) and closing (dilation followed by erosion) to remove noise and fill gaps in binary images [15]. In this study, opening followed by closing was applied after binarization to reduce impulse noise caused by label textures, which could otherwise be misinterpreted by the OCR engine as punctuation or accent marks.

During the validation tests of the first version of the Aillergic OCR API [13], labels on cylindrical packaging, colored backgrounds, and low-contrast images yielded results below expectations. Based on these findings, we adopted CLAHE, adaptive binarization, Gaussian filtering prior to binarization, and morphological filtering after binarization. Additionally, EasyOCR, a Python library applying deep learning for text recognition in natural scenes [22], was introduced for comparative evaluation against TesseractOCR [23].

2.2 Definition Of The Image Database

Currently, no publicly available datasets or image repositories specifically focused on ingredient lists in Portuguese were identified, and access to the 72 images used in the validation of the first version of the application could not be obtained. Therefore, a new dataset of 87 images was created, with a greater focus on labels from packaging types that present challenges for OCR extraction, such as aluminum cans, chocolates in blister packs, and cylindrical containers. The dataset is publicly available on Kaggle, along with the official transcription of each label.

2.3 Development Of The Rest Api

The first version of the Aillergic OCR API was developed in Java using Spring Boot [13]. However, one of the issues encountered was the limitation of libraries such as OpenCV in Java, as the most recent updates to image processing tools are primarily focused on Python. To facilitate the execution of pre-OCR pipelines and improve integration with the OCR engine itself, the current version of the API was developed in Python 3 using the Django framework. The API includes two endpoints: a POST endpoint for submitting an image for OCR processing, and a GET endpoint for retrieving information stored in the database.

The database used is a non-relational MongoDB database [24], designed to store the original product description and the transcription generated by the OCR (for better visualization, the transcripts were also included in the Kaggle dataset).

2.4 Testing And Evaluation

OCR performance was evaluated using Levenshtein distance similarity, which quantifies the proportion of character-level edits required to transform the OCR output into the official transcription. Each of the 87 images was submitted to the API under different preprocessing configurations, and the resulting transcriptions were compared against the manually validated ground-truth labels available in the dataset. Similarity scores were computed per image and averaged across the dataset for each preprocessing combination. EasyOCR was evaluated under the same metric for selected pipeline configurations, enabling direct comparison with TesseractOCR results.

2.5 Ethical Aspects

All stages of the project were conducted using texts available on labels of industrialized food products, without the application, testing, or validation involving human participants. Therefore, as this is a technological study that does not involve research with human subjects, it is in accordance with Resolution No. 510, of April 7, 2016, of the Brazilian National Health Council, and does not require submission to a Research Ethics Committee.

3 Results

Considering that the main focus for improving the first version of the API was to enhance results for low-quality images, colored labels, packaging with high reflectivity, and difficult-to-read labels, the primary emphasis of the tests was on reducing image noise and standardizing color scales to optimize OCR performance.

The initial proposed pipeline consisted of converting the image to grayscale, performing histogram equalization, followed by binarization. However, the issue with this flow was that different types of packaging require different adjustments, and applying these processes indiscriminately to all input images substantially worsened the results.

Figure 1. Example of preprocessing in a package with adequate contrast: (a) original image; and (b) grayscale conversion.
Source: Prepared by the authors (2026).

To address this, the first preprocessing algorithm tested on all 87 images conditioned the modifications as follows: all images are initially converted to grayscale, and then the predominant background color is analyzed to determine an average contrast level for the label: if the contrast is adequate for OCR, which typically occurs when the packaging has a gray or black background, the algorithm proceeds; if not, histogram equalization is applied. Figure 1 illustrates an example of a package in which grayscale conversion alone was sufficient to preserve readability, without the need for histogram equalization.

During initial tests, both global and adaptive histogram equalization techniques were evaluated on a smaller image set, with adaptive equalization producing better results in the current context. Thus, CLAHE equalization is applied to images with colored backgrounds, and from the equalized image, inversion and binarization are performed so that the resulting image has a white background with black text, which is ideal for OCR tools. Adaptive thresholding yielded better binarization results compared to Otsu’s method.

One issue encountered was noise caused by image capture and binarization. Tests with median and Gaussian filters before binarization resulted in a Levenshtein distance similarity of around 44% in both cases. Applying only morphological filters raised this value from 44% to 46%, while combining both, with a filter before binarization (in this case, Gaussian) and morphological filtering after, increased the Levenshtein distance similarity to 48%. As both noise reduction approaches yielded improvements, they were included in the final comparative analysis. Figure 2 demonstrates the effect of morphological filtering on a colorful reflective label after adaptive binarization.

The worst Levenshtein distance similarity results were observed in thin cylindrical packaging (first row of Figure 3), metallic low-contrast packaging (second row of Figure 3), and labels containing small or bordered fonts (third row of Figure 3). In contrast, packages with good contrast between text and background, low glare, and adequate character spacing achieved better OCR performance (fourth row of Figure 3).

Figure 2. Example of morphological filtering applied to a reflective colorful label: (a) original image; (b) grayscale and binarization; and (c‌) morphological filtering result.
Source: Prepared by the authors (2026).
Figure 3. Preprocessing effects in different packaging (rows), including cylindrical, metallic low-contrast, labels with small or bordered fonts, and labels with good contrast and spacing. Columns show: (a) original image; (b) grayscale conversion; and (c‌) morphological filtering.
Source: Prepared by the authors (2026).
Table 1. Preliminary preprocessing strategies evaluated for OCR enhancement
Preprocessing combinationOCR ToolSimilarity
No preprocessingTesseractOCR37%
Grayscale + CLAHE + adaptive binarizationTesseractOCR46%
Grayscale + CLAHE + median filter + adaptive binarizationTesseractOCR44%
Grayscale + CLAHE + Gaussian filter + adaptive binarizationTesseractOCR44%
Grayscale + CLAHE + adaptive binarization + morphological filtersTesseractOCR46%
Grayscale + CLAHE + Gaussian filter + adaptive binarization + morphological filtersTesseractOCR48%
Grayscale + CLAHE + adaptive binarizationEasyOCR55%
Source: Prepared by the authors (2026).

Although the overall similarity values did not exceed 50% when using TesseractOCR as the OCR tool, the proposed preprocessing strategies improved OCR performance when compared to the first version of the application [13], which did not include preprocessing steps such as grayscale conversion. Using the same image dataset, the first version achieved only 37% Levenshtein distance similarity.

Table 1 summarizes the initial preprocessing combinations evaluated during the exploratory phase of the study. These experiments supported the definition of a conditional preprocessing workflow for OCR enhancement in food label images. Only the post low-contrast background validation workflow is reported in the table, as 86 out of 87 images underwent this validation; the single exception did not affect the final similarity percentage.

Thus, based on the exploratory preprocessing experiments and qualitative analysis, a final conditional workflow was established, as illustrated in Figure 4.

Figure 4. Final workflow derived from experimental evaluation.
Fluxo final de pré-processamento e OCR Input image of food label OCR Extraction Grayscale conversion Low-contrast background? CLAHE Gaussian Filter Inversion Adaptive Binarization Opening and Closing TesseractOCR Yes No
Source: Prepared by the authors (2026).
Table 2. Comparison between different methods tested and generative AI
ImageTesseractOCR
(full image)
TesseractOCR
(ingredient list focused)
EasyOCR
(ingredient list focused)
Gemini
(full image)
Energy drink can0%48.83%48.83%82.00%
Sardine can 10%48.40%68.81%93.00%
Sardine can 20%34.84%36.19%100.00%
Soft drink bottle0%29.00%22.22%97.00%
Soft drink can0%50.45%45.41%87.00%
Source: Prepared by the authors (2026).

4 Discussion

Although there are legally established standards for information related to ingredients, there is no standardization in how such information is presented: variations in colors, fonts, font sizes, order of alerts, and even the arrangement of the ingredient list on the packaging can affect the interpretation of the information. Furthermore, there is a wide variety of packaging materials and shapes. Combined, these factors make it difficult to establish a standardized approach for recognizing ingredient lists, making each image uploaded by the user nearly unique. This variability complicates the creation of a unified OCR preprocessing workflow, since correcting an issue encountered in the transcription of one text may introduce failures in another image that initially presented a good Levenshtein distance similarity percentage.

Another challenge in optimizing OCR is parameter tuning. Although the conditional preprocessing workflow illustrated in Figure 4 applies enhancement steps only when necessary, it is not possible to achieve ideal results for all inputs because each image presents specific, and sometimes no, preprocessing requirements that cannot be addressed by universal parameters. One example encountered during the project development involved kernel sizes for sharpening blurred images. The initial sharpening filter was ultimately removed from the final workflow because it substantially worsened the results for many images. Similarly, thresholding and binarization parameters were adjusted to intermediate values in order to minimize negative impacts across different image categories, several of which are illustrated in Figure 3.

Finally, the lack of contextual focus for OCR is also a hindrance, as the tool cannot define the execution focus in images containing a lot of information (such as a full package).

One possible way to address this limitation is the use of generative artificial intelligence (AI) models for text extraction, since each prompt execution can adapt dynamically to the characteristics of the input image. To explore this possibility, preliminary tests were conducted using the Gemini 2.5 Pro model and ChatGPT with images that had previously shown low similarity scores in the proposed preprocessing workflows, including energy drink cans, sardine cans, a colorful metallic can, and a soft drink bottle.

Although the free version of ChatGPT was unable to process the images adequately, Gemini 2.5 Pro successfully extracted the complete text from all tested images, achieving Levenshtein similarity scores between 82% and 100%. For comparison, the same images achieved 0% similarity using the preprocessing workflows developed in this study, and less than 70% similarity even when the images were manually cropped to focus exclusively on the ingredient list (Table 2).

When asked about the sources used to identify the “ingredient list” block, Gemini states that its training base is extensive and cites sources such as product databases, e-commerce data, technical and regulatory documents, web scraping from sites displaying packaging and labels in some form, and digitized tags. Considering the image database and information used for model training, even if a pre-trained model for identifying the “ingredient list” block on packaging is developed in the future, it is unlikely that results will be as good as those of a generative AI in the near future.

However, it is worth noting that implementing a generative model in the project would require paying per-token usage, which would generate high costs for Aillergic, making it unfeasible at this time.

5 Conclusion

Image processing techniques proved useful for improving OCR performance, but the lack of standardization in layouts, especially with complex designs, different packaging types, color variations, and fonts, limits optimization. As in the first version of the service, flat packages made of low-reflective materials such as cardboard, with simple layouts, yielded better results and did not require preprocessing. In contrast, packages made of materials that reflect more light, such as aluminum and regenerated cellulose (cellophane), labels with elaborate layouts (such as some soft drinks and sardine cans), and cylindrical and/or small packages that complicate image capture, showed varied results even with preprocessing.

Overall, there was an improvement in text extraction; however, in some cases, such as long aluminum cans with colored backgrounds or small candies wrapped in cellophane with extremely small text fonts, substantial improvements were not achieved. Regarding the optical character recognition tool, TesseractOCR remains the best option in terms of computational performance. Although EasyOCR yielded better results on some images with low similarity scores in TesseractOCR, it is a tool that requires high memory consumption, increasing the application’s execution time. It is also undeniable that labels on flat packages perform better.

Regarding the API, the shift from Java to Python facilitated integration with image processing libraries and tools.

For future work, it is suggested to find alternatives to overcome the lack of layout standardization, such as training a pre-trained model for text extraction and region of interest detection; however, this also requires expanding the training image database.

Author contributions. The authors contributed equally to all stages of the article: conception and design of the study; data collection, analysis, and interpretation; drafting and critical revision of the manuscript; and approval of the final version.
Funding. This work received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.
Data and materials availability. The dataset used in this study is publicly available at https://www.kaggle.com/datasets/andreiamf/lista-ingrdientes-ptbr. The source code is publicly available at https://github.com/andreiamferreira/processamento-imagens-ocr-tcc.
Conflicts of interest. The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Use of artificial intelligence. Generative artificial intelligence tools (Gemini, Claude, and ChatGPT) were used to assist in text synthesis, content organization, grammatical revision, and bibliographic reference formatting. In the empirical component of the study, generative AI was also used for comparative evaluation purposes, as described in the Discussion section. The authors declare that generative artificial intelligence was not used for data generation, fabrication of results, or autonomous production of scientific content attributable to authorship. All final analyses, interpretations, and writing decisions were conducted and reviewed by the authors.

References

  1. Kotchetkoff ECA, Yonamine GH. Reações adversas a alimentos. In: Pinotti R, Yonamine GH, organizadoras. Alergia alimentar: alimentação, nutrição e terapia nutricional. 1. ed. Barueri: Manole; 2020. p. 2-15.
  2. Rios JLM, Pinto SMEB, Santos LNC, Silva EM, Estanislau NRA, Motta MFAMA, et al. Non-IgE mediated food allergy: food protein-induced allergic proctocolitis - An update. AAAI. 2022;6(2):225-38. doi: https://doi.org/10.5935/2526-5393.20220023
  3. Solé D, Silva LR, Cocco RR, Ferreira CT, Sarni RO, Oliveira LC, et al. Consenso Brasileiro sobre Alergia Alimentar: 2018 - Parte 1 - Etiopatogenia, clínica e diagnóstico. Documento conjunto elaborado pela Sociedade Brasileira de Pediatria e Associação Brasileira de Alergia e Imunologia. Arquivos de Asma, Alergia e Imunologia. 2018;2(1). doi: https://doi.org/10.5935/2526-5393.20180004
  4. Solé D, Silva LR, Cocco RR, Ferreira CT, Sarni RO, Oliveira LC, et al. Consenso Brasileiro sobre Alergia Alimentar: 2018 - Parte 2 - Diagnóstico, tratamento e prevenção. Documento conjunto elaborado pela Sociedade Brasileira de Pediatria e Associação Brasileira de Alergia e Imunologia. Arquivos de Asma, Alergia e Imunologia. 2018;2(1). doi: https://doi.org/10.5935/2526-5393.20180005
  5. World Health Organization; Food and Agriculture Organization of the United Nations. Codex Alimentarius: general standard for the labelling of prepackaged foods [Internet]. Rome: WHO/FAO; 2018 [cited 2026 Nov 24]. Available from: https://www.fao.org/fao-who-codexalimentarius/sh-proxy/en/?lnk=1&url=https%253A%252F%252Fworkspace.fao.org%252Fsites%252Fcodex%252FStandards%252FCXS%2B1-1985%252FCXS_001e.pdf
  6. Põe no Rótulo. Põe no rótulo [Internet]. [cited 2026 May 16]. Available from: https://www.poenorotulo.com.br/.
  7. Agência Nacional de Vigilância Sanitária. Resolução da Diretoria Colegiada nº 26, de 2 de julho de 2015. Requisitos para rotulagem obrigatória dos principais alimentos que causam alergias alimentares [Internet]. Brasília: Ministério da Saúde; 2015 [cited 2026 May 16]. Available from: https://bvsms.saude.gov.br/bvs/saudelegis/anvisa/2015/rdc0026_26_06_2015.pdf
  8. Agência Nacional de Vigilância Sanitária. Resolução da Diretoria Colegiada nº 727, de 1 July 2022. Resolução sobre alimentos embalados [Internet]. Brasília: Ministério da Saúde; 2022 [cited 2026 May 16]. Available from: https://antigo.anvisa.gov.br/documents/10181/2718376/RDC_727_2022_.pdf
  9. Pereira RA, Guedes FM, Gadelha GA, Menin G, Menezes GP, Amantéa SL, et al. Alérgenos alimentares em rótulos de produtos alimentícios: uma unificação da nomenclatura. AAAI. 2024;8(2):125-8. doi: https://doi.org/10.5935/2526-5393.20230084
  10. Instituto Brasileiro de Geografia e Estatística. Pesquisa nacional por amostra de domicílios contínua: pessoas com deficiência 2022 [Internet]. Rio de Janeiro: IBGE; 2023 [cited 2026 Oct 18]. Available from: https://biblioteca.ibge.gov.br/visualizacao/livros/liv102013_informativo.pdf
  11. Menezes GP, Pereira RA, Guedes FM, Winck AT. Desenvolvimento de um aplicativo móvel para leitura e identificação de alérgenos em rótulos alimentares. In: Anais do XX Congresso Brasileiro de Informática em Saúde. São Paulo; 2024. p. 91-95. doi:10.5281/zenodo.14337625
  12. Gadelha GA, Pereira RA, Guedes FM, Winck AT. Processamento de Linguagem Natural na Identificação de Alérgenos em Rótulos Alimentares: Uma Aplicação no Contexto Brasileiro. J Health Inform. 2024;16(Especial). doi: https://doi.org/10.59681/2175-4411.v16.iespecial.2024.1325
  13. Menin G, Pereira RA, Guedes FM, Winck AT. API REST para reconhecimento óptico de caracteres em rótulos alimentares. J Health Inform. 2024;16(Especial). doi: https://doi.org/10.59681/2175-4411.v16.iespecial.2024.1316
  14. Sonka M, Hlavac V, Boyle R. Image pre-processing. In: Image Processing, Analysis and Machine Vision. Boston, MA: Springer US; 1993. p. 56-111. doi: https://doi.org/10.1007/978-1-4899-3216-7_4
  15. Gonzalez RC, Woods RE. Processamento digital de imagens. 3. ed. São Paulo: Pearson; 2010.
  16. Nogueira RCA. Análise de conversão de imagem colorida para tons de cinza via contraste percebido [Internet] [undergraduate thesis]. Recife: Universidade Federal de Pernambuco; 2016 [cited 2026 May 6]. Available from: https://www.cin.ufpe.br/~tg/2016-1/rcan.pdf
  17. Al-amri SS, Kalyankar NV, Khamitkar SD. Linear and non-linear contrast enhancement image. Int J Comput Sci Netw Secur. 2010;10(2):139. [cited 2026 Oct 18]. Available from: http://paper.ijcsns.org/07_book/201002/20100222.pdf
  18. Pizer SM, Amburn P, Austin JD, Cromartie R, Geselowitz A, Greer T, et al. Adaptive histogram equalization and its variations. Computer Vision, Graphics, and Image Processing. 1987;39(3):355-68. doi: https://doi.org/10.1016/s0734-189x(87)80186-x
  19. Shine NK, Bhutani G, Keerthana TS, Rohith G. An approach for improving Optical Character Recognition using Contrast enhancement technique. J. Phys.: Conf. Ser. 2023;2466(1):012009. doi: https://doi.org/10.1088/1742-6596/2466/1/012009
  20. Yang Z, Zuo S, Zhou Y, He J, Shi J. A Review of Document Binarization: Main Techniques, New Challenges, and Trends. Electronics. 2024;13(7):1394. doi: https://doi.org/10.3390/electronics13071394
  21. Barelli F. Introdução à visão computacional: uma abordagem prática com Python e OpenCV. São Paulo: Casa do Código; 2019.
  22. Jaided AI. EasyOCR documentation [Internet]. 2024 [cited 2026 May 16]. Available from: https://www.jaided.ai/easyocr/documentation/.
  23. TesseractOCR. Tesseract documentation [Internet]. 2024 [cited 2026 May 16]. Available from: https://github.com/tesseract-ocr/tessdoc.
  24. MongoDB. Documentation [Internet]. [cited 2026 May 16]. Available from: https://www.mongodb.com/docs.

Editorial notes

The Journal of Health Informatics is a scientific journal maintained by the Brazilian Society of Health Informatics (Sociedade Brasileira de Informática em Saúde), a non-profit scientific association dedicated to the development of Health Informatics and Digital Health in Brazil. The editorial process is conducted with scientific independence, free from institutional, commercial, or sponsor interference, and follows international best practices in publication ethics.

This article was double-blind peer reviewed by specialists in the field. The editorial team used artificial intelligence tools, under human supervision, in the initial screening, in checking the text, references and numbers and, when needed, in redrawing figures, charts and tables, which the authors approved in the proof. The tools and safeguards are described in the journal's Policy on the use of artificial intelligence. Editorial decisions were made by people.