我正在尝试构建一个shell脚本,允许我在图像中搜索文本.根据文本,脚本将尽力从图像中获取文本.我想要你的输入,因为这个脚本似乎适用于大多数图像,但不是那些文本字体颜色类似于文本周围较小环境的图像.
# !/bin/bash
#
# imt-ocr.sh is image magick tessearc OCR tool that is used for finding out text in image
#
# Arguments:
# 1 -- image filename (with path)
# 2 -- text to search in image (default to '')
# 3 -- occurence of text (default to 1)
# Usage:
# imt-ocr.sh [image_filename] [text_to_search] [occurence]
#
image=$1
txt=$2
occurence=$3 # Default to 1
if [ "$occurence" == "" ]
then
occurence=1
fi
get_major_color ()
# Returns the …
Run Code Online (Sandbox Code Playgroud)