Disclosure of Invention
The invention aims to provide a jigsaw display method, which greatly saves the bandwidth and improves the transmission efficiency of image blocks; it is another object of the present invention to provide a puzzle display system and a computer-readable storage medium.
In order to solve the technical problems, the invention provides the following technical scheme:
a jigsaw display method is applied to a server and comprises the following steps:
receiving a target image, target image blocks obtained by dividing the target image and a target jigsaw terminal;
acquiring a target image number sequence of each target image block in the target image;
selecting a preset number of image blocks to be backed up from an image block set formed by each target image block;
carrying out backup operation on each image block to be backed up to obtain a target image block of each backup; the backup image block number of each backup target image block is the same as the target image block number of the corresponding original target image block;
respectively inserting the numbers of the backup image blocks into the parallel positions of the corresponding target image block numbers in the target image number sequence to obtain an incremental image number sequence;
calling a Randon random function to carry out random arrangement on the incremental image numbering sequence to obtain a random image numbering sequence;
sending each target image block to the target jigsaw terminal according to the random image number sequence;
receiving the number sequence of the spliced images of the target image blocks in the jigsaw images returned by the target jigsaw end;
and returning the sequence of the spliced image numbers to a jigsaw requesting end so that the jigsaw requesting end carries out jigsaw display according to the sequence of the spliced image numbers.
In an embodiment of the present invention, receiving target image blocks and target puzzle ends obtained by dividing a target image, includes:
and receiving each target image block obtained by dividing the target image according to the number of image division blocks generated by the Randon random function, and a target jigsaw terminal selected according to the jigsaw terminal number generated by the Randon random function.
A jigsaw display method is applied to a jigsaw request terminal and comprises the following steps:
acquiring a target image to be segmented and a target jigsaw terminal;
carrying out segmentation operation on the target image to obtain each target image block;
sending the target image, each target image block and the target jigsaw terminal to a server terminal, so that the server terminal sends the target image numbers of the target image blocks in the target image to the target jigsaw terminal for jigsaw processing after randomly arranging the target image numbers;
receiving a splicing image number sequence of each target image block in the splicing images returned by the server;
and performing jigsaw display according to the splicing image number sequence.
In a specific embodiment of the present invention, obtaining a target puzzle side includes:
calling a random function to generate a jigsaw terminal number;
and selecting the jigsaw terminal corresponding to the jigsaw terminal number as a target jigsaw terminal.
In a specific embodiment of the present invention, when there are a plurality of the tile terminal numbers, performing tile display according to the sequence of the tile numbers includes:
and carrying out comparison display on a plurality of puzzles according to the number sequence of the spliced images respectively returned by each target puzzle end.
In a specific embodiment of the present invention, after performing comparison display of multiple puzzles according to the sequence of the number of the stitched images respectively returned by each of the target puzzle ends, the method further includes:
acquiring a jigsaw display result;
and uploading the picture mosaic display result to a cloud server.
A puzzle display system comprising:
the jigsaw request end is used for acquiring a target image to be divided and a target jigsaw end; carrying out segmentation operation on the target image to obtain each target image block; sending the target image, each target image block and the target jigsaw puzzle terminal to a server terminal; performing jigsaw display according to the splicing image number sequence;
the server is used for acquiring the target image number sequence of each target image block in the target image; selecting a preset number of image blocks to be backed up from an image block set formed by each target image block; carrying out backup operation on each image block to be backed up to obtain a target image block of each backup; the backup image block number of each backup target image block is the same as the target image block number of the corresponding original target image block; respectively inserting the numbers of the backup image blocks into the parallel positions of the corresponding target image block numbers in the target image number sequence to obtain an incremental image number sequence; calling a Randon random function to carry out random arrangement on the incremental image numbering sequence to obtain a random image numbering sequence; sending each target image block to the target jigsaw terminal according to the random image number sequence; the sequence of the numbers of the spliced images is returned to the jigsaw request end;
the target image splicing end is used for carrying out image splicing processing on each target image block; and returning the number sequence of the spliced images of the target image blocks in the jigsaw puzzle images to the server side.
In a specific embodiment of the present invention, the puzzle requesting end is specifically configured to call a Randon random function to generate a puzzle terminal number; and selecting the jigsaw terminal corresponding to the jigsaw terminal number as a target jigsaw terminal.
A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the puzzle presentation method as set forth above.
The invention provides a jigsaw display method, which is applied to a server side: receiving a target image, each target image block obtained by dividing the target image and a target jigsaw terminal; acquiring the number sequence of target images of all target image blocks in a target image; selecting a preset number of image blocks to be backed up from an image block set formed by all target image blocks; carrying out backup operation on each image block to be backed up to obtain a target image block of each backup; the backup image block number of each backup target image block is the same as the target image block number of the corresponding original target image block; respectively inserting the numbers of the backup image blocks into the parallel positions of the numbers of the corresponding target image blocks in the sequence of the number of the target image to obtain the sequence of the number of the incremental image; calling a Randon random function to carry out random arrangement on the incremental image numbering sequence to obtain a random image numbering sequence; sending each target image block to a target jigsaw puzzle end according to the random image number sequence; receiving the number sequence of the spliced images of the target image blocks in the jigsaw images returned by the target jigsaw terminal; and returning the serial number sequence of the spliced images to the jigsaw requesting end so that the jigsaw requesting end carries out jigsaw display according to the serial number sequence of the spliced images.
According to the technical scheme, after the target image is divided, the target image blocks are numbered, the target image blocks are spliced at the target splicing end to obtain the spliced image, the splicing image number sequence of the target image blocks in the spliced image is obtained, the splicing image number sequence is only returned to the splicing request end, and the target image blocks do not need to be returned to the splicing request end according to the sequence of the splicing image number sequence. The target jigsaw terminal and the jigsaw request terminal only need to transmit the image blocks once, so that the bandwidth is greatly saved, and the transmission efficiency of the image blocks is improved.
Accordingly, embodiments of the present invention further provide a jigsaw display system and a computer readable storage medium corresponding to the jigsaw display method, which have the above technical effects and are not described herein again.
Detailed Description
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. 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 invention.
The first embodiment is as follows:
referring to fig. 1, fig. 1 is a flowchart illustrating a method for displaying a jigsaw puzzle according to an embodiment of the present invention, where the method includes the following steps:
s101: the method comprises the steps of receiving a target image, dividing the target image into target image blocks and a target jigsaw terminal.
When the jigsaw display is needed, the jigsaw request end cuts the target image to obtain each target image block. The jigsaw request end sends a target image, target image blocks obtained by dividing the target image and a target jigsaw end to the server end. The server receives the target image, each target image block obtained by dividing the target image and the target jigsaw terminal.
The target image may be any image used for puzzle presentation.
S102: and acquiring the target image number sequence of each target image block in the target image.
And the server side acquires the arrangement sequence of each target image block in the target image after receiving the target image, each target image block obtained by dividing the target image and the target jigsaw puzzle side.
And numbering the target image blocks according to the arrangement sequence of the target image blocks in the target image to obtain the numbering sequence of the target image. For example, when the target image is divided into 10 target image blocks, the target image blocks may be sequentially numbered as 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 according to the arrangement order of the target image blocks in the target image.
S103: and selecting a preset number of image blocks to be backed up from an image block set formed by each target image block.
After each target image block is obtained through analysis, the server side selects a preset number of image blocks to be backed up from an image block set formed by each target image block. For the above example, assuming that the preset number is 2, the selected image blocks to be backed up are the target image blocks numbered 3 and 9.
It should be noted that the preset number may be set and adjusted according to actual situations, and this is not limited in the embodiment of the present invention.
S104: and carrying out backup operation on each image block to be backed up to obtain each backed-up target image block.
And the backup image block number of each backup target image block is the same as the target image block number of the corresponding original target image block.
After each to-be-backed-up image block is selected and obtained, the server side performs backup operation on each to-be-backed-up image block to obtain each backed-up target image block. The backup image block number of each backup target image block is the same as the target image block number of the corresponding original target image block. For the above example, after the selected target image blocks to be backed up are the target image blocks numbered 3 and 9, the backup target image blocks numbered 3 and 9 are obtained by performing backup operation on each target image block to be backed up.
S105: and respectively inserting the numbers of the backup image blocks into the parallel positions of the corresponding target image block numbers in the target image number sequence to obtain the incremental image number sequence.
After obtaining the backup target image blocks, the server inserts the backup image block numbers into the parallel positions of the corresponding target image block numbers in the target image number sequence to obtain the incremental image number sequence. Taking the above example, after obtaining the backed-up target image blocks numbered 3 and 9, 3 and 9 are inserted into the target image number order 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, and the obtained incremental image number order is 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9.
S106: and calling a Randon random function to carry out random arrangement on the incremental image numbering sequence to obtain a random image numbering sequence.
After the incremental image numbering sequence is obtained, the server side calls a Randon random function to carry out random arrangement on the incremental image numbering sequence, and the random image numbering sequence is obtained. Taking the above example as a support, it is assumed that 0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9 are randomly arranged by calling a Randon random function, and the obtained random image number sequence is 9, 5, 9, 2, 3, 3, 7, 4, 1, 8, 6, 0.
S107: and sending each target image block to a target jigsaw puzzle terminal according to the random image number sequence.
And after the random image number sequence is obtained, the server side sends each target image block to the target jigsaw puzzle side according to the random image number sequence. Taking the above example as a support, when the obtained random image number sequence is 9, 5, 9, 2, 3, 3, 7, 4, 1, 8, 6, 0, the corresponding target image blocks are sent to the target puzzle side according to the random image number sequence.
It should be noted that the target image block sent to the target puzzle side here includes both the original target image block and the target image block obtained by backup.
S108: and receiving the number sequence of the spliced images of the target image blocks in the jigsaw images returned by the target jigsaw terminal.
And after receiving each target image block sent by the server according to the random image number sequence, the target jigsaw terminal splices each target image block to obtain a jigsaw image. And the target jigsaw terminal acquires the number sequence of the spliced images of the target image blocks in the jigsaw images and returns the number sequence of the spliced images to the server terminal. And the server receives the number sequence of the spliced images of the target image blocks in the jigsaw images returned by the target jigsaw terminal.
S109: and returning the serial number sequence of the spliced images to the jigsaw requesting end so that the jigsaw requesting end carries out jigsaw display according to the serial number sequence of the spliced images.
And after receiving the splicing image number sequence, the server returns the splicing image number sequence to the splicing request end. The jigsaw requesting terminal carries out jigsaw display according to the sequence of the serial numbers of the spliced images, the specific jigsaw requesting terminal carries out the splicing on each target image block according to the sequence of the serial numbers of the spliced images to obtain a jigsaw image, and the jigsaw display is carried out according to the comparison result by comparing the jigsaw image with the target image. In the process of displaying the jigsaw puzzle, the target jigsaw puzzle end and the jigsaw puzzle request end only need to transmit the image blocks once, so that the bandwidth is greatly saved, and the transmission efficiency of the image blocks is improved.
According to the technical scheme, after the target image is divided, the target image blocks are numbered, the target image blocks are spliced at the target splicing end to obtain the spliced image, the splicing image number sequence of the target image blocks in the spliced image is obtained, the splicing image number sequence is only returned to the splicing request end, and the target image blocks do not need to be returned to the splicing request end according to the sequence of the splicing image number sequence. The target jigsaw terminal and the jigsaw request terminal only need to transmit the image blocks once, so that the bandwidth is greatly saved, and the transmission efficiency of the image blocks is improved.
It should be noted that, based on the first embodiment, the embodiment of the present invention further provides a corresponding improvement scheme. In the following embodiments, steps that are the same as or correspond to those in the first embodiment may be referred to each other, and corresponding advantageous effects may also be referred to each other, which are not described in detail in the following modified embodiments.
Example two:
referring to fig. 2, fig. 2 is a flowchart of another implementation of the tile display method in the embodiment of the present invention, applied to a server, where the method may include the following steps:
s201: the method comprises the steps of receiving a target image, dividing the target image into target image blocks according to the number of image division blocks generated by a Randon random function, and selecting a target jigsaw terminal according to a jigsaw terminal number generated by the Randon random function.
When the jigsaw display is needed, the jigsaw request end generates 10 image segmentation blocks according to the number of image segmentation blocks generated by a Randon random function, for example, the generated image segmentation blocks are randomly extracted from 10-20, and the target image is segmented according to the number of the image segmentation blocks to obtain each target image block. And if the number of the jigsaw terminal generated according to the Randon random function is 5 jigsaw terminals in total, the generated jigsaw terminal number is 3 through random extraction in 0-4, and the target jigsaw terminal is the No. 3 jigsaw terminal. And the server receives the jigsaw request, analyzes the jigsaw request, and obtains each target image block obtained by dividing the target image according to the number of image division blocks generated by the Randon random function and a target jigsaw end selected according to the jigsaw terminal number generated by the Randon random function.
S202: and acquiring the target image number sequence of each target image block in the target image.
S203: selecting a preset number of images to be backed up from an image block set formed by all target image blocks
S204: and carrying out backup operation on each image block to be backed up to obtain each backed-up target image block.
And the backup image block number of each backup target image block is the same as the target image block number of the corresponding original target image block.
S205: and respectively inserting the numbers of the backup image blocks into the parallel positions of the corresponding target image block numbers in the target image number sequence to obtain the incremental image number sequence.
S206: and calling a Randon random function to carry out random arrangement on the incremental image numbering sequence to obtain a random image numbering sequence.
S207: and sending each target image block to a target jigsaw puzzle terminal according to the random image number sequence.
And after the random image number sequence is obtained, the server side sends each target image block to the target jigsaw puzzle side according to the random image number sequence.
S208: and receiving the number sequence of the spliced images of the target image blocks in the jigsaw images returned by the target jigsaw terminal.
After receiving each target image block, the target image splicing end selects a plurality of target image blocks of image segmentation blocks generated according to a Randon random function from each target image block, and splices the selected target image blocks to obtain a spliced image. The backup target image blocks are added in each target image block sent to the target jigsaw terminal, so that the jigsaw difficulty is increased, and the jigsaw display effect is improved.
S209: and returning the serial number sequence of the spliced images to the jigsaw requesting end so that the jigsaw requesting end carries out jigsaw display according to the serial number sequence of the spliced images.
Example three:
referring to fig. 3, fig. 3 is a flowchart of another implementation of the tile display method according to the embodiment of the present invention, applied to a tile requesting end, where the method includes the following steps:
s301: and acquiring a target image to be segmented and a target jigsaw puzzle end.
S302: and carrying out segmentation operation on the target image to obtain each target image block.
S303: and sending the target image, each target image block and the target jigsaw terminal to the server terminal so that the server terminal sends the target image numbers of the target image blocks in the target image to the target jigsaw terminal for jigsaw processing after randomly arranging the target image numbers of the target image blocks in the target image.
S304: and receiving the splicing image number sequence of each target image block in the splicing image returned by the server.
S305: and performing jigsaw display according to the sequence of the spliced images.
According to the technical scheme, after the target image is divided, the target image blocks are numbered, the target image blocks are spliced at the target splicing end to obtain the spliced image, the splicing image number sequence of the target image blocks in the spliced image is obtained, the splicing image number sequence is only returned to the splicing request end, and the target image blocks do not need to be returned to the splicing request end according to the sequence of the splicing image number sequence. The target jigsaw terminal and the jigsaw request terminal only need to transmit the image blocks once, so that the bandwidth is greatly saved, and the transmission efficiency of the image blocks is improved.
Example four:
referring to fig. 4, fig. 4 is a flowchart of another implementation of the tile display method according to the embodiment of the present invention, applied to a tile requesting end, where the method includes the following steps:
s401: and acquiring a target image to be segmented.
S402: and calling a Randon random function to generate a jigsaw terminal number.
S403: and selecting the jigsaw terminal corresponding to the jigsaw terminal number as a target jigsaw terminal.
S404: and carrying out segmentation operation on the target image to obtain each target image block.
S405: and sending the target image, each target image block and the target jigsaw terminal to the server terminal so that the server terminal sends the target image numbers of the target image blocks in the target image to the target jigsaw terminal for jigsaw processing after randomly arranging the target image numbers of the target image blocks in the target image.
S406: and receiving the splicing image number sequence of each target image block in the splicing image returned by the server.
S407: and when the number of the jigsaw terminal is multiple, comparing and displaying the multiple puzzles according to the sequence of the numbers of the spliced images respectively returned by each target jigsaw terminal.
When the number of the jigsaw terminal is multiple, the jigsaw request end can carry out comparison and display of multiple jigsaw according to the sequence of the number of the spliced images respectively returned by each target jigsaw end, and the jigsaw results of each target jigsaw end can be conveniently compared.
S408: and acquiring a jigsaw display result.
And performing jigsaw display on the jigsaw image returned by the target jigsaw terminal at the jigsaw request terminal to obtain a jigsaw display result, and then obtaining the jigsaw display result by the jigsaw request terminal.
S409: and uploading the jigsaw display result to a cloud server.
After the jigsaw display result is obtained, the jigsaw request end uploads the jigsaw display result to the cloud server. The subsequent checking of the results of the jigsaw puzzle is facilitated, and the thinking is expanded.
In a specific example application, the teacher end serves as a jigsaw request end, the student end serves as a target jigsaw end, and the server end is further included. The teacher divides a target picture into 10 target image blocks, and the target image blocks are numbered as 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 in sequence according to the arrangement sequence of the target image blocks in the target picture. The server side obtains the arrangement sequence of each target image block in the target image, randomly arranges 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9 by calling a Randon random function, obtains a random image number sequence of 9, 5, 2, 3, 7, 4, 1, 8, 6 and 0, and sends each corresponding target image block to the student side according to the random image number sequence. And after receiving the target image blocks sent by the server according to the random image number sequence, the student end splices the target image blocks to obtain a jigsaw image. The student side obtains the number sequence of the spliced images of the target image blocks in the jigsaw puzzle images and returns the number sequence of the spliced images to the server side. And after receiving the number sequence of the spliced images, the server returns the number sequence of the spliced images to the teacher end. And the teacher end splices the target image blocks according to the splicing image number sequence to obtain a jigsaw image, and performs jigsaw display according to the comparison result by comparing the jigsaw image with the target image.
Corresponding to the above method embodiments, the present invention further provides a jigsaw display system, and the jigsaw display system described below and the jigsaw display method described above can be referred to correspondingly.
Referring to fig. 5, fig. 5 is a block diagram of a puzzle displaying system according to an embodiment of the present invention, the puzzle displaying system may include:
a jigsaw request terminal 51, configured to obtain a target image to be divided and a target jigsaw terminal 53; carrying out segmentation operation on the target image to obtain each target image block; sending the target image, each target image block, and the target puzzle terminal to the server terminal 52; performing jigsaw display according to the sequence of the serial numbers of the spliced images;
the server 52 is configured to obtain a target image number sequence of each target image block in the target image; selecting a preset number of image blocks to be backed up from an image block set formed by all target image blocks; carrying out backup operation on each image block to be backed up to obtain a target image block of each backup; the backup image block number of each backup target image block is the same as the target image block number of the corresponding original target image block; respectively inserting the numbers of the backup image blocks into the parallel positions of the numbers of the corresponding target image blocks in the sequence of the number of the target image to obtain the sequence of the number of the incremental image; calling a Randon random function to carry out random arrangement on the incremental image numbering sequence to obtain a random image numbering sequence; sending each target image block to the target puzzle terminal 53 according to the random image number sequence; the sequence of the numbers of the spliced images is returned to the jigsaw request terminal 51;
a target image splicing end 53 for performing image splicing processing on each target image block; and returning the number sequence of the spliced images of the target image blocks in the jigsaw puzzle image to the server 52.
According to the technical scheme, after the target image is divided, the target image blocks are numbered, the target image blocks are spliced at the target splicing end to obtain the spliced image, the splicing image number sequence of the target image blocks in the spliced image is obtained, the splicing image number sequence is only returned to the splicing request end, and the target image blocks do not need to be returned to the splicing request end according to the sequence of the splicing image number sequence. The target jigsaw terminal and the jigsaw request terminal only need to transmit the image blocks once, so that the bandwidth is greatly saved, and the transmission efficiency of the image blocks is improved.
In an embodiment of the present invention, the puzzle requesting terminal 51 is specifically configured to divide the target image into each target image block according to the number of image division blocks generated by the Randon random function.
In a specific embodiment of the present invention, the puzzle requesting terminal 51 is specifically configured to call a Randon random function to generate a puzzle terminal number; the puzzle end corresponding to the puzzle terminal number is selected as the target puzzle end 53.
In an embodiment of the present invention, the tile requesting end 51 is specifically configured to perform comparison display of multiple tiles according to the sequence of the numbers of the tile images returned by the target tile ends 53 when there are multiple tile terminal numbers.
In an embodiment of the present invention, the jigsaw request terminal 51 is further configured to obtain a jigsaw display result after performing comparison display on a plurality of jigsaws according to the sequence of the numbers of the mosaic images respectively returned by the target jigsaw terminals 53; and uploading the jigsaw display result to a cloud server.
Corresponding to the above method embodiment, the present invention further provides a computer-readable storage medium having a computer program stored thereon, the computer program, when executed by a processor, implementing the steps of:
receiving a target image, each target image block obtained by dividing the target image and a target jigsaw terminal; acquiring the number sequence of target images of all target image blocks in a target image; selecting a preset number of image blocks to be backed up from an image block set formed by all target image blocks; carrying out backup operation on each image block to be backed up to obtain a target image block of each backup; the backup image block number of each backup target image block is the same as the target image block number of the corresponding original target image block; respectively inserting the numbers of the backup image blocks into the parallel positions of the numbers of the corresponding target image blocks in the sequence of the number of the target image to obtain the sequence of the number of the incremental image; calling a Randon random function to carry out random arrangement on the incremental image numbering sequence to obtain a random image numbering sequence; sending each target image block to a target jigsaw puzzle end according to the random image number sequence; receiving the number sequence of the spliced images of the target image blocks in the jigsaw images returned by the target jigsaw terminal; and returning the serial number sequence of the spliced images to the jigsaw requesting end so that the jigsaw requesting end carries out jigsaw display according to the serial number sequence of the spliced images.
The computer-readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
For the introduction of the computer-readable storage medium provided by the present invention, please refer to the above method embodiments, which are not described herein again.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The system and the computer-readable storage medium disclosed by the embodiment correspond to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
The principle and the implementation of the present invention are explained in the present application by using specific examples, and the above description of the embodiments is only used to help understanding the technical solution and the core idea of the present invention. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.