Remote sensing image cutting method, system and equipment
By setting the external rectangle of the cropping contour line of the remote sensing image, the cropping images are blocked and classified, and the parallel calculation and dynamic block merging technology are used to solve the problem of poor cropping efficiency and effect of remote sensing images in the existing technology, achieving efficient and lossless cutting effect.
Patent Information
- Application Number
- CN202510178722.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-06-06
AI Technical Summary
When performing remote sensing image cropping, it is difficult for the prior art to improve the cropping efficiency and cropping effect without adding a large amount of computing resources, especially when lossless image cropping is required, the computing resources consume hugely and are inefficient.
By setting the external rectangle of the crop contour line, the cropped images are blocked and classified, and parallel computing is used to reasonably utilize IO and CPU computing resources, dynamic block merging and dynamic cache technology to simplify the generation of target images.
Without adding a large amount of computing resources, the cropping efficiency and cropping effect of remote sensing images are greatly improved to achieve efficient and lossless image cropping.
Smart Images

Figure CN120107288A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image analysis and processing, and in particular relates to a remote sensing image cutting method, system and equipment. Background Art
[0002] Remote sensing images (abbreviated as RS, English: Remote Sensing Image) refer to films or photos that record the electromagnetic wave size of various ground objects, which are mainly divided into aerial photographs and satellite photographs.
[0003] The processing of optical remote sensing images often involves the rapid cropping of large-scale (hundreds of thousands to millions of square kilometers) remote sensing images. The processing process is affected by the ground resolution of the image, the geometric shape of the crop, the edge accuracy, the sampling accuracy, and other aspects. Since the remote sensing images are huge, the usual practice is to resample the original image and resample the cropping result through the mask method to avoid consuming a huge amount of computing resources and strike a balance between efficiency and effect. When lossless image cropping is required, it is inevitable to consume more computing resources and endure low cropping efficiency.
[0004] Therefore, in response to the above technical problems, it is necessary to provide an optimized remote sensing image processing strategy.
[0005] The information disclosed in this background technology section is only intended to enhance the understanding of the overall background of the invention and should not be regarded as an acknowledgment or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the invention
[0006] The object of the present invention is to provide a remote sensing image cropping method, system and device, which can greatly improve the cropping efficiency and cropping effect without increasing a large amount of computing resources.
[0007] In order to achieve the above object, a technical solution provided by a specific embodiment of the present invention is as follows:
[0008] In a first aspect, the present invention provides a remote sensing image cropping method, which comprises:
[0009] Obtaining a circumscribed rectangle of a cutting contour line, wherein the cutting contour line forms a closed cutting area on the image to be cut;
[0010] Divide the image to be cropped within the circumscribed rectangle into blocks, and if an image block is included in the cropping area, write the image block into the target image;
[0011] If the image block intersects with the cropping area, an image of the intersecting area between the image block and the cropping area is obtained, and the image of the intersecting area is written into the target image.
[0012] In one or more embodiments of the present invention, each side of the circumscribed rectangle of the cutting contour line is parallel to a coordinate axis of a preset plane rectangular coordinate system.
[0013] In one or more embodiments of the present invention, the method further comprises:
[0014] Based on the size of a preset cache area and the number of cores of a central processing unit, selecting one or more image blocks intersecting with the cropping area;
[0015] Based on different threads, images of the intersection area between the selected image block and the cropping area are simultaneously acquired.
[0016] In one or more embodiments of the present invention, obtaining an image of an area where the image block intersects the cropping area includes:
[0017] rasterizing the image blocks intersecting with the cropping area;
[0018] Traversing each pixel point in the image block, if the pixel point is in the cropping area, writing the pixel information into the target image;
[0019] If the pixel point is not in the cropping area, the pixel point is ignored.
[0020] In one or more embodiments of the present invention, the method further comprises:
[0021] Based on the rasterized image block, a binary mask having the same size as the image block is generated, wherein the value of the binary mask is 1 in the cropped area and 0 in the non-cropped area;
[0022] An AND operation is performed on each pixel in the image block and the corresponding value in the mask, and based on the coordinates of each pixel point, pixel information of the pixel points that are not zero after the AND operation is written into the target image.
[0023] In one or more embodiments of the present invention, dividing the image to be cropped within the circumscribed rectangle into blocks includes:
[0024] Dividing the circumscribed rectangle into a plurality of image regions, wherein the memory occupied by the image to be cut in each of the image regions is less than or equal to the memory size of a preset cache region;
[0025] The image to be cropped in each area within the circumscribed rectangle is divided into a plurality of image blocks of the same shape.
[0026] In one or more embodiments of the present invention, dividing the image to be cropped within the circumscribed rectangle into blocks includes:
[0027] Based on the memory size of the preset cache area, the width of the image area is calculated, and the length of the circumscribed rectangle is an integer multiple of the width of the image area;
[0028] Based on the length of the circumscribed rectangle and the calculated width of the image area, dividing the circumscribed rectangle into a plurality of rectangular image areas;
[0029] In each of the image regions, the image to be cropped is divided into a plurality of square image blocks with a side length equal to the width of the image region.
[0030] In one or more embodiments of the present invention, if the image block is included in the cropping area, writing the image block into the target image includes:
[0031] Merging adjacent image blocks belonging to the same image area and included in the cropping area in the cache area;
[0032] Each merged image block is written into the target image.
[0033] In a second aspect, the present invention provides a remote sensing image cropping system, which uses the remote sensing image cropping method, and comprises:
[0034] An acquisition module, used for acquiring a circumscribed rectangle of a cutting contour line, wherein the cutting contour line forms a closed cutting area on the image to be cut;
[0035] A first writing module, used for dividing the image to be cut within the circumscribed rectangle into blocks, and if an image block is included in the cutting area, writing the image block into the target image;
[0036] The second writing module is used for obtaining an image of an intersecting area between the image block and the cropping area if the image block intersects the cropping area, and writing the image of the intersecting area into a target image.
[0037] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the remote sensing image cropping method by executing the computer instructions.
[0038] Compared with the prior art, the remote sensing image cropping method provided by the present invention reasonably plans the image to be processed by setting the circumscribed rectangle of the cropping contour line, thereby reducing the size of the image to be processed. Furthermore, by dividing and classifying the current image to be processed, and according to the block category, the IO and CPU computing resources are reasonably utilized through parallel computing, thereby improving the cropping efficiency and cropping effect without increasing a large amount of computing resources. At the same time, the present invention further simplifies the generation of the target image through dynamic block merging and dynamic caching technology, and with the assistance of multi-threaded image block processing, it can further achieve efficient and lossless impact cropping. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 is a schematic diagram of a circumscribed rectangle of a cutting contour line of a remote sensing image in one embodiment of the present invention;
[0041] Figure 2 is a schematic flow chart of a remote sensing image cropping method in one embodiment of the present invention;
[0042] Figure 3 is a structural block diagram of a remote sensing image cutting system in one embodiment of the present invention;
[0043] Figure 4 is a structural block diagram of an electronic device in one embodiment of the present invention;
[0044] Figure 5 is a schematic diagram of the blocks of the image to be cropped within the circumscribed rectangle in one embodiment of the present invention;
[0045] Figure 6 is a schematic diagram of image block classification in a specific embodiment of the present invention;
[0046] Figure 7 is a schematic diagram of processing an image block included in a cropping area in a specific embodiment of the present invention;
[0047] Figure 8 FIG. 4 is a schematic diagram of processing an image block intersecting with a cropping area in a specific embodiment of the present invention. DETAILED DESCRIPTION
[0048] In order to enable those skilled in the art to better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0049] Unless explicitly stated otherwise, throughout the specification and claims, the term “comprise” or variations such as “include” or “comprising”, etc., will be understood to include the stated elements or components but not to exclude other elements or components.
[0050] In the existing technical solutions, there are methods for cropping remote sensing images. Specifically, the usual practice is to resample the original image as a whole, and further perform resampling calculations on the cropping results by means of masks to avoid consuming a huge amount of computing resources. The resampling refers to the process of interpolating the information of one type of pixel based on the information of another type of pixel. In remote sensing, resampling is the process of extracting a low-resolution image from a high-resolution remote sensing image. Since the resampled image loses resolution, this technical solution will inevitably have the problem of low output image accuracy. In order to meet the desired requirements for the output image resolution, more computing resources can only be consumed and the image can be cropped at an extremely low rate.
[0051] The inventor of the present invention discovered the main shortcomings of the prior art and proposed a new technical implementation idea based on the shortcomings of the prior art: by setting the circumscribed rectangle of the cutting contour line, classifying, partitioning and blocking the images to be cut, and rationally utilizing IO and CPU computing resources through parallel computing, thereby improving the cutting efficiency and cutting effect without increasing a large amount of computing resources.
[0052] Please refer to Figure 2 FIG. 1 is a flow chart of a remote sensing image cropping method according to an embodiment of the present invention. The remote sensing image cropping method specifically comprises the following steps:
[0053] S201: Acquire a circumscribed rectangle of a cutting contour line, wherein the cutting contour line forms a closed cutting area on the image to be cut;
[0054] It is understandable that the figure enclosed by the cutting contour is the target image to be obtained. Since the image to be cut needs to be clearly defined, the cutting contour needs to form a closed cutting area on the image to be cut. At the same time, there can be one or more cutting areas enclosed by the cutting contour, and the one or more enclosed areas are all images to be cut out, that is, the target image.
[0055] Furthermore, the target image to be acquired is usually only a part of the original image, and a large number of pixels on the original image are actually located outside the target image. Therefore, if the original image is directly cropped, a large amount of computing resources will be wasted. Therefore, in an exemplary embodiment, a circumscribed rectangle can be set for the cropping contour, and the image within the circumscribed rectangle can be processed. Based on this, a large number of pixels separated from the target image can be screened out, reducing the consumption of computing resources. Among them, the closed cropping area is formed by the cropping contour, and the circumscribed rectangle of the present invention refers to a rectangle that can completely contain the cropping area. For example, Figure 1 The figure shows a diagram of setting a circumscribed rectangle of a cutting area in a specific embodiment of the present invention. It can be understood that the shape and orientation of the circumscribed rectangle are not limited in the embodiment of the present invention.
[0056] It should be noted that two-dimensional remote sensing images are usually established in a corresponding projection coordinate system, and a suitable projection coordinate system is crucial to the accuracy of the data and the analysis results. In the embodiment of the present invention, the projection coordinate system corresponding to the remote sensing image may include but is not limited to: WGS84, CGCS2000, Beijing 54 and Xi'an 80, etc., and the embodiment of the present invention does not limit this.
[0057] It is understandable that the circumscribed rectangle is not only used for preliminary spatial judgment, but also the range of the final cropped image. For the circumscribed rectangle whose sides are not parallel to the coordinate axis, the calculation process itself is relatively cumbersome. At the same time, the judgment speed of spatial relationship based on such circumscribed rectangle is slow, which is not conducive to subsequent operations such as block judgment. Therefore, in the projected coordinate system, in order to facilitate the subsequent cropping of the image within the circumscribed rectangle, it is preferred to make the circumscribed rectangle of the cropping contour line parallel to a coordinate axis of the preset plane rectangular coordinate system, for example Figure 1 The circumscribed rectangle A or the circumscribed rectangle B in the image is selected. Furthermore, the smaller the area of the circumscribed rectangle is, the smaller the image area involved in the calculation is, and the less the computing resources are consumed. Therefore, between the circumscribed rectangle A and the circumscribed rectangle B, the circumscribed rectangle A is preferred.
[0058] S202: Divide the image to be cropped within the circumscribed rectangle into blocks, and if an image block is included in the cropping area, write the image block into the target image;
[0059] It is understandable that the shape of the image block is not restricted in the present invention, but each of the image blocks needs to be able to densely cover the entire circumscribed rectangular area to avoid image loss; at the same time, there is no overlapping area between the image blocks to avoid repeated processing of the image in the same area, resulting in a waste of computing resources. In addition, the difficulty of processing the image block is related to the edge complexity and shape differences of each image block. The more uniform the shapes of the image blocks are, the less pressure there is on image processing; the higher the edge complexity of the image block, the more difficult it is to process it, and the more resources are consumed. Therefore, in the present invention, it is preferred to divide the image to be cut in each area within the circumscribed rectangle into a plurality of regular quadrilateral image blocks with equal side lengths.
[0060] In order to further reduce the pressure on image processing, a cache area serving image cropping can be set. Before the image to be processed is divided into blocks, the image to be processed is first partitioned, and the image blocks of different partitions are first processed in the cache area, and then the processed images are written into the target image. In an exemplary embodiment of the present invention, the image to be cropped within the circumscribed rectangle is divided into blocks, including: dividing the circumscribed rectangle into a plurality of image areas; dividing the image to be cropped in each image area within the circumscribed rectangle into a plurality of image blocks of the same shape.
[0061] In order to ensure that the preset cache area can maintain the image processing of each image area and avoid data loss, the memory occupied by the image to be cropped in each image area should be less than or equal to the memory size of the preset cache area.
[0062] It should be noted that, since the circumscribed rectangle of the present invention refers to a rectangle that can completely contain the cropping area, the implementation of the technical solution does not limit a specific side or sides of the circumscribed rectangle to be tangent to the cropping contour line. Therefore, in order to make the area within the circumscribed rectangle fully divided, the length of each side of the circumscribed rectangle can be dynamically adjusted. For example, Figure 5 The block division strategy for the circumscribed rectangle in an exemplary embodiment is shown. In order to divide the circumscribed rectangle into a combination of multiple identical regular quadrilaterals, the side length of the circumscribed rectangle can be adaptively adjusted so that each side of the circumscribed rectangle is separated from the cutting contour line.
[0063] It is understandable that the resolution of an image refers to the total number of pixels per unit length, which represents the density of pixels in the image. Generally, the size of the memory occupied by an image can be expressed as the product of the resolution and the size of each pixel. Therefore, under the condition of a certain image resolution, the size of the cache space can be preset to reversely infer the impact area that the cache space can accommodate. Further, in order to simplify the partitioning and blocking strategy and obtain the optimal image processing effect, it can be done as follows Figure 5As shown, based on one side of the circumscribed rectangle, the circumscribed rectangular area is divided into a plurality of rectangles, and the rectangular area is further divided into a plurality of regular quadrilateral image blocks.
[0064] Specifically, the image to be cropped within the circumscribed rectangle is divided into blocks, including: based on the memory size of a preset cache area, calculating the width of the image area, the length of the circumscribed rectangle being an integer multiple of the width of the image area; based on the length of the circumscribed rectangle and the calculated width of the image area, dividing the circumscribed rectangle into a plurality of rectangular image areas; within each of the image areas, dividing the image to be cropped into a plurality of square image blocks with a side length equal to the width of the image area.
[0065] It is understandable that the image blocks in each image area can be divided into three categories based on the positional relationship between the image blocks and the cropping area: intersecting, separated, and contained. Among them, the separated image blocks do not belong to the target image that needs to be cropped and extracted, so such image blocks can be directly ignored and not processed.
[0066] Furthermore, in an exemplary embodiment, the target image can be written one by one for the image blocks included in the cropped area. However, the one-by-one writing method greatly increases the number of writing operations and consumes more resources. Therefore, thanks to the above-mentioned partitioning and block strategy, the present invention provides another exemplary embodiment for solving the problem caused by writing image blocks one by one.
[0067] In an exemplary embodiment, if an image block is included in the cropped area, writing the image block into the target image includes: merging adjacent image blocks that belong to the same image area and are included in the cropped area in the cache area; and writing each merged image block into the target image. It should be noted that, in order to facilitate writing into the target image, only adjacent image blocks in the same image area are merged, and non-adjacent image blocks are preferably written into the target image separately.
[0068] S203: If the image block intersects with the cropping area, an image of the intersecting area between the image block and the cropping area is obtained, and the image of the intersecting area is written into the target image.
[0069] It is understandable that if the image block intersects with the cropping area, there are one or more pixels in the image block that do not belong to the cropping area. It is necessary to process the intersecting image blocks and filter out the desired image to be written into the target image.
[0070] In an exemplary embodiment of the present invention, an image of an area where an image block intersects with the cropping area is obtained, including: rasterizing the image block that intersects with the cropping area; traversing each pixel point in the image block, and if the pixel point is in the cropping area, writing the pixel information into a target image; if the pixel point is not in the cropping area, ignoring the pixel point.
[0071] Specifically, based on the rasterized image block, a binary mask with the same size as the image block is generated, wherein the value of the binary mask is 1 in the cropped area and the value of the non-cropped area is 0; each pixel in the image block is ANDed with the corresponding value in the mask, and based on the coordinates of each pixel, the pixel information of the pixel points that are not zero after the AND operation is written into the target image.
[0072] It can be understood that, based on the above implementation, after the AND operation, the values of the pixels that do not belong to the cropping area are all 0. However, the efficiency of processing image blocks one by one is slow, so in another example of the present invention, one or more image blocks intersecting with the cropping area can be selected based on the size of the preset cache area and the number of cores of the central processing unit; based on different threads, the image of the area where the selected image block intersects with the cropping area is obtained.
[0073] In order to further illustrate the technical solution of the present invention, a group of specific embodiments are first given as follows:
[0074] First, if Figure 6 As shown, the image to be cropped and the cropping contour formed by the desired cropping effect are input;
[0075] Then, the bounding rectangle of the polygon is calculated and used as the geographic range of the final clipping result; according to the specified cache settings, the tile size and the whole map tile information are calculated, including the range, classification, row and column numbers, etc. The tile types are divided into three categories: the first category is the tile that is completely separated from the polygon, such as Figure 6 The second type is the image block numbered 1 in the figure; the second type is the block that intersects with the polygon, such as Figure 6 The third category is the image block numbered 2 in ; the third category is the block completely contained by the polygon, such as Figure 6 The image block numbered 3 in the figure;
[0076] The image block numbered 1 does not contain any desired information, so it can be ignored; the image block numbered 3 needs to copy pixels directly from the image to be cropped, which mainly consumes IO and is suitable for large cache copying; the image block numbered 2 needs to be vectorized, invalid area calculated, and pixels copied from the image to be cropped, which requires a large amount of calculation and is suitable for parallel computing.
[0077] like Figure 7As shown in the figure, for the image block numbered 3, it is necessary to traverse the blocks of type 3 row by row and merge the continuous blocks; use the merged blocks as ROI (Region of Interest) to load data from the image to be cropped and write it into the target image, and repeat this step until all rows are processed.
[0078] like Figure 8 As shown in the figure, for the image block numbered 2; a fixed number of type 2 blocks (depending on the cache setting and the current number of available CPU cores, if the cache is sufficient, the maximum number of CPU cores shall prevail) are obtained each time as the blocks to be processed; the blocks to be processed are traversed, and data is loaded from the cropped image to the cache with the blocks as ROI; the blocks to be processed are processed in parallel, including rasterization of cropped polygons, calculation of invalid areas, pixel copying, etc.; after waiting for all blocks to be processed, the results are written to the target image; this step is repeated until all image blocks numbered 2 are processed.
[0079] Please refer to Figure 3 As shown, based on the same inventive concept as the aforementioned remote sensing image cropping method, an embodiment of the present invention provides a remote sensing image cropping system 300 , which includes: an acquisition module 301 , a first writing module 302 and a second writing module 303 .
[0080] Specifically, the acquisition module 301 is used to obtain the circumscribed rectangle of the cutting contour line, and the cutting contour line constitutes a closed cutting area on the image to be cut; the first writing module 302 is used to divide the image to be cut within the circumscribed rectangle into blocks, and if the image block is included in the cutting area, the image block is written into the target image; the second writing module 303 is used to obtain the image of the intersection area between the image block and the cutting area if the image block intersects with the cutting area, and write the image of the intersection area into the target image.
[0081] Please refer to Figure 4 As shown, an embodiment of the present invention further provides an electronic device 400, which includes at least one processor 401, a memory 402 (such as a non-volatile memory), a memory 403, and a communication interface 404, and the at least one processor 401, the memory 402, the memory 403, and the communication interface 404 are connected together via an internal bus 405. At least one processor 401 is used to call at least one program instruction stored or encoded in the memory 402, so that the at least one processor 401 performs various operations and functions of the remote sensing image cropping method described in various embodiments of this specification.
[0082] In an embodiment of the present specification, the electronic device 400 may include, but is not limited to, a personal computer, a server computer, a workstation, a desktop computer, a laptop computer, a notebook computer, a mobile electronic device, a smart phone, a tablet computer, a cellular phone, a personal digital assistant (PDA), a handheld device, a messaging device, a wearable electronic device, a consumer electronic device, and the like.
[0083] An embodiment of the present invention further provides a computer-readable medium carrying computer execution instructions. When the computer execution instructions are executed by a processor, they can be used to implement various operations and functions of the remote sensing image cropping method described in various embodiments of this specification.
[0084] The computer-readable medium in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device.
[0085] In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0086] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0087] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatuses, systems, and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as a combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0088] The foregoing description of specific exemplary embodiments of the present invention is for the purpose of illustration and demonstration. These descriptions are not intended to limit the present invention to the precise form disclosed, and it is clear that many changes and variations can be made based on the above teachings. The purpose of selecting and describing the exemplary embodiments is to explain the specific principles of the present invention and its practical application, so that those skilled in the art can realize and utilize various different exemplary embodiments of the present invention and various different selections and changes. The scope of the present invention is intended to be limited by the claims and their equivalents.
[0089] It will be apparent to those skilled in the art that the invention is not limited to the details of the exemplary embodiments described above and that the invention can be implemented in other specific forms without departing from the spirit or essential features of the invention. Therefore, the embodiments should be considered exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and it is intended that all variations falling within the meaning and scope of the equivalent elements of the claims be included in the invention. Any reference numeral in a claim should not be considered as limiting the claim to which it relates.
[0090] In addition, it should be understood that although the present specification is described according to implementation modes, not every implementation mode contains only one independent technical solution. This description of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment may also be appropriately combined to form other implementation modes that can be understood by those skilled in the art.
Claims
1. A remote sensing image cropping method, characterized in that: include: Obtaining a circumscribed rectangle of a cutting contour line, wherein the cutting contour line forms a closed cutting area on the image to be cut; Divide the image to be cropped within the circumscribed rectangle into blocks, and if an image block is included in the cropping area, write the image block into the target image; If the image block intersects with the cropping area, an image of the intersecting area between the image block and the cropping area is obtained, and the image of the intersecting area is written into the target image.
2. The remote sensing image cropping method according to claim 1, characterized in that: Each side of the circumscribed rectangle of the cutting contour line is parallel to a coordinate axis of a preset plane rectangular coordinate system.
3. The remote sensing image cropping method according to claim 1, characterized in that: The method further comprises: Based on the size of a preset cache area and the number of cores of a central processing unit, selecting one or more image blocks intersecting with the cropping area; Based on different threads, an image of the intersection area between the selected image block and the cropping area is obtained.
4. The remote sensing image cropping method according to claim 3, characterized in that: Acquiring an image of the intersection area between the image block and the cropping area, including: rasterizing the image blocks intersecting with the cropping area; Traversing each pixel point in the image block, if the pixel point is in the cropping area, writing the pixel information into the target image; If the pixel point is not in the cropping area, the pixel point is ignored.
5. The remote sensing image cropping method according to claim 4, characterized in that: The method further comprises: Based on the rasterized image block, a binary mask having the same size as the image block is generated, wherein the value of the binary mask is 1 in the cropped area and 0 in the non-cropped area; An AND operation is performed on each pixel in the image block and the corresponding value in the mask, and based on the coordinates of each pixel point, pixel information of the pixel points that are not zero after the AND operation is written into the target image.
6. The remote sensing image cropping method according to claim 1, characterized in that: Dividing the image to be cropped within the circumscribed rectangle into blocks, including: Dividing the circumscribed rectangle into a plurality of image regions, wherein the memory occupied by the image to be cut in each of the image regions is less than or equal to the memory size of a preset cache region; The image to be cropped in each area within the circumscribed rectangle is divided into a plurality of image blocks of the same shape.
7. The remote sensing image cropping method according to claim 6, characterized in that: Dividing the image to be cropped within the circumscribed rectangle into blocks, including: Based on the memory size of the preset cache area, the width of the image area is calculated, and the length of the circumscribed rectangle is an integer multiple of the width of the image area; Dividing the circumscribed rectangle into a plurality of rectangular image regions based on the length of the circumscribed rectangle and the calculated width of the image region; In each of the image regions, the image to be cropped is divided into a plurality of square image blocks with a side length equal to the width of the image region.
8. The remote sensing image cropping method according to claim 7, characterized in that: If the image block is included in the cropping area, writing the image block into the target image comprises: Merging adjacent image blocks belonging to the same image area and included in the cropping area in the cache area; Each merged image block is written into the target image.
9. A remote sensing image cropping system, using the remote sensing image cropping method according to any one of claims 1 to 8, characterized in that: include: An acquisition module, used for acquiring a circumscribed rectangle of a cutting contour line, wherein the cutting contour line forms a closed cutting area on the image to be cut; A first writing module, used for dividing the image to be cut within the circumscribed rectangle into blocks, and if an image block is included in the cutting area, writing the image block into the target image; The second writing module is used for obtaining an image of an intersecting area between the image block and the cropping area if the image block intersects the cropping area, and writing the image of the intersecting area into a target image.
10. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the remote sensing image cropping method according to any one of claims 1 to 7 by executing the computer instructions.