构建 Python 相机 SDK 并使用它进行多条码扫描

现在,轻量级 c 相机 sdk 已针对 windowslinuxmacos 完成,我们可以将其集成到其他高级编程语言中。在本文中,我们将探讨如何基于 c 相机库构建 python 相机 sdk,并使用它与 dynamsoft barcode reader sdk 进行多条码扫描。

python 多条码扫描仪演示视频

搭建 cpython 扩展项目的脚手架

cpython 扩展是一个共享库(例如,windows 上的 dll、linux 上的 .so 或 macos 上的 .dylib)可以在运行时加载到python解释器中并用于扩展其功能。 lite相机cpython扩展项目的结构如下:

python-lite-camera││── include│   ├── camera.h│   ├── camerapreview.h│   ├── stb_image_write.h│── lib│   ├── linux│   │   ├── liblitecam.so│   ├── macos│   │   ├── liblitecam.dylib│   ├── windows│   │   ├── litecam.dll│   │   ├── litecam.lib├── src│   ├── litecam.cpp│   ├── pycamera.h│   ├── pywindow.h│── litecam│   ├── __init__.py│── setup.py│── manifest.in│── readme.md

说明

include:c 相机库的头文件。lib:c 相机库的共享库。src:python相机sdk的源代码。litecam:python 扩展的入口点。setup.py:构建脚本。manifest.in:包含非python文件的清单文件。readme.md:文档。

为 python 扩展编写构建脚本 setup.py

在setup.py中添加以下内容:

from setuptools.command import build_extfrom setuptools import setup, extensionimport sysimport osimport iofrom setuptools.command.install import installimport shutilfrom pathlib import pathlib_dir = ''sources = [    "src/litecam.cpp",]include_dirs = [os.path.join(os.path.dirname(__file__), "include")]libraries = ['litecam']extra_compile_args = []if sys.platform == "linux" or sys.platform == "linux2":    lib_dir = 'lib/linux'    extra_compile_args = ['-std=c++11']    extra_link_args = ["-wl,-rpath=$origin"]elif sys.platform == "darwin":    lib_dir = 'lib/macos'    extra_compile_args = ['-std=c++11']    extra_link_args = ["-wl,-rpath,@loader_path"]elif sys.platform == "win32":    lib_dir = 'lib/windows'    extra_link_args = []else:    raise runtimeerror("unsupported platform")long_description = io.open("readme.md", encoding="utf-8").read()module_litecam = extension(    "litecam",    sources=sources,    include_dirs=include_dirs,    library_dirs=[lib_dir],    libraries=libraries,    extra_compile_args=extra_compile_args,    extra_link_args=extra_link_args,)def copyfiles(src, dst):    if os.path.isdir(src):        filelist = os.listdir(src)        for file in filelist:            libpath = os.path.join(src, file)            shutil.copy2(libpath, dst)    else:        shutil.copy2(src, dst)class custombuildext(build_ext.build_ext):    def run(self):        build_ext.build_ext.run(self)        dst = os.path.join(self.build_lib, "litecam")        copyfiles(lib_dir, dst)        filelist = os.listdir(self.build_lib)        for file in filelist:            filepath = os.path.join(self.build_lib, file)            if not os.path.isdir(file):                copyfiles(filepath, dst)                os.remove(filepath)class custombuildextdev(build_ext.build_ext):    def run(self):        build_ext.build_ext.run(self)        dev_folder = os.path.join(path(__file__).parent, 'litecam')        copyfiles(lib_dir, dev_folder)        filelist = os.listdir(self.build_lib)        for file in filelist:            filepath = os.path.join(self.build_lib, file)            if not os.path.isdir(file):                copyfiles(filepath, dev_folder)class custominstall(install):    def run(self):        install.run(self)setup(name='lite-camera',      version='2.0.1',      description='litecam is a lightweight, cross-platform library for capturing rgb frames from cameras and displaying them. designed with simplicity and ease of integration in mind, litecam supports windows, linux and macos platforms.',      long_description=long_description,      long_description_content_type="text/markdown",      author='yushulx',      url='https://github.com/yushulx/python-lite-camera',      license='mit',      packages=['litecam'],      ext_modules=[module_litecam],      classifiers=[           "development status :: 5 - production/stable",           "environment :: console",           "intended audience :: developers",          "intended audience :: education",          "intended audience :: information technology",          "intended audience :: science/research",          "license :: osi approved :: mit license",          "operating system :: microsoft :: windows",          "operating system :: macos",          "operating system :: posix :: linux",          "programming language :: python",          "programming language :: python :: 3",          "programming language :: python :: 3 :: only",          "programming language :: python :: 3.6",          "programming language :: python :: 3.7",          "programming language :: python :: 3.8",          "programming language :: python :: 3.9",          "programming language :: python :: 3.10",          "programming language :: python :: 3.11",          "programming language :: python :: 3.12",          "programming language :: c++",          "programming language :: python :: implementation :: cpython",          "topic :: scientific/engineering",          "topic :: software development",      ],      cmdclass={          'install': custominstall,          'build_ext': custombuildext,          'develop': custombuildextdev},      )

