CN114185853A - Model file packaging method and device and storage medium - Google Patents

Model file packaging method and device and storage medium Download PDF

Info

Publication number
CN114185853A
CN114185853A CN202111428498.8A CN202111428498A CN114185853A CN 114185853 A CN114185853 A CN 114185853A CN 202111428498 A CN202111428498 A CN 202111428498A CN 114185853 A CN114185853 A CN 114185853A
Authority
CN
China
Prior art keywords
model data
model
data
file
sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111428498.8A
Other languages
Chinese (zh)
Inventor
陈善云
蒋成
毛凯
罗苇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Chizi Technology Co ltd
Original Assignee
Wuhan Chizi Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Chizi Technology Co ltd filed Critical Wuhan Chizi Technology Co ltd
Priority to CN202111428498.8A priority Critical patent/CN114185853A/en
Publication of CN114185853A publication Critical patent/CN114185853A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for encapsulating a model file and a storage medium, wherein the method comprises the following steps: acquiring first model data generated by scanning a target object, wherein the first model data is used for identifying data of the scanning target object; serializing the first model data to obtain first sequence model data; writing the first sequence model data into a first file, wherein the first file is used for storing scanning data; calculating second model data according to the first model data, wherein the second model data is used for building a target object model; serializing the second model data to obtain second sequence model data, and writing the second sequence model data into a first file; and packaging the first sequence model data and the second sequence model data to form model file package. By serializing the model data, the occupation of the model data on system resources such as a cpu and a disk is reduced, the efficiency of writing the model data is improved, the first sequence model data and the second sequence model data are packaged, and the data stability is ensured.

Description

