图像中提取文本

news2024/9/27 7:23:19

将从此图像中提取文本。我使用得是 PyCharm,您随意编辑器或IDE

1、下载所需得库和exe文件:

tesseract-ocr

可执行exe文件下载后,安装时无需指定安装目录。

http://jaist.dl.sourceforge.net/project/tesseract-ocr-alt/tesseract-ocr-setup-3.02.02.exe

自动分配目录文件夹:

https://github.com/tesseract-ocr/tessdata

创建文件后,让我们安装所需的 Python 包。单击底部的终端,然后键

pip install pytesseract

英文:eng、中文:chi_sim

C:\Program Files (x86)\Tesseract-OCR\tessdata

2、修改配置文件中tessdata.exe文件的位置

注意到在pip安装pytesseract成功后,找到 pytesseract.py 文件所在的目录,并用pycharm打开后查看:

命令行紧跟在导入库后的这句指定exe文件位置的命令:

tesseract_cmd = 'tesseract' 修改后是:

#tesseract_cmd = 'tesseract'
tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'

修改后正确找到 tesseract.exe 文件

该语句的位置见后示意:

#!/usr/bin/env python
import re
import shlex
import string
import subprocess
import sys
from contextlib import contextmanager
from csv import QUOTE_NONE
from errno import ENOENT
from functools import wraps
from glob import iglob
from io import BytesIO
from os import environ
from os import extsep
from os import linesep
from os import remove
from os.path import normcase
from os.path import normpath
from os.path import realpath
from pkgutil import find_loader
from tempfile import NamedTemporaryFile
from time import sleep

from packaging.version import InvalidVersion
from packaging.version import parse
from packaging.version import Version
from PIL import Image


#tesseract_cmd = 'tesseract'
tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract.exe'

修改后,就可以可以几行命令实现OCR图像到文本的转换了!

3、如何使用?

3 行代码就可以实现图像 -> 文本转换

首先创建一个新文件命名为 text-from-image.py

alt

以上是需要处理的图片,存在text-from-image.py文件所在的目录下:

C:\Program Files (x86)\Tesseract-OCR\tesseract.exe

复制需要处理的图片到以上目录。

代码:

image = Image.open('Probability.png')
text = pytesseract.image_to_string(image,lang='eng')
print(text)

对话框输出:

alt

粘贴文本见后:

1. Basics of Probability
‘ Probability Definition
' Probability Terminologies
" Hutuallv Exclusive Events
“ Independent Events
'
 Dependent Events
‘ Permutations and Colbinations

2. Discrete Ranml Variable
‘ Discrete Probability Distribution
‘ Discrete Uniform Probability Distribution
' Binomial Probability Distribution
" Cululative Probability distribution

3. Continuous Random Variable

'
 Probability Density Function (PDF)

‘ Cululative Distribution Function (CDF)
Normal Probability Distribution
Standard Normal Distribution

注释:

pycharm选择py文件右键有查看文件目录位置。

然后,创建 image 的变量来读取和存储图像。图像与我们的 Python 文件位于同一目录中,因此我们只需要指定映像名称。

image = Image.open('image-to-text.png')

但是,如果映像位于另一个目录中,则必须指定完整路径。

例如,Mac 的“下载”中的图像将具有路径

/Users/your_username/Downloads/image-to-text.png

然后是文件名。

如果在 Windows 上,目录将是这样的

C:\\Users\Administrator\\Downloads\\image-to-text.png

请注意,在 Windows 上使用双反斜杠,而不是正斜杠。

然后,我们创建另一个称为text的变量,保存图像中的文本结果。

text = pytesseract.image_to_string( image )

然后,我们将结果打印。

print( text )

错误解决

如果跳过步骤 2、3 ,直接运行步骤3 的代码将有报错信息。

截屏

alt

报错信息:

pytesseract.pytesseract.TesseractNotFoundError: tesseract is not installed or it's not in your PATH. See README file for more information.

没有安装tesseract或者tesseract不在你的路径中!

在pytesseract模块中找到pytesseract.py文件并修改它