说明

lite-camera:python 包的名称。ext_modules:cpython 扩展列表。它指定不同平台的源文件、包含目录、库目录、库以及编译/链接标志。开发:用于开发的自定义命令。它将共享库复制到 litecam 文件夹以方便测试。build_ext:自定义构建过程,将共享库打包到wheel包中。

用 c 实现 python camera sdk api

pycamera.h 文件定义了用于从相机捕获帧的 pycamera python 类,而 pywindow.h 文件定义了用于在窗口中显示帧的 pywindow python 类。 litecam.cpp 文件作为 python 扩展的入口点,其中定义了一些全局方法,并注册了 pycamera 和 pywindow 类。

pycamera.h

包括

#include #include #include "camera.h"

python.h:包含使用 python c api。structmember.h:提供用于管理对象成员的宏和帮助器。camera.h:定义 camera 类,pycamera 扩展对其进行包装。

pycamera 结构体定义

typedef struct{    pyobject_head camera *handler;} pycamera;

pycamera 结构体表示包装 c camera 对象的 python 对象。该处理程序是一个指向 camera 类实例的指针。

立即学习“Python免费学习笔记(深入)”;

方法

pycamera_dealloc

8556677774455

解除分配 camera 对象并释放关联的内存。

pycamera_new

static pyobject *pycamera_new(pytypeobject *type, pyobject *args, pyobject *kwds){    pycamera *self;    self = (pycamera *)type->tp_alloc(type, 0);    if (self != null)    {        self->handler = new camera();    }    return (pyobject *)self;}

创建 pycamera 的新实例。它为python对象分配内存,创建一个新的camera对象,并将其分配给self->handler。

开放

static pyobject *open(pyobject *obj, pyobject *args){    pycamera *self = (pycamera *)obj;    int index = 0;    if (!pyarg_parsetuple(args, "i", &index))    {        return null;    }    bool ret = self->handler->open(index);    return py_buildvalue("i", ret);}

打开指定索引的相机。

列表媒体类型