Model file packaging method and device and storage medium
Technical Field
The present invention relates to the field of file encapsulation technologies, and in particular, to a method and an apparatus for encapsulating a model file, and a storage medium.
Background
When scanning a three-dimensional object, in order to reduce the risk of losing a scanning result due to program crash, computer shutdown and other abnormalities, a file encapsulation technology is required to be used for storing a 3D scanning result.
When a user scans a three-dimensional object by using a 3D scanning device, the user hopes to store original scanning data, and the scanning result is conveniently processed for multiple times in the later period. In order to improve the precision of the three-dimensional object model, the three-dimensional object is often required to be scanned at multiple angles, and the scanning result of each angle is independently stored.
When the 3D scanning equipment scans, the frame data transmitted from the 3D equipment to the PC are recorded in real time, the method needs to occupy certain CPU resources, and the original frame data often occupies larger memory and needs larger disk space for a user, so that the method is not beneficial to processing the scanned data for multiple times in the later period.
Disclosure of Invention
The invention aims to provide a model file packaging method, a model file packaging device and a storage medium, which are used for realizing the model file packaging by serializing model data, reducing the occupation of system resources such as a cpu (central processing unit), a magnetic disk and the like by the model data, improving the writing efficiency of the model data and ensuring the stability of the data.
In order to achieve the above object, the present invention provides the following technical solutions:
in a first aspect, a model file encapsulation method is provided, including:
acquiring first model data generated by scanning a target object, wherein the first model data is used for identifying data of the scanning target object;
serializing the first model data to obtain first sequence model data;
writing the first sequence model data into a first file, wherein the first file is used for storing scanning data;
calculating second model data according to the first model data, wherein the second model data is used for building a target object model;
serializing the second model data to obtain second sequence model data, and writing the second sequence model data into a first file;
and packaging the first sequence model data and the second sequence model data to form a model file.
In a second aspect, there is provided a model file packaging apparatus, including:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring first model data generated by scanning a target object, and the first model data is used for identifying data of the scanning target object;
the first serialization module is used for serializing the first model data to obtain first sequence model data;
the first writing module is used for writing the first sequence model data into a first file, and the first file is used for storing scanning data;
the calculation module is used for calculating second model data according to the first model data, and the second model data is used for establishing a target object model;
the second serialization module serializes the second model data to obtain second sequence model data;
the second writing module is used for writing the second sequence model data into the first file;
and the packaging module is used for packaging the first sequence model data and the second sequence model data to form a model file.
In a third aspect, a computer-readable storage medium is provided, comprising: a computer program is stored which, when executed by a processor, causes the processor to perform the steps of:
acquiring first model data generated by scanning a target object, wherein the first model data is used for identifying data of the scanning target object;
serializing the first model data to obtain first sequence model data;
writing the first sequence model data into a first file, wherein the first file is used for storing scanning data;
calculating second model data according to the first model data, wherein the second model data is used for building a target object model;
serializing the second model data to obtain second sequence model data, and writing the second sequence model data into a first file;
and packaging the first sequence model data and the second sequence model data to form a model file.
Compared with the prior art, the invention has the following beneficial effects:
the model data is serialized and compressed, so that the occupation of the model data on system resources such as a cpu (central processing unit), a disk and the like is reduced, and the efficiency of writing the model data is improved; and encapsulating the first sequence model data and the second sequence model data into a model file in the same file to ensure the stability of the data.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Wherein:
fig. 1 is a schematic flowchart of a method for encapsulating a model file according to an embodiment of the present disclosure;
fig. 2 is a schematic diagram of a model file packaging apparatus according to an embodiment of the present application;
fig. 3 is a block diagram of a computer-readable storage medium according to an embodiment of the present disclosure.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It is noted that the terms "comprises," "comprising," and "having" and any variations thereof in the description and claims of this application and the drawings described above are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. In the claims, the description and the drawings of the specification of the present application, relational terms such as "first" and "second", and the like, may be used solely to distinguish one entity/action/object from another entity/action/object without necessarily requiring or implying any actual such relationship or order between such entities/actions/objects.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
As shown in fig. 1, a method for encapsulating a model file is provided, which specifically includes the following steps:
step 100, the terminal obtains first model data generated by scanning a target object, wherein the first model data is used for identifying data of the scanning target object.
The terminal can be a smart phone, a tablet computer, a portable computer, a desktop computer and the like, a target object is scanned through a scanner, and after the scanning is finished, the terminal acquires first model data generated by scanning the target object, wherein the first model data is used for identifying data of the scanned target object. In one embodiment, the computer scans the target object through the 3d scanner, and obtains first model data generated by scanning the target object, wherein the first model data is version number, compression mark, encryption mark, modification time, model uuid, and whether to rebuild the mark off line. The version number represents the version in the packaging format, the compression mark represents whether the content is compressed or not, the encryption mark represents whether the content is encrypted or not, the modification time records the current time yyyy-MM-ddTHH: MM: ss, the model uuid is a unique file mark, and whether the offline reconstruction mark represents whether the model uses offline reconstruction or not.
And 102, serializing the first model data by the terminal to obtain first sequence model data.
Serialization is the process of converting the state information of the target object into a storable form and/or a transmittable form, so as to facilitate the storage and/or transmission of data. Serializing the first model data, namely converting the first model data into a binary system, and compressing the first model data, thereby reducing the occupied volume of the first model data in a memory.
And 104, writing the first sequence model data into a first file by the terminal, wherein the first file is used for storing the scanning data.
The first sequence model data is written into the first file, so that data can be conveniently searched in the later period. When the memory leaks data, the stability of the first sequence model data can be maintained.
And 106, calculating second model data by the terminal according to the first model data, wherein the second model data is used for building a target object model.
And calculating second model data in real time according to the first model data, wherein the second model data is used for establishing a target object model, and the target object model can be established when the model file data is called. In one embodiment, second model data is calculated from the first model data, the second model data including key frame information, key frame matrix information, key frame id, key frame geometry data (vertices, normals, texture coordinates, etc.), texture data, color point data, selection id data.
And 108, serializing the second model data by the terminal to obtain second serial model data, and writing the second serial model data into the first file.
And serializing the second model data, namely converting the second model data into a binary system, and compressing the second model data to reduce the occupied volume of the second model data in a memory. And writing the second sequence data into the first file to facilitate searching the second sequence model data for a later period. When the memory leaks data, the stability of the second sequence model data can be maintained.
And step 110, the terminal encapsulates the first sequence model data and the second sequence model data to form a model file.
And packaging the first sequence model data and the second sequence model data together to form a model file, so as to ensure the stability of the data. If the first sequence model data and the second sequence model are respectively stored in different files, the later-stage searching is not facilitated, and the loss is easy. Therefore, in order to improve the efficiency of searching data and ensure the stability of the data, the first sequence model data and the second sequence model data are packaged in the first file to form a model file.
According to the model file packaging method, the model data is serialized and compressed, so that the occupation of the model data on system resources such as a cpu (central processing unit), a magnetic disk and the like is reduced, and the model data writing efficiency is improved; and encapsulating the first sequence model data and the second sequence model data into a model file in the same file to ensure the stability of the data.
In one embodiment, the model file packaging method further includes: the terminal obtains third model data generated by real-time calculation in the scanning process, wherein the third model data are matching point information and characteristic point information of a plurality of models generated after the same scanning; and serializing the third model data to obtain third sequence model data, and writing the third sequence model data into a second file, wherein the second file is used for recording three-dimensional reconstruction information.
However, in order to match a plurality of models generated after the same scan, matching point information and feature point information of the plurality of models are required. There are unique pixel points in an image, and these points can be regarded as the features of the image, and become feature points. Image feature matching is performed based on the feature points. And the third model data serialization is to convert the third model data into a binary system, compress the third model data and reduce the occupied volume of the third model data in a memory. And writing the third sequence model data into a second file, wherein the second file is used for recording three-dimensional reconstruction information and rapidly restoring the model. The second file is used as a cache file. The cache is used for storing some common or upcoming data or instructions, and when the data or instructions are needed, the data or instructions are directly read from the cache, which is much faster than the data is directly read from a memory or a hard disk.
In one embodiment, the serializing the first model data by the terminal, before obtaining the first sequence of model data, further includes: judging whether the model is a multi-frame model or not according to the first model data; if the model is a multi-frame model, performing traversal operation on each frame model; if the model is not a multi-frame model, traversing operation is not required; the traversing operation is to calculate second model data of each frame model according to the first model data.
The multi-frame model refers to multi-angle scanning of a target object when the target object is scanned, so that multi-frame model data are generated. And performing traversal operation on each frame of model according to whether the first model data is multi-frame model data or not. The traversal operation is performed by using a for loop, the for loop can completely traverse each frame of model data, the for loop is used for performing traversal operation, programs are not redundant, and the operation efficiency is improved.
In one embodiment, the serialization is a protobuf serialization that is used to convert model data to binary.
The protobuf is a protocol for serializing structured data, has the characteristics of flexibility and high efficiency, has small code flow after being serialized by the protobuf, is high in speed, and is suitable for executing large-batch serialization operation. Because the model data is used for establishing the model and the data volume is large, the model data is serialized by protobuf in order to facilitate the reading and reduction of the volume of the model data by a computer, so that the resource consumption of the model data in the transmission process is reduced, and the data processing efficiency is improved.
As shown in fig. 2, a model file packaging apparatus is provided, which includes:
an obtaining module 200, configured to obtain first model data generated by scanning a target object, where the first model data is used to identify data of the scanning target object;
a first serialization module 202, configured to serialize the first model data to obtain first sequence model data;
a first writing module 204, configured to write the first sequence model data into a first file, where the first file is used to store scan data;
a calculating module 206, configured to calculate second model data according to the first model data, where the second model data is used to build a target object model;
a second serialization module 208, which serializes the second model data to obtain second sequence model data;
a second writing module 210, configured to write the second sequence model data into the first file;
and an encapsulating module 212, configured to encapsulate the first sequence model data and the second sequence model data to form a model file.
In one embodiment, the above apparatus further comprises:
acquiring third model data generated by real-time calculation in the scanning process, wherein the third model data are matching point information and characteristic point information of a plurality of models generated after the same scanning;
and serializing the third model data to obtain third sequence model data, and writing the third sequence model data into a second file, wherein the second file is used for recording three-dimensional reconstruction information.
In one embodiment, the above apparatus further comprises: serializing the first model data, and before obtaining the first sequence model data, the method further comprises: judging whether the model is a multi-frame model or not according to the first model data; if the model is a multi-frame model, performing traversal operation on each frame model; if the model is not a multi-frame model, traversing operation is not required; the traversing operation is to calculate second model data of each frame model according to the first model data.
In one embodiment, the serialization of the first serialization module and the serialization of the second serialization module are performed by protobuf serialization, and the model data are converted into a binary system.
As shown in fig. 3, in an embodiment, a computer-readable storage medium is proposed, having stored a computer program, which, when being executed by a processor, causes the processor to carry out the steps of the above-mentioned model file encapsulation method.
It is to be understood that the above described model file encapsulation method, apparatus and storage medium belong to one general inventive concept, and embodiments are mutually applicable.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program that can be stored in a non-volatile computer-readable storage medium and can be executed by associated hardware, and the computer program can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The invention and its embodiments have been described above without limitation, and the embodiments shown in the drawings are only one of the embodiments of the invention, and the practical description is not limited thereto, and in conclusion, if those skilled in the art should be informed by the teachings of the present invention, it is within the scope of the present invention to design the embodiments and examples similar to the technical solutions without creative idea of the present invention.