找到:

tesseract_cmd = 'tesseract' 

把它改为:

tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

tesseract_cmd给出的默认值实际上是tesseract的安装路径。

附录-1、如何.py to .exe ?

Pyinstaller

Pyinstaller是一个Python模块,用于将Python文件转换为可执行文件。

它将 Python 应用程序及其所有依赖项捆绑到一个包中。因此,您可以将 Python 文件转换为应用程序,用户可以在不安装 Python 及其包的情况下运行它。

若要使用,请先使用以下命令进行安装pyinstaller

pip install pyinstaller

成功安装后,将命令提示符重定向到包含 Python 脚本的文件夹。然后键入以下命令。

pyinstaller --onefile filename

好吧,如果我们看到您需要文件名和您的 Python 文件名。如下图所示,我将向您展示如何使用该命令将文件转换为。script.pyexe

我更推荐使用 auto-py-to-exe

它是一个 Gui 模块,其工作方式与工作相同,但在图形用户界面模式下。这意味着无需在 Python 文件位置文件夹中打开命令提示符并键入命令即可对其进行转换。

该模块将以更简单的方式进行对话。要安装此模块,请使用以下命令。

pip install auto-py-to-exe

安装此模块后,您需要通过在命令提示符下键入直接运行它,

cmd状态:pyinstaller

它将弹出如下所示的窗口

auto-py-to-exe

alt

附-2 pytesseract源码

便于了解代码实现和功能.

https://github.com/madmaze/pytesseract

#!/usr/bin/env python
import re
import shlex
import string
import subprocess
import sys
from contextlib import contextmanager
from csv import QUOTE_NONE
from errno import ENOENT
from functools import wraps
from glob import iglob
from io import BytesIO
from os import environ
from os import extsep
from os import linesep
from os import remove
from os.path import normcase
from os.path import normpath
from os.path import realpath
from pkgutil import find_loader
from tempfile import NamedTemporaryFile
from time import sleep

from packaging.version import InvalidVersion
from packaging.version import parse
from packaging.version import Version
from PIL import Image


tesseract_cmd = 'tesseract'

numpy_installed = find_loader('numpy') is not None
if numpy_installed:
    from numpy import ndarray

pandas_installed = find_loader('pandas') is not None
if pandas_installed:
    import pandas as pd

DEFAULT_ENCODING = 'utf-8'
LANG_PATTERN = re.compile('^[a-z_]+$')
RGB_MODE = 'RGB'
SUPPORTED_FORMATS = {
    'JPEG',
    'JPEG2000',
    'PNG',
    'PBM',
    'PGM',
    'PPM',
    'TIFF',
    'BMP',
    'GIF',
    'WEBP',
}

OSD_KEYS = {
    'Page number': ('page_num', int),
    'Orientation in degrees': ('orientation', int),
    'Rotate': ('rotate', int),
    'Orientation confidence': ('orientation_conf'float),
    'Script': ('script', str),
    'Script confidence': ('script_conf'float),
}

TESSERACT_MIN_VERSION = Version('3.05')
TESSERACT_ALTO_VERSION = Version('4.1.0')


class Output:
    BYTES = 'bytes'
    DATAFRAME = 'data.frame'
    DICT = 'dict'
    STRING = 'string'


class PandasNotSupported(EnvironmentError):
    def __init__(self):
        super().__init__('Missing pandas package')


class TesseractError(RuntimeError):
    def __init__(self, status, message):
        self.status = status
        self.message = message
        self.args = (status, message)


class TesseractNotFoundError(EnvironmentError):
    def __init__(self):
        super().__init__(
            f"{tesseract_cmd} is not installed or it's not in your PATH."
            f' See README file for more information.',
        )


class TSVNotSupported(EnvironmentError):
    def __init__(self):
        super().__init__(
            'TSV output not supported. Tesseract >= 3.05 required',
        )


class ALTONotSupported(EnvironmentError):
    def __init__(self):
        super().__init__(
            'ALTO output not supported. Tesseract >= 4.1.0 required',
        )


def kill(process, code):
    process.terminate()
    try:
        process.wait(1)
    except TypeError:  # python2 Popen.wait(1) fallback
        sleep(1)
    except Exception:  # python3 subprocess.TimeoutExpired
        pass
    finally:
        process.kill()
        process.returncode = code


@contextmanager
def timeout_manager(proc, seconds=None):
    try:
        if not seconds:
            yield proc.communicate()[1]
            return

        try:
            _, error_string = proc.communicate(timeout=seconds)
            yield error_string
        except subprocess.TimeoutExpired:
            kill(proc, -1)
            raise RuntimeError('Tesseract process timeout')
    finally:
        proc.stdin.close()
        proc.stdout.close()
        proc.stderr.close()


def run_once(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
        if wrapper._result is wrapper:
            wrapper._result = func(*args, **kwargs)
        return wrapper._result

    wrapper._result = wrapper
    return wrapper


def get_errors(error_string):
    return ' '.join(
        line for line in error_string.decode(DEFAULT_ENCODING).splitlines()
    ).strip()


def cleanup(temp_name):
    """Tries to remove temp files by filename wildcard path."""
    for filename in iglob(f'{temp_name}*' if temp_name else temp_name):
        try:
            remove(filename)
        except OSError as e:
            if e.errno != ENOENT:
                raise


def prepare(image):
    if numpy_installed and isinstance(image, ndarray):
        image = Image.fromarray(image)

    if not isinstance(image, Image.Image):
        raise TypeError('Unsupported image object')

    extension = 'PNG' if not image.format else image.format
    if extension not in SUPPORTED_FORMATS:
        raise TypeError('Unsupported image format/type')

    if 'A' in image.getbands():
        # discard and replace the alpha channel with white background
        background = Image.new(RGB_MODE, image.size, (255, 255, 255))
        background.paste(image, (0, 0), image.getchannel('A'))
        image = background

    image.format = extension
    return image, extension


@contextmanager
def save(image):
    try:
        with NamedTemporaryFile(prefix='tess_', delete=False) as f:
            if isinstance(image, str):
                yield f.name, realpath(normpath(normcase(image)))
                return
            image, extension = prepare(image)
            input_file_name = f'{f.name}_input{extsep}{extension}'
            image.save(input_file_name, format=image.format)
            yield f.name, input_file_name
    finally:
        cleanup(f.name)


def subprocess_args(include_stdout=True):
    # See https://github.com/pyinstaller/pyinstaller/wiki/Recipe-subprocess
    # for reference and comments.

    kwargs = {
        'stdin': subprocess.PIPE,
        'stderr': subprocess.PIPE,
        'startupinfo': None,
        'env': environ,
    }

    if hasattr(subprocess, 'STARTUPINFO'):
        kwargs['startupinfo'] = subprocess.STARTUPINFO()
        kwargs['startupinfo'].dwFlags |= subprocess.STARTF_USESHOWWINDOW
        kwargs['startupinfo'].wShowWindow = subprocess.SW_HIDE

    if include_stdout:
        kwargs['stdout'] = subprocess.PIPE
    else:
        kwargs['stdout'] = subprocess.DEVNULL

    return kwargs


def run_tesseract(
    input_filename,
    output_filename_base,
    extension,
    lang,
    config='',
    nice=0,
    timeout=0,
):
    cmd_args = []

    if not sys.platform.startswith('win32') and nice != 0:
        cmd_args += ('nice''-n', str(nice))

    cmd_args += (tesseract_cmd, input_filename, output_filename_base)

    if lang is not None:
        cmd_args += ('-l', lang)

    if config:
        cmd_args += shlex.split(config)

    if extension and extension not in {'box''osd''tsv''xml'}:
        cmd_args.append(extension)

    try:
        proc = subprocess.Popen(cmd_args, **subprocess_args())
    except OSError as e:
        if e.errno != ENOENT:
            raise
        else:
            raise TesseractNotFoundError()

    with timeout_manager(proc, timeout) as error_string:
        if proc.returncode:
            raise TesseractError(proc.returncode, get_errors(error_string))


def run_and_get_output(
    image,
    extension='',
    lang=None,
    config='',
    nice=0,
    timeout=0,
    return_bytes=False,
):

    with save(image) as (temp_name, input_filename):
        kwargs = {
            'input_filename': input_filename,
            'output_filename_base': temp_name,
            'extension': extension,
            'lang': lang,
            'config': config,
            'nice': nice,
            'timeout': timeout,
        }

        run_tesseract(**kwargs)
        filename = f"{kwargs['output_filename_base']}{extsep}{extension}"
        with open(filename, 'rb') as output_file:
            if return_bytes:
                return output_file.read()
            return output_file.read().decode(DEFAULT_ENCODING)


def file_to_dict(tsv, cell_delimiter, str_col_idx):
    result = {}
    rows = [row.split(cell_delimiter) for row in tsv.strip().split('\n')]
    if len(rows) < 2:
        return result

    header = rows.pop(0)
    length = len(header)
    if len(rows[-1]) < length:
        # Fixes bug that occurs when last text string in TSV is null, and
        # last row is missing a final cell in TSV file
        rows[-1].append('')

    if str_col_idx < 0:
        str_col_idx += length

    for i, head in enumerate(header):
        result[head] = list()
        for row in rows:
            if len(row) <= i:
                continue

            if i != str_col_idx:
                try:
                    val = int(float(row[i]))
                except ValueError:
                    val = row[i]
            else:
                val = row[i]

            result[head].append(val)

    return result


def is_valid(val, _type):
    if _type is int:
        return val.isdigit()

    if _type is float:
        try:
            float(val)
            return True
        except ValueError:
            return False

    return True


def osd_to_dict(osd):
    return {
        OSD_KEYS[kv[0]][0]: OSD_KEYS[kv[0]][1](kv[1])
        for kv in (line.split(': 'for line in osd.split('\n'))
        if len(kv) == 2 and is_valid(kv[1], OSD_KEYS[kv[0]][1])
    }


@run_once
def get_languages(config=''):
    cmd_args = [tesseract_cmd, '--list-langs']
    if config:
        cmd_args += shlex.split(config)

    try:
        result = subprocess.run(
            cmd_args,
            stdout=subprocess.PIPE,
            stderr=subprocess.STDOUT,
        )
    except OSError:
        raise TesseractNotFoundError()

    # tesseract 3.x
    if result.returncode not in (0, 1):
        raise TesseractNotFoundError()

    languages = []
    if result.stdout:
        for line in result.stdout.decode(DEFAULT_ENCODING).split(linesep):
            lang = line.strip()
            if LANG_PATTERN.match(lang):
                languages.append(lang)

    return languages


@run_once
def get_tesseract_version():
    """
    Returns Version object of the Tesseract version
    "
""
    try:
        output = subprocess.check_output(
            [tesseract_cmd, '--version'],
            stderr=subprocess.STDOUT,
            env=environ,
            stdin=subprocess.DEVNULL,
        )
    except OSError:
        raise TesseractNotFoundError()

    raw_version = output.decode(DEFAULT_ENCODING)
    str_version, *_ = raw_version.lstrip(string.printable[10:]).partition(' ')
    str_version, *_ = str_version.partition('-')

    try:
        version = parse(str_version)
        assert version >= TESSERACT_MIN_VERSION
    except (AssertionError, InvalidVersion):
        raise SystemExit(f'Invalid tesseract version: "{raw_version}"')

    return version


def image_to_string(
    image,
    lang=None,
    config='',
    nice=0,
    output_type=Output.STRING,
    timeout=0,
):
    """
    Returns the result of a Tesseract OCR run on the provided image to string
    "
""
    args = [image, 'txt', lang, config, nice, timeout]

    return {
        Output.BYTES: lambda: run_and_get_output(*(args + [True])),
        Output.DICT: lambda: {'text': run_and_get_output(*args)},
        Output.STRING: lambda: run_and_get_output(*args),
    }[output_type]()


def image_to_pdf_or_hocr(
    image,
    lang=None,
    config='',
    nice=0,
    extension='pdf',
    timeout=0,
):
    """
    Returns the result of a Tesseract OCR run on the provided image to pdf/hocr
    "
""

    if extension not in {'pdf''hocr'}:
        raise ValueError(f'Unsupported extension: {extension}')
    args = [image, extension, lang, config, nice, timeout, True]

    return run_and_get_output(*args)


def image_to_alto_xml(
    image,
    lang=None,
    config='',
    nice=0,
    timeout=0,
):
    """
    Returns the result of a Tesseract OCR run on the provided image to ALTO XML
    "
""

    if get_tesseract_version() < TESSERACT_ALTO_VERSION:
        raise ALTONotSupported()

    config = f'-c tessedit_create_alto=1 {config.strip()}'
    args = [image, 'xml', lang, config, nice, timeout, True]

    return run_and_get_output(*args)


def image_to_boxes(
    image,
    lang=None,
    config='',
    nice=0,
    output_type=Output.STRING,
    timeout=0,
):
    """
    Returns string containing recognized characters and their box boundaries
    "
""
    config = f'{config.strip()} batch.nochop makebox'
    args = [image, 'box', lang, config, nice, timeout]

    return {
        Output.BYTES: lambda: run_and_get_output(*(args + [True])),
        Output.DICT: lambda: file_to_dict(
            f'char left bottom right top page\n{run_and_get_output(*args)}',
            ' ',
            0,
        ),
        Output.STRING: lambda: run_and_get_output(*args),
    }[output_type]()


def get_pandas_output(args, config=None):
    if not pandas_installed:
        raise PandasNotSupported()

    kwargs = {'quoting': QUOTE_NONE, 'sep''\t'}
    try:
        kwargs.update(config)
    except (TypeError, ValueError):
        pass

    return pd.read_csv(BytesIO(run_and_get_output(*args)), **kwargs)


def image_to_data(
    image,
    lang=None,
    config='',
    nice=0,
    output_type=Output.STRING,
    timeout=0,
    pandas_config=None,
):
    """
    Returns string containing box boundaries, confidences,
    and other information. Requires Tesseract 3.05+
    "
""

    if get_tesseract_version() < TESSERACT_MIN_VERSION:
        raise TSVNotSupported()

    config = f'-c tessedit_create_tsv=1 {config.strip()}'
    args = [image, 'tsv', lang, config, nice, timeout]

    return {
        Output.BYTES: lambda: run_and_get_output(*(args + [True])),
        Output.DATAFRAME: lambda: get_pandas_output(
            args + [True],
            pandas_config,
        ),
        Output.DICT: lambda: file_to_dict(run_and_get_output(*args), '\t', -1),
        Output.STRING: lambda: run_and_get_output(*args),
    }[output_type]()


def image_to_osd(
    image,
    lang='osd',
    config='',
    nice=0,
    output_type=Output.STRING,
    timeout=0,
):
    """
    Returns string containing the orientation and script detection (OSD)
    "
""
    config = f'--psm 0 {config.strip()}'
    args = [image, 'osd', lang, config, nice, timeout]

    return {
        Output.BYTES: lambda: run_and_get_output(*(args + [True])),
        Output.DICT: lambda: osd_to_dict(run_and_get_output(*args)),
        Output.STRING: lambda: run_and_get_output(*args),
    }[output_type]()


def main():
    if len(sys.argv) == 2:
        filename, lang = sys.argv[1], None
    elif len(sys.argv) == 4 and sys.argv[1] == '-l':
        filename, lang = sys.argv[3], sys.argv[2]
    else:
        print('Usage: pytesseract [-l lang] input_file\n', file=sys.stderr)
        return 2

    try:
        with Image.open(filename) as img:
            print(image_to_string(img, lang=lang))
    except TesseractNotFoundError as e:
        print(f'{str(e)}\n', file=sys.stderr)
        return 1
    except OSError as e:
        print(f'{type(e).__name__}: {e}', file=sys.stderr)
        return 1


if __name__ == '__main__':
    exit(main())

本文由 mdnice 多平台发布

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/657175.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

代码随想录二刷day25 | 回溯 之 216.组合总和III 17.电话号码的字母组合

216.组合总和III 题目链接 解题思路&#xff1a; 选取过程如图&#xff1a; 图中&#xff0c;可以看出&#xff0c;只有最后取到集合&#xff08;1&#xff0c;3&#xff09;和为4 符合条件。 递归三部曲 确定递归函数参数 和77. 组合 一样&#xff0c;依然需要一维数组path…

走进人工智能|深度学习 算法的创世纪

前言&#xff1a; 深度学习通过训练深层神经网络模型&#xff0c;可以自动学习和提取数据的特征&#xff0c;包括更准确的图像识别、自然语言处理、医学诊断等方面的应用。 文章目录 序言背景算法的创世纪技术支持应用领域程序员如何学总结 序言 深度学习是一种机器学习方法&a…

easyui05(datagrid数据新增)

一.对话框&#xff1a;Dialog 加载页面 <div id"myDialog" style"display:none"></div> 二.editGoods.jsp 表单 myForm <head> <meta http-equiv"Content-Type" content"text/html; charsetUTF-8"> <tit…

2023年互联网Java面试复习大纲:ZK+Redis+MySQL+Java基础+架构

多数的公司总体上面试都是以自我介绍项目介绍项目细节/难点提问基础知识点考核算法题这个流程下来的。有些公司可能还会问几个实际的场景类的问题&#xff0c;这个环节阿里是必问的&#xff0c;这种问题通常是没有正确答案的&#xff0c;就看个人的理解&#xff0c;个人的积累了…

Vue练手项目之仿京东到家主页

目录 概述1.效果展示2.使用原始HtmlCSS实现3.使用Vue.js进行组件化3.1 Header部分组件实现3.1.1图标的展示3.1.2 定义Vue调试的名称3.1.3 使用scoped隔离组件间的css影响 3.2 附近店铺部分实现3.3 底部导航栏组件的实现3.4 将组件组成一个整体页面 4.代码地址 概述 本人是一个…

【微信小程序开发】第 9 课 - 小程序的协同工作和发布

欢迎来到博主 Apeiron 的博客&#xff0c;祝您旅程愉快 &#xff01; 时止则止&#xff0c;时行则行。动静不失其时&#xff0c;其道光明。 目录 1、协同工作 1.1、了解权限管理需求 1.2、了解项目成员的组织结构 1.3、小程序的开发流程 2、小程序成员管理 2.1、成员管…

【Unity Shader】Special Effects(八)Wireframe 线框化(UI)

更新日期:2023年6月17日。 Github源码:[点我获取源码] 索引 Wireframe 线框化思路分析Sobel算子片元输入数据结构-定义片元输入数据结构-填充片元输入数据结构-传入属性定义求梯度值方法求边缘方法范围控制线框化渐变动画Wireframe 线框化 线框化效果可以将一张图像根据纹理…

从618「技术暗战」,看乡村振兴的未来「赛点」

作者 | 曾响铃 文 | 响铃说 作为消费复苏后的首个消费节点&#xff0c;从“史上消费者福利最大的618”“史上投入最大的一届618”等口号&#xff0c;都能感觉到这届618的火药味比以往要浓得多。 有业内人士透露&#xff0c;这次的年中大促无论从商品种类、数量还是提供的服务…

【自动化测试】是否有必要做自动化测试?

‍目录 一、前言 二、自动化目的 三、自动化分类 四、自动化实现 一、前言 在一些测试交流群经常会看到有小伙伴在问&#xff0c;"怎么做自动化测试&#xff1f;学习自动化测试有什么资料吗&#xff1f;自动化测试是不是很牛逼&#xff1f;" &#xff0c;甚至有…

Python之面向对象和继承

一、关于None和判断的总结 1.1、None是什么&#xff1f; 与C和JAVA不同&#xff0c;python中是没有NULL的&#xff0c;取而代之的是None。None是一个特殊的常量&#xff0c;表示变量没有指向任何对象。在Python中&#xff0c;None本身实际上也是对象&#xff0c;有自己的类型N…

浅谈自动化测试框架开发

在自动化测试项目中&#xff0c;为了实现更多功能&#xff0c;我们需要引入不同的库、框架。 首先&#xff0c;你需要将常用的这些库、框架都装上。 pip install requests pip install selenium pip install appium pip install pytest pip install pytest-rerunfailures pip …

【深度学习】基于pytorch的FER2013人脸表情图像识别(ResNet/VGG/DenseNet)

题目要求 1.1. 任务要求 数据集&#xff1a;Facial Expression Recognition Challenge&#xff0c;共有7类&#xff1a;生气、恶心、害怕、快乐、悲伤、惊讶、中性。 基本要求&#xff08;50%&#xff09;&#xff1a;构建ResNet分类模型18层。 改进&#xff08;30%&#x…

Disruptor(1):Disruptor简介

1 什么是Disruptor Martin Fowler在自己网站上写了一篇LMAX架构的文章&#xff0c;在文章中他介绍了LMAX是一种新型零售金融交易平台&#xff0c;它能够以很低的延迟产生大量交易。这个系统是建立在JVM平台上&#xff0c;其核心是一个业务逻辑处理器&#xff0c;它能够在一个线…

如何关闭电脑自动更新?一招教你永久关闭!

百度安全验证https://baijiahao.baidu.com/s?id1749271752443309717

《微服务架构设计模式》第三章 微服务架构中的进程间通信

内容总结自《微服务架构设计模式》 微服务架构中的进程间通信 一、通信概述通信方式API定义消息格式 二、同步通信RESTgRPC断路器服务发现 三、异步通信消息消息通道消息代理消息问题 ) 一、通信概述 通信方式 有很多进程间通信技术可供开发者选择。服务可以使用基于同步请求…

国产操作系统介绍和安装

国产操作系统 分类 操作系统分类国产操作系统银河麒麟中科方德统信UOS红旗Linux深度系统优麒麟系统 具体介绍 麒麟操作系统 麒麟操作系统&#xff08;Kylin操作系统&#xff0c;简称麒麟OS&#xff09;&#xff0c;是一种国产操作系统&#xff0c;由国防科技大学研发&#x…

【Pandas】pandas用法解析(二)

一、生成数据表 二、数据表信息查看 三、数据表清洗 四、数据预处理 ———————————————— 目录 五、数据提取 1.按索引提取单行的数值 2.按索引提取区域行数值 3.重设索引 4.设置日期为索引 5.提取4日之前的所有数据 6.使用iloc按位置区域提取数据 7…

Java线程生命周期详解

前言一、线程的生命周期二、线程状态转换三、线程生命周期示例结束语 前言 Java中的线程生命周期是多线程开发的核心概念。了解线程的生命周期以及它们如何进行状态转换对于编写有效且无错误的多线程程序至关重要。 一、线程的生命周期 Java线程主要有以下几个状态&#xff…

离散数学题目收集整理练习(期末过关进度80%~100%)完结撒花

✨博主&#xff1a;命运之光 &#x1f984;专栏&#xff1a;离散数学考前复习&#xff08;知识点题&#xff09; &#x1f353;专栏&#xff1a;概率论期末速成&#xff08;一套卷&#xff09; &#x1f433;专栏&#xff1a;数字电路考前复习 &#x1f31f;博主的其他文章&…

UG NX二次开发(C#)-外部模式-导出dwg格式文件

文章目录 1、前言2、在UG NX界面中导出DWG的操作2.1 打开三维模型2.2 创建二维工程制图2.3 导出工程图纸3、采用NXOpen(C#)二次开发实现1、前言 在我们实际使用过程中,经常会用到不同软件之间的数据转换,数据转换是通过通用标准文件来实现的。当然,在三维转二维过程中,dwg…