static pyobject *listmediatypes(pyobject *obj, pyobject *args){    pycamera *self = (pycamera *)obj;    std::vector mediatypes = self->handler->listsupportedmediatypes();    pyobject *pylist = pylist_new(0);    for (size_t i = 0; i < mediatypes.size(); i++)    {        mediatypeinfo &mediatype = mediatypes[i];#ifdef _win32        pyobject *subtypename = pyunicode_fromwidechar(mediatype.subtypename, wcslen(mediatype.subtypename));        pyobject *pymediatype = py_buildvalue("{s:i,s:i,s:o}",                                              "width", mediatype.width,                                              "height", mediatype.height,                                              "subtypename", subtypename);        if (subtypename != null)        {            py_decref(subtypename);        }#else        pyobject *pymediatype = py_buildvalue("{s:i,s:i,s:s}",                                              "width", mediatype.width,                                              "height", mediatype.height,                                              "subtypename", mediatype.subtypename);#endif        pylist_append(pylist, pymediatype);    }    return pylist;}

返回支持的媒体类型列表。对于 windows,它将宽字符串转换为 python unicode 对象。

发布

static pyobject *release(pyobject *obj, pyobject *args){    pycamera *self = (pycamera *)obj;    self->handler->release();    py_return_none;}

释放相机。

设置分辨率

static pyobject *setresolution(pyobject *obj, pyobject *args){    pycamera *self = (pycamera *)obj;    int width = 0, height = 0;    if (!pyarg_parsetuple(args, "ii", &width, &height))    {        return null;    }    int ret = self->handler->setresolution(width, height);    return py_buildvalue("i", ret);}

设置相机的分辨率。

捕获帧

static pyobject *captureframe(pyobject *obj, pyobject *args){    pycamera *self = (pycamera *)obj;    framedata frame = self->handler->captureframe();    if (frame.rgbdata)    {        pyobject *rgbdata = pybytearray_fromstringandsize((const char *)frame.rgbdata, frame.size);        pyobject *pyframe = py_buildvalue("iiio", frame.width, frame.height, frame.size, rgbdata);        releaseframe(frame);        return pyframe;    }    else    {        py_return_none;    }}

从相机捕获帧并将 rgb 数据作为 python 字节数组返回。

getwidth 和 getheight

static pyobject *getwidth(pyobject *obj, pyobject *args){    pycamera *self = (pycamera *)obj;    int width = self->handler->framewidth;    return py_buildvalue("i", width);}static pyobject *getheight(pyobject *obj, pyobject *args){    pycamera *self = (pycamera *)obj;    int height = self->handler->frameheight;    return py_buildvalue("i", height);}

返回捕获帧的宽度和高度。

实例方法

static pymethoddef instance_methods[] = {    {"open", open, meth_varargs, null},    {"listmediatypes", listmediatypes, meth_varargs, null},    {"release", release, meth_varargs, null},    {"setresolution", setresolution, meth_varargs, null},    {"captureframe", captureframe, meth_varargs, null},    {"getwidth", getwidth, meth_varargs, null},    {"getheight", getheight, meth_varargs, null},    {null, null, 0, null}};

定义 pycamera python 对象上可用的方法。这些方法与上面定义的相应 c 函数相关联。

pycamera类型

static pytypeobject pycameratype = {    pyvarobject_head_init(null, 0) "litecam.pycamera", /* tp_name */    sizeof(pycamera),                                  /* tp_basicsize */    0,                                                 /* tp_itemsize */    (destructor)pycamera_dealloc,                      /* tp_dealloc */    0,                                                 /* tp_print */    0,                                                 /* tp_getattr */    0,                                                 /* tp_setattr */    0,                                                 /* tp_reserved */    0,                                                 /* tp_repr */    0,                                                 /* tp_as_number */    0,                                                 /* tp_as_sequence */    0,                                                 /* tp_as_mapping */    0,                                                 /* tp_hash  */    0,                                                 /* tp_call */    0,                                                 /* tp_str */    pyobject_genericgetattr,                           /* tp_getattro */    pyobject_genericsetattr,                           /* tp_setattro */    0,                                                 /* tp_as_buffer */    py_tpflags_default | py_tpflags_basetype,          /*tp_flags*/    "pycamera",                                        /* tp_doc */    0,                                                 /* tp_traverse */    0,                                                 /* tp_clear */    0,                                                 /* tp_richcompare */    0,                                                 /* tp_weaklistoffset */    0,                                                 /* tp_iter */    0,                                                 /* tp_iternext */    instance_methods,                                  /* tp_methods */    0,                                                 /* tp_members */    0,                                                 /* tp_getset */    0,                                                 /* tp_base */    0,                                                 /* tp_dict */    0,                                                 /* tp_descr_get */    0,                                                 /* tp_descr_set */    0,                                                 /* tp_dictoffset */    0,                                                 /* tp_init */    0,                                                 /* tp_alloc */    pycamera_new,                                      /* tp_new */};

定义 pycamera 类型,包括其方法、内存分配、释放和其他行为。

pywindow.h

包括

#include #include #include "camerapreview.h"

python.h:使用 python c api 所需的。structmember.h:提供管理对象成员的宏。camerapreview.h:定义camerawindow类,用于显示相机预览并与其交互。

pywindow 结构体定义

typedef struct{    pyobject_head camerawindow *handler;} pywindow;

定义一个包装 c camerawindow 对象的 pywindow 结构体。 handler 成员指向 camerawindow 的一个实例。

pywindow 对象的方法

pywindow_dealloc

static int pywindow_clear(pywindow *self){    if (self->handler)    {        delete self->handler;    }    return 0;}static void pywindow_dealloc(pywindow *self){    pywindow_clear(self);    py_type(self)->tp_free((pyobject *)self);}

取消分配camerawindow对象并释放内存。

pywindow_new

static pyobject *pywindow_new(pytypeobject *type, pyobject *args, pyobject *kwds){    pywindow *self;    int width = 0, height = 0;    char *title = null;    if (!pyarg_parsetuple(args, "iis", &width, &height, &title))    {        return null;    }    self = (pywindow *)type->tp_alloc(type, 0);    if (self != null)    {        self->handler = new camerawindow(width, height, title);        if (!self->handler->create())        {            std::cerr << "failed to create window." <handler->show();    }    return (pyobject *)self;}

创建 pywindow 的新实例。它为python对象分配内存,创建一个新的camerawindow对象,并将其分配给self->handler。

等待键

static pyobject *waitkey(pyobject *obj, pyobject *args){    pywindow *self = (pywindow *)obj;    const char *key = null;    if (!pyarg_parsetuple(args, "s", &key) || strlen(key) != 1)    {        pyerr_setstring(pyexc_valueerror, "expected a single character string");        return null;    }    bool ret = self->handler->waitkey(key[0]);    return py_buildvalue("i", ret);}

等待按键事件,如果按键与指定字符匹配则返回 false。 false 意味着应用程序应该退出。

showframe

static pyobject *showframe(pyobject *obj, pyobject *args){    pywindow *self = (pywindow *)obj;    int width = 0, height = 0;    pyobject *bytearray = null;    if (!pyarg_parsetuple(args, "iio", &width, &height, &bytearray))    {        return null;    }    unsigned char *data = (unsigned char *)pybytearray_asstring(bytearray);    self->handler->showframe(data, width, height);    py_return_none;}

在窗口中显示一个框架。

绘制轮廓

static pyobject *drawcontour(pyobject *obj, pyobject *args){    pywindow *self = (pywindow *)obj;    pyobject *pypoints = null;    if (!pyarg_parsetuple(args, "o", &pypoints))    {        return null;    }    std::vector<std::pair> points;    for (py_ssize_t i = 0; i handler->drawcontour(points);    py_return_none;}

在框架上绘制轮廓(一系列点)。

绘制文本

static pyobject *drawtext(pyobject *obj, pyobject *args){    pywindow *self = (pywindow *)obj;    const char *text = null;    int x = 0, y = 0, fontsize = 0;    pyobject *pycolor = null;    if (!pyarg_parsetuple(args, "siiio", &text, &x, &y, &fontsize, &pycolor))    {        return null;    }    camerawindow::color color;    color.r = (unsigned char)pylong_aslong(pytuple_getitem(pycolor, 0));    color.g = (unsigned char)pylong_aslong(pytuple_getitem(pycolor, 1));    color.b = (unsigned char)pylong_aslong(pytuple_getitem(pycolor, 2));    self->handler->drawtext(text, x, y, fontsize, color);    py_return_none;}

在框架上绘制文本。

窗口实例方法

static pymethoddef window_instance_methods[] = {    {"waitkey", waitkey, meth_varargs, null},    {"showframe", showframe, meth_varargs, null},    {"drawcontour", drawcontour, meth_varargs, null},    {"drawtext", drawtext, meth_varargs, null},    {null, null, 0, null}};

定义 pywindow python 对象上可用的方法。

pywindow类型

static pytypeobject pywindowtype = {    pyvarobject_head_init(null, 0) "litecam.pywindow", /* tp_name */    sizeof(pywindow),                                  /* tp_basicsize */    0,                                                 /* tp_itemsize */    (destructor)pywindow_dealloc,                      /* tp_dealloc */    0,                                                 /* tp_print */    0,                                                 /* tp_getattr */    0,                                                 /* tp_setattr */    0,                                                 /* tp_reserved */    0,                                                 /* tp_repr */    0,                                                 /* tp_as_number */    0,                                                 /* tp_as_sequence */    0,                                                 /* tp_as_mapping */    0,                                                 /* tp_hash  */    0,                                                 /* tp_call */    0,                                                 /* tp_str */    pyobject_genericgetattr,                           /* tp_getattro */    pyobject_genericsetattr,                           /* tp_setattro */    0,                                                 /* tp_as_buffer */    py_tpflags_default | py_tpflags_basetype,          /*tp_flags*/    "pywindow",                                        /* tp_doc */    0,                                                 /* tp_traverse */    0,                                                 /* tp_clear */    0,                                                 /* tp_richcompare */    0,                                                 /* tp_weaklistoffset */    0,                                                 /* tp_iter */    0,                                                 /* tp_iternext */    window_instance_methods,                           /* tp_methods */    0,                                                 /* tp_members */    0,                                                 /* tp_getset */    0,                                                 /* tp_base */    0,                                                 /* tp_dict */    0,                                                 /* tp_descr_get */    0,                                                 /* tp_descr_set */    0,                                                 /* tp_dictoffset */    0,                                                 /* tp_init */    0,                                                 /* tp_alloc */    pywindow_new,                                      /* tp_new */};

定义 pywindow 类型,包括其方法、内存分配、释放和其他行为。

litecam.cpp

#include #include #include "pycamera.h"#include "pywindow.h"#define initerror return nullstatic pyobject *getdevicelist(pyobject *obj, pyobject *args){    pyobject *pylist = pylist_new(0);    std::vector devices = listcapturedevices();    for (size_t i = 0; i < devices.size(); i++)    {        capturedeviceinfo &device = devices[i];#ifdef _win32        pyobject *pyname = pyunicode_fromwidechar(device.friendlyname, wcslen(device.friendlyname));        if (pyname != null)        {            pylist_append(pylist, pyname);            py_decref(pyname);        }#else        pyobject *pyname = pyunicode_fromstring(device.friendlyname);        if (pyname != null)        {            pylist_append(pylist, pyname);            py_decref(pyname);        }#endif    }    return pylist;}static pyobject *savejpeg(pyobject *obj, pyobject *args){    const char *filename = null;    int width = 0, height = 0;    pyobject *bytearray = null;    if (!pyarg_parsetuple(args, "siio", &filename, &width, &height, &bytearray))    {        pyerr_setstring(pyexc_typeerror, "expected arguments: str, int, int, pybytearray");        return null;    }    unsigned char *data = (unsigned char *)pybytearray_asstring(bytearray);    py_ssize_t size = pybytearray_size(bytearray);    if (size != (py_ssize_t)(width * height * 3))    {        pyerr_setstring(pyexc_valueerror, "invalid byte array size for the given width and height.");        return null;    }    saveframeasjpeg(data, width, height, filename);    py_return_none;}static pymethoddef litecam_methods[] = {    {"getdevicelist", getdevicelist, meth_varargs, "get available cameras"},    {"savejpeg", savejpeg, meth_varargs, "get available cameras"},    {null, null, 0, null}};static struct pymoduledef litecam_module_def = {    pymoduledef_head_init,    "litecam",    "internal "litecam" module",    -1,    litecam_methods};pymodinit_func pyinit_litecam(void){    pyobject *module = pymodule_create(&litecam_module_def);    if (module == null)        initerror;    if (pytype_ready(&pycameratype) < 0)    {        printf("failed to initialize pycameratypen");        py_decref(module);        return null;    }    if (pymodule_addobject(module, "pycamera", (pyobject *)&pycameratype) < 0)    {        printf("failed to add pycamera to the modulen");        py_decref(&pycameratype);        py_decref(module);        initerror;    }    if (pytype_ready(&pywindowtype) < 0)    {        printf("failed to initialize pywindowtypen");        py_decref(module);        return null;    }    if (pymodule_addobject(module, "pywindow", (pyobject *)&pywindowtype) < 0)    {        printf("failed to add pywindow to the modulen");        py_decref(&pywindowtype);        py_decref(module);        initerror;    }    return module;}

说明

getdevicelist:返回可用摄像头的列表。savejpeg:将帧保存为 jpeg 图像。pyinit_litecam:初始化litecam模块并注册pycamera和pywindow类型。

构建 python 相机 sdk

开发模式

python setup.py develop

轮组

python setup.py bdist_wheel

来源分布

python setup.py sdist

实现 python 多条码扫描器的步骤

安装python相机sdk和dynamsoft barcode reader sdk:

pip install lite-camera dynamsoft-capture-vision-bundle

获取 dynamsoft barcode reader 30 天免费试用许可证。

创建用于多条码扫描的 python 脚本:

import litecamfrom dynamsoft_capture_vision_bundle import *import queueclass framefetcher(imagesourceadapter):    def has_next_image_to_fetch(self) -> bool:        return true    def add_frame(self, imagedata):        self.add_image_to_buffer(imagedata)class mycapturedresultreceiver(capturedresultreceiver):    def __init__(self, result_queue):        super().__init__()        self.result_queue = result_queue    def on_captured_result_received(self, captured_result):        self.result_queue.put(captured_result)if __name__ == '__main__':    errorcode, errormsg = licensemanager.init_license(        "license-key")    if errorcode != enumerrorcode.ec_ok and errorcode != enumerrorcode.ec_license_cache_used:        print("license initialization failed: errorcode:",              errorcode, ", errorstring:", errormsg)    else:        camera = litecam.pycamera()        if camera.open(0):            cvr = capturevisionrouter()            fetcher = framefetcher()            cvr.set_input(fetcher)            result_queue = queue.queue()            receiver = mycapturedresultreceiver(result_queue)            cvr.add_result_receiver(receiver)            errorcode, errormsg = cvr.start_capturing(                enumpresettemplate.pt_read_barcodes.value)            if errorcode != enumerrorcode.ec_ok:                print("error:", errormsg)            window = litecam.pywindow(                camera.getwidth(), camera.getheight(), "camera stream")            while window.waitkey('q'):                frame = camera.captureframe()                if frame is not none:                    width = frame[0]                    height = frame[1]                    size = frame[2]                    data = frame[3]                    window.showframe(width, height, data)                    imagedata = imagedata(                        bytes(data), width, height, width * 3, enumimagepixelformat.ipf_rgb_888)                    fetcher.add_frame(imagedata)                    if not result_queue.empty():                        captured_result = result_queue.get_nowait()                        items = captured_result.get_items()                        for item in items:                            if item.get_type() == enumcapturedresultitemtype.crit_barcode:                                text = item.get_text()                                location = item.get_location()                                x1 = location.points[0].x                                y1 = location.points[0].y                                x2 = location.points[1].x                                y2 = location.points[1].y                                x3 = location.points[2].x                                y3 = location.points[2].y                                x4 = location.points[3].x                                y4 = location.points[3].y                                contour_points = [                                    (x1, y1), (x2, y2), (x3, y3), (x4, y4)]                                window.drawcontour(contour_points)                                window.drawtext(text, x1, y1, 24, (255, 0, 0))                                del location            camera.release()            cvr.stop_capturing()

将 license-key 替换为您的 dynamsoft barcode reader 许可证密钥。

运行脚本:

python main.py

python multi-barcode scanner

源代码

https://github.com/yushulx/python-lite-camera

以上就是构建 Python 相机 SDK 并使用它进行多条码扫描的详细内容,更多请关注创想鸟其它相关文章!

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1355262.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
全部在 PyTorch 中
上一篇 2025年12月13日 19:08:06
CS-第 6 周
下一篇 2025年12月13日 19:08:19

相关推荐

  • 如何解决地理计算中的复杂问题?使用Composer安装alexpechkarev/geometry-library可以!

    可以通过以下地址学习 Composer:学习地址 在开发一个涉及地理数据计算的项目时,我遇到了一个棘手的问题:需要计算地球表面上的角度、距离和面积等几何数据。尝试了多种方法后,我发现这些计算不仅复杂,而且容易出错。最终,通过 composer 安装 alexpechkarev/geometry-li…

    用户投稿 2026年8月28日
    000
  • 希沃参与编制国家标准《信息化教学环境视听技术》,将于12月实施

    近日,希沃参与编制的一项新国家标准正式发布。国家标准化管理委员会于今年5月发布了《信息化教学环境视听技术要求》国家标准。该标准由清华大学主导,华南理工大学等全国40余家高校、科研机构和企业共同参与研制。其中,广州视睿电子科技有限公司(希沃)作为核心起草单位,深度参与了标准的编制工作,充分展现了企业在…

    2026年8月28日
    100
  • 生成与理解相互促进!华科字节提出Liquid,揭示统一多模态模型尺度规律!

    生成与理解相互促进!华科字节提出Liquid,揭示统一多模态模型尺度规律!生成与理解相互促进!华科字节提出Liquid,揭示统一多模态模型尺度规律!生成与理解相互促进!华科字节提出Liquid,揭示统一多模态模型尺度规律!生成与理解相互促进!华科字节提出Liquid,揭示统一多模态模型尺度规律!

    华中科技大学、字节跳动和香港大学联合团队研发了一种名为liquid的极简统一多模态生成框架,该框架无需复杂的外部视觉模块,即可实现图像生成和理解。liquid巧妙地利用vqgan将图像编码为离散视觉token,并将其与文本token整合到同一词表空间,从而使现有的大型语言模型(llm)能够直接处理视…

    2026年8月28日 用户投稿
    000
  • linux中..是什么意思

    linux ..什么意思? 在Linux中.代表你的当前目录即”pwd”命令所返回的目录, 在Linux中..代表你的当前目录的上一级目录,及当前目录的父目录(或叫父路径) 如:cd .. 就是回到上一级;cd ../.. 就是回到上两级。 相关推荐:《Linux教程》 相关…

    2026年8月28日
    000
  • win10怎么清理系统垃圾_win10深度清理系统垃圾的技巧

    答案:通过磁盘清理、手动删除临时文件、启用存储感知、清理应用缓存和调整系统设置可深度清理Windows 10。首先使用内置工具清理系统垃圾,再进入%temp%文件夹手动清除用户临时文件;接着开启存储感知自动管理空间,针对微信、浏览器等应用清理缓存并更改默认保存位置;最后关闭休眠、调整虚拟内存至非系统…

    2026年8月28日
    000
  • 怎么清理C盘垃圾 C盘清理全攻略

    怎么清理C盘垃圾 C盘清理全攻略怎么清理C盘垃圾 C盘清理全攻略怎么清理C盘垃圾 C盘清理全攻略怎么清理C盘垃圾 C盘清理全攻略

    随着电脑使用时间的增长,windows系统的c盘常常会积累大量无用文件,造成系统运行缓慢、响应迟钝等问题。定期清理c盘不仅有助于释放宝贵的存储空间,还能显著提升电脑的整体性能。本文将为你提供几种实用的c盘清理方法,助你轻松优化系统。 一、利用系统自带的磁盘清理功能 Windows内置的磁盘清理工具是…

    2026年8月28日 用户投稿
    100
  • linux ping不通外网

    linux ping不通外网linux ping不通外网linux ping不通外网linux ping不通外网

    一、仔细查看确定虚拟机的网卡模式是否选对,物理环境使用路由器选择桥接模式,单机或拨号上网选择nat模式,不想用虚拟机上网则选主机模式 二、查看网关是否配置正确 1、先进行dhclient,自动获取ip地址 2、通过#vi /etc/sysconfig/network-scripts/ifctg-et…

    2026年8月28日 用户投稿
    000
  • Word怎么把文字变成空心字效果_Word文本效果设置空心字或轮廓字

    1、通过设置字体颜色为背景色并添加轮廓,可实现空心字效果;2、利用“文本效果”中的轮廓样式快速应用预设空心字;3、使用艺术字功能精确控制无填充与轮廓,打造高级空心字。 如果您希望在文档中突出显示某些文字,使其更具视觉吸引力,可以通过设置文本效果来实现空心字或轮廓字的效果。这种样式常用于标题设计,让文…

    2026年8月28日
    000
  • linux was安装步骤

    1.  准备条件 1.1 WAS所支持的 Linux  操作系统 查看操作系统请用 lsb_release 命令 # lsb_release – a 1.2  WAS6.1Network Deployment 软件包 2.  安装 WAS步骤  (root用户操作) 2.1 安装前,需要确保当前用户…

    2026年8月28日
    000
  • win7系统如何调试屏幕亮度?

    win7系统如何调试屏幕亮度?win7系统如何调试屏幕亮度?win7系统如何调试屏幕亮度?win7系统如何调试屏幕亮度?

    屏幕亮度指的是显示器的发光强度,尽管高亮度能让显示器面板具备更强的抗干扰能力,但对我们的视力也会产生一定影响。接下来,我会以windows 7为例,向大家展示如何调整屏幕亮度。 首先,右键点击“计算机”,然后选择“属性”。 接着,点击“系统和安全”。 随后,选择“电源选项”。 通过拖动滚动条即可调节…

    2026年8月28日 用户投稿
    100
  • 夸克AI有哪些功能_夸克AI核心功能与应用场景全解析

    夸克AI有哪些功能_夸克AI核心功能与应用场景全解析夸克AI有哪些功能_夸克AI核心功能与应用场景全解析夸克AI有哪些功能_夸克AI核心功能与应用场景全解析夸克AI有哪些功能_夸克AI核心功能与应用场景全解析

    夸克AI通过五大核心模块实现多功能集成:AI超级框作为全场景任务中枢,支持自然语言指令生成文本、规划行程及处理长文档;深度思考基于通义大模型,具备逻辑推理与多轮对话能力,适用于复杂问题分析;AI相机结合多模态识别,实现拍照翻译、搜题与视觉交互;AI写作提供多文体内容生成与润色,适配社交、职场等场景;…

    2026年8月28日 用户投稿
    000
  • 545%! DeepSeek首披露成本利润率 专家:若在美国已是一家价值逾百亿美元公司

    中国ai新创公司deepseek近来「开源」一波波,上周六 (1日) 又有更大惊喜,全面揭秘deepseek-v3/r1推理系统,不仅公开其推理系统的核心优化方案,更首次披露成本获利率等关键数据,引发产业震动。 DeepSeek上周六在知乎平台发布首条文章,公布模型推理成本利润细节,并披露成本获利率…

    2026年8月28日
    100
  • linux安装oracle乱码

    方案:安装oracle中jre字体库的中文字体 1、下载字体文件 2、进入 database/stage/Components/oracle.jdk/1.6.0.75.0/1/DataFiles/目录 12c环境下,此文件夹下有 filegroup1.jar filegroup2.jar fileg…

    2026年8月28日
    000
  • Windows 10 电脑防火墙在哪里设置

    windows 10 防火墙作为操作系统安全体系的重要组成部分,近年来受到了微软的高度重视。同时,微软也在逐步提升其自家的 windows defender 安全工具的地位。今天,我们将为大家介绍如何配置 win10 防火墙的详细步骤。 首先,按下 Win+I 快捷键进入 Windows 设置界面,…

    2026年8月28日
    000
  • 如何解决Laravel项目中短信通知的问题?使用Composer安装VonageNotificationChannel可以!

    可以通过一下地址学习composer:学习地址 在开发 laravel 项目时,短信通知功能是一个常见的需求,但也常常带来一系列问题。我最近在开发一个需要短信通知的应用时,遇到了配置复杂、发送失败率高以及维护困难等一系列挑战。这些问题不仅影响了用户体验,也让我在开发过程中感到头疼。 为了解决这些问题…

    用户投稿 2026年8月28日
    000
  • HTTP1.1与HTTP2的区别_HTTP1.1与HTTP2有哪些区别

    http/2通过多路复用在单个tcp连接上并行传输多个独立的数据流,每个流的数据被分割为带流id的二进制帧并交错发送,接收方根据流id重新组装,从而避免了http/1.1中因单个请求阻塞导致后续请求等待的队头阻塞问题;2. hpack头部压缩通过静态字典、动态字典和哈夫曼编码减少重复头部信息的传输量…

    2026年8月28日
    300
  • Spark HA集群搭建

    Spark HA集群搭建Spark HA集群搭建Spark HA集群搭建Spark HA集群搭建

    环境准备 我使用的是CentOS-6.6版本的4个虚拟机,主机名为hadoop01、hadoop02、hadoop03、hadoop04。集群将由hadoop用户搭建(在生产环境中,root用户通常不可随意使用)。关于虚拟机的安装,可以参考以下两篇文章:在Windows中安装一台Linux虚拟机,以…

    2026年8月28日 用户投稿
    000
  • 协程栈(Coroutine Stack)的内存管理

    协程栈的内存管理是通过用户态栈和运行时环境来实现的。1)在python中,协程使用生成器和yield机制,共享全局解释器锁,需处理暂停和恢复逻辑。2)在go中,goroutine使用m:n调度模型,运行时自动调整栈大小,防止栈溢出和内存泄漏。 在编程世界中,协程栈(Coroutine Stack)的…

    2026年8月28日
    000
  • linux如何关机

    linux如何关机 1、有界面的Linux关机方法: 在桌面右上角有关机图标、或下拉三角形图标,点开即可找到关机。 2、通过终端关机 立刻关机: sudo shutdown -h nowsudo init 0poweroff 延时关机: sudo shutdown -h 10 [“准备关机”] //…

    2026年8月28日
    200
  • PHP:高效检查多维数组中是否存在重复的嵌套项

    本文将探讨如何在 php 中有效检查一个多维数组是否已包含具有相同嵌套项的元素。针对 `in_array()` 函数在处理复杂数组时的局限性,我们将介绍通过迭代和直接比较嵌套子数组的方法,确保在添加新数据前避免重复,从而维护数据结构的唯一性和完整性。 在 PHP 开发中,我们经常需要处理包含复杂数据…

    2026年8月28日
    100

发表回复

登录后才能评论
关注微信