Claims (9)

1. A model file packaging method is characterized by comprising the following steps:
acquiring first model data generated by scanning a target object, wherein the first model data is used for identifying data of the scanning target object;
serializing the first model data to obtain first sequence model data;
writing the first sequence model data into a first file, wherein the first file is used for storing scanning data;
calculating second model data according to the first model data, wherein the second model data is used for building a target object model;
serializing the second model data to obtain second sequence model data, and writing the second sequence model data into a first file;
and packaging the first sequence model data and the second sequence model data to form a model file.
2. The method of claim 1, further comprising:
acquiring third model data generated by real-time calculation in the scanning process, wherein the third model data are matching point information and characteristic point information of a plurality of models generated after the same scanning;
and serializing the third model data to obtain third sequence model data, and writing the third sequence model data into a second file, wherein the second file is used for recording three-dimensional reconstruction information.
3. The method of claim 1, wherein serializing the first model data to obtain the first sequence of model data further comprises:
judging whether the model is a multi-frame model or not according to the first model data;
if the model is a multi-frame model, performing traversal operation on each frame model; if the model is not a multi-frame model, traversing operation is not required; the traversing operation is to calculate second model data of each frame model according to the first model data.
4. The method of claim 1, wherein the serialization is a protobuf serialization that is used to convert model data to binary.
5. A model file encapsulation apparatus, comprising:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for acquiring first model data generated by scanning a target object, and the first model data is used for identifying data of the scanning target object;
the first serialization module is used for serializing the first model data to obtain first sequence model data;
the first writing module is used for writing the first sequence model data into a first file, and the first file is used for storing scanning data;
the calculation module is used for calculating second model data according to the first model data, and the second model data is used for establishing a target object model;
the second serialization module serializes the second model data to obtain second sequence model data;
the second writing module is used for writing the second sequence model data into the first file;
and the packaging module is used for packaging the first sequence model data and the second sequence model data to form a model file.
6. The apparatus of claim 5, further comprising:
the system comprises a scanning module, a data acquisition module and a data processing module, wherein the scanning module is used for acquiring third model data generated by real-time calculation in the scanning process, and the third model data is matching point information and characteristic point information of a plurality of models generated after the same scanning;
and the third sequence model data is used for serializing the third model data to obtain third sequence model data, and the third sequence model data is written into a second file, wherein the second file is used for recording three-dimensional reconstruction information.
7. The apparatus of claim 5, further comprising:
the device is used for judging whether the model is a multi-frame model or not according to the first model data;
if the model is a multi-frame model, performing traversal operation on each frame model; if the model is not a multi-frame model, traversing operation is not required; the traversing operation is to calculate second model data of each frame model according to the first model data.
8. The apparatus of claim 5, wherein the serialization is to convert model data to binary using protobuf serialization.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the model file encapsulation method according to any one of claims 1 to 4.
CN202111428498.8A 2021-11-25 2021-11-25 Model file packaging method and device and storage medium Pending CN114185853A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111428498.8A CN114185853A (en) 2021-11-25 2021-11-25 Model file packaging method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111428498.8A CN114185853A (en) 2021-11-25 2021-11-25 Model file packaging method and device and storage medium

Publications (1)

Publication Number Publication Date
CN114185853A true CN114185853A (en) 2022-03-15

Family

ID=80602812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111428498.8A Pending CN114185853A (en) 2021-11-25 2021-11-25 Model file packaging method and device and storage medium

Country Status (1)

Country Link
CN (1) CN114185853A (en)

Similar Documents

Publication Publication Date Title
US20070053602A1 (en) Image processing apparatus and method
CN109964204B (en) Method and system for processing graphics
CN110648278B (en) Super-resolution processing method, system and equipment for image
CN110189384B (en) Image compression method, device, computer equipment and storage medium based on Unity3D
CN111061896B (en) Loading method, device, equipment and medium for 3D (three-dimensional) graph based on glTF (generalized likelihood TF)
CN115795629A (en) Data conversion method, data conversion system and electronic equipment
CN112052050A (en) Shared picture generation method, system, storage medium and terminal equipment
CN113590551A (en) Material digital extended format system, method, medium and equipment
KR20190013870A (en) Image generation method and device
CN114185853A (en) Model file packaging method and device and storage medium
WO2020147439A1 (en) Image processing method, image verification method, apparatus, device and medium
CN108564661B (en) Recording method based on augmented reality scene
CN111552696A (en) Data processing method and device based on big data, computer equipment and medium
CN113706639B (en) Image compression method and device based on rectangular NAM, storage medium and computing equipment
TW202036483A (en) Patch extension method, encoder and decoder
CN112612427B (en) Vehicle stop data processing method and device, storage medium and terminal
CN113704588A (en) File reading method and system based on mapping technology
CN112783504A (en) Binary universal representation format meteorological data analysis method and device
CN112068931A (en) Method and system for quickly making virtual machine mirror image
CN116719483B (en) Data deduplication method, apparatus, storage device and computer readable storage medium
CN111125425A (en) Method, system and device for reading and writing video data and readable storage medium
CN113886629B (en) Course picture retrieval model establishing method
CN112258427B (en) Infrared image restoration method and device
CN114187604B (en) Integrity verification method, equipment and medium for WebP picture
CN110875744B (en) Coding method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination