A method for analyzing city-mountain spatial relationship based on ancient spatial images

By extracting city and mountain textual and morphological elements from ancient spatial images, constructing and classifying city and mountain textual-morphological element pairs, the problem of accuracy and comprehensiveness in analyzing the spatial relationship between cities and mountains is solved, achieving efficient multi-scale analysis and supporting ancient urban planning and cultural heritage protection.

CN119600637BActive Publication Date: 2026-04-21CHONGQING UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING UNIV
Filing Date
2024-11-21
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies lack effective methods for analyzing the spatial relationship between cities and mountains in ancient spatial images, resulting in insufficient accuracy and comprehensiveness of the analysis, as well as low efficiency.

Method used

By extracting the textual and morphological elements of cities and mountains from ancient spatial images, we construct textual-morphological element pairs for cities and mountains, and classify them into city element datasets and mountain element datasets for multi-scale spatial relationship analysis.

Benefits of technology

It improves the accuracy, comprehensiveness, and efficiency of the analysis of the spatial relationship between cities and mountains, provides a convenient data foundation, supports quantitative analysis and spatial modeling, and enhances the understanding of ancient urban planning and cultural heritage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119600637B_ABST
    Figure CN119600637B_ABST
Patent Text Reader

Abstract

This invention discloses a method for analyzing the spatial relationship between cities and mountains based on ancient spatial images, comprising: acquiring ancient spatial images of a target area; performing text recognition and extraction on the ancient spatial images of the target area to obtain city-mountain textual elements; performing morphological recognition and extraction on the ancient spatial images of the target area to obtain city-mountain morphological elements; associating the city-mountain morphological elements of the target area with the corresponding city-mountain textual elements to form city-mountain textual-morphological element pairs; classifying the city-mountain textual-morphological element pairs into city element datasets and mountain element datasets; and analyzing the spatial relationship between the city and mountains based on the city element datasets and mountain element datasets of the target area. This invention improves the accuracy and comprehensiveness of the analysis of the spatial relationship between cities and mountains by extracting city-mountain textual and morphological elements from ancient spatial images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of spatial relationship analysis technology, specifically to a method for analyzing city-mountain spatial relationships based on ancient spatial images. Background Technology

[0002] In ancient times, spatial images served as an important means of recording history and depicting natural and cultural landscapes, providing us with a valuable window into ancient society, culture, and environment. Among these images, the relationship between cities and mountains is particularly striking. They not only reflect the ancients' profound understanding and ingenious utilization of the geographical environment but also embody the integration of urban planning wisdom and ecological concepts. In-depth analysis of the spatial relationship between cities and mountains in ancient spatial images is of great significance for understanding the principles of urban layout, ecological environment, military defense, and cultural symbolism.

[0003] In ancient spatial imagery, the relationship between cities and mountains presents diverse forms. Some cities were built against mountains, utilizing the natural barriers and resources provided by the mountains to form a robust defensive system and a rich ecosystem; others were situated at the foot of mountains or in mountain plains, maintaining a certain distance from the mountains, thus enjoying the nourishment of the mountains while avoiding the threat of natural disasters such as flash floods. In addition, some cities were built directly on mountaintops; this unique layout was often for military defense considerations, utilizing the rugged terrain of the mountains to form a natural defensive barrier.

[0004] Analyzing the spatial relationship between cities and mountains in ancient spatial images reveals the profound wisdom of ancient urban planning. Based on the shape, height, and slope of mountains, the ancients skillfully planned the layout of cities, ensuring harmony between the city and the mountains. This not only met people's living needs but also reflected a respect for nature and a philosophy of harmonious coexistence. The relationship between cities and mountains also reflects the ecological environment of ancient cities. Mountains, as an important component of cities, provided abundant natural resources such as water, timber, and minerals. At the same time, mountains also played ecological functions such as regulating climate, purifying air, and conserving soil and water. By analyzing the spatial relationship between cities and mountains, we can gain a deeper understanding of the ecological environment of ancient cities and its impact on human life.

[0005] The spatial relationship between cities and mountains in ancient urban planning offers valuable lessons. In urban planning, we can draw upon the wisdom of our ancestors, fully considering the characteristics and limitations of the natural environment, and rationally plan the layout and functional zoning of cities to achieve harmonious coexistence between humanity and nature. By analyzing the spatial relationship between cities and mountains in ancient spatial images, we can better understand the value and significance of ancient cultural heritage. This helps us strengthen the protection and inheritance of cultural heritage, allowing more people to understand and appreciate the charm of ancient culture. The spatial relationship between cities and mountains in ancient spatial images involves multiple disciplines such as geography, history, and architecture. Through interdisciplinary research and collaboration, we can more comprehensively understand and analyze the essence and laws of this phenomenon, promoting the development and progress of related disciplines.

[0006] Therefore, analyzing the spatial relationship between cities and mountains in ancient spatial images is crucial for understanding the wisdom of ancient urban planning, the state of the ecological environment, the significance of cultural symbols, and for providing insights for modern urban planning. However, there is currently no method for analyzing the city-mountain spatial relationship based on ancient spatial images. Summary of the Invention

[0007] To address the shortcomings of the existing technologies, the technical problem to be solved by this invention is: how to provide a method for analyzing the spatial relationship between cities and mountains based on ancient spatial images, which extracts the textual and morphological elements of cities and mountains from ancient spatial images, thereby improving the accuracy and comprehensiveness of the analysis of the spatial relationship between cities and mountains; and at the same time, dividing the extracted textual and morphological elements of cities and mountains into datasets to improve the efficiency and convenience of the analysis of the spatial relationship between cities and mountains.

[0008] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0009] A method for analyzing city-mountain spatial relationships based on ancient spatial images includes:

[0010] S1: Acquire ancient spatial images of the target area;

[0011] S2: Perform text recognition and extraction on the ancient spatial image of the target area to obtain the Chengshan text elements;

[0012] S3: Perform morphological recognition and extraction on the ancient spatial image of the target area to obtain the morphological elements of the city and mountains;

[0013] S4: Associate the city and mountain morphological elements of the target area with the corresponding city and mountain text elements to form city and mountain text-morphological element pairs;

[0014] S5: Classify the text-morphological element pairs of the city and mountain into city element datasets and mountain element datasets;

[0015] S6: Analyze the spatial relationship between the city and the mountain based on the city element dataset and the mountain element dataset of the target area.

[0016] Preferably, in step S2, after extracting the city and mountain characters from the ancient spatial image, the location information of the city and mountain characters in the corresponding ancient spatial image is located; and the city and mountain characters are bound to their location information in the corresponding ancient spatial image.

[0017] Preferably, in step S3, after extracting the city and mountain morphology elements from the ancient spatial image, the location information of the city and mountain morphology elements in the corresponding ancient spatial image is located.

[0018] In step S4, the city mountain morphological element is associated with the city mountain text element corresponding to its position information in the corresponding ancient spatial image to form a city mountain text-morphological element pair.

[0019] Preferably, in step S2, the city-mountain script elements of the ancient spatial image are extracted through the following steps:

[0020] S201: Preprocess ancient spatial images;

[0021] S202: Binarize the preprocessed ancient spatial image to obtain the binarized image of Chengshan.

[0022] S203: Perform morphological processing on the binarized image of Chengshan;

[0023] S204: Identify and label connected components in the morphologically processed binarized image of Chengshan; segment the identified connected components into individual characters;

[0024] S205: The OCR recognition model identifies the corresponding text based on the segmented characters to obtain the Chengshan text elements.

[0025] Preferably, in step S3, the city and mountain morphology elements of the ancient spatial image are extracted through the following steps:

[0026] S301: Preprocess ancient spatial images;

[0027] S302: Input the preprocessed ancient spatial image into the trained shape recognition model to identify and label the target shapes in the ancient spatial image, and output the city mountain spatial image with target shape segmentation mask; wherein, the shape recognition model is built based on the convolutional neural network model;

[0028] S303: Input the city and mountain spatial image with target shape segmentation mask into the trained shape segmentation model, segment the target shape from the background of the ancient spatial image, and output the target shape image as the city and mountain morphological element; wherein, the shape segmentation model is built based on the SegNet model.

[0029] Preferably, in step S302, the shape recognition model is trained through the following steps:

[0030] S3021: Obtain a city-mountain image sample containing the target shape, annotate the target shape in the city-mountain image sample, and generate an annotated image containing the target shape segmentation mask;

[0031] S3022: Divide all labeled images into training set, validation set and test set;

[0032] S3023: Constructing a shape recognition model based on a convolutional neural network;

[0033] S3024: Input the training set into the shape recognition model, calculate the model loss through forward propagation, and update the model parameters through back propagation until the shape recognition model achieves satisfactory performance on the validation set;

[0034] S3025: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

[0035] Preferably, in step S303, the shape segmentation model is trained through the following steps:

[0036] S3031: Obtain city and mountain image samples containing the target shape, and generate a corresponding segmentation mask for each city and mountain image sample;

[0037] S3032: Divide all the city and mountain image samples and their corresponding segmentation masks into training set, validation set and test set;

[0038] S3033: Constructing a shape segmentation model based on SegNet;

[0039] S3034: Input the Chengshan image samples and segmentation mask in batches into the shape segmentation model for training, and update the model weights through the backpropagation algorithm until the shape recognition model achieves satisfactory performance on the validation set.

[0040] S3035: Evaluate the performance of the shape recognition model using the validation and test sets, and make necessary adjustments.

[0041] Preferably, in step S5, the city-mountain text-morphology element pairs are classified based on the text names of the city-mountain text elements and the morphological structures of the city-mountain morphology elements, to obtain city element datasets and mountain element datasets.

[0042] Preferably, in step S6, the city elements include city walls, city structure, and landmark buildings;

[0043] The city element dataset includes subsets of city wall elements, city structure elements, and landmark building elements.

[0044] Preferably, in step S6:

[0045] Based on the mountain feature dataset and city wall feature subset of the target area, the macro-scale spatial relationship between the city and the mountains is analyzed;

[0046] Based on the mountain element dataset and urban establishment element subset of the target area, the mesoscale spatial relationship between the city and the mountain is analyzed.

[0047] Based on the mountain element dataset and landmark building element subset of the target area, the micro-scale spatial relationship between the city and the mountains is analyzed.

[0048] Compared with existing technologies, the city-mountain spatial relationship analysis method based on ancient spatial images in this invention has the following advantages:

[0049] This invention extracts both textual and morphological elements of ancient spatial images of cities and mountains, constructing textual-morphological element pairs. Firstly, textual elements reflect the names and descriptions of cities and mountains, while morphological elements reflect their shapes and structures. Linking textual and morphological elements creates a more complete information system. For example, textual recognition identifies a location as a city, while morphological recognition confirms the outline and layout of the city walls. Combining these two methods allows for more accurate location and analysis of the relationship between the city and surrounding mountains, thus improving the accuracy of spatial relationship analysis. Secondly, comprehensively considering both textual (elemental) and morphological information avoids the limitations of relying on a single information source. For instance, relying solely on textual information may fail to accurately depict the actual layout of a city, while relying solely on morphological information may overlook important historical background information, thereby improving the comprehensiveness of the spatial relationship analysis. Finally, constructing textual-morphological element pairs provides foundational data for subsequent spatial relationship analysis. This paired data facilitates quantitative analysis, spatial modeling, and other operations, leading to a deeper understanding of the spatial relationship between cities and mountains.

[0050] This invention categorizes city-mountain text-morphological element pairs into city element datasets and mountain element datasets, thereby analyzing the spatial relationship between cities and mountains. By dividing the element pairs into city element datasets and mountain element datasets, information about the city and the mountain can be reflected separately, facilitating targeted analysis and processing of cities and mountains. Furthermore, the categorized datasets allow for easy extraction of the required city and mountain information, enabling targeted analysis of the spatial relationship between cities and mountains, thus improving the efficiency and convenience of city-mountain spatial relationship analysis. Additionally, the city element datasets or mountain element datasets can be further subdivided, allowing for spatial relationship analysis at different scales based on the subdivided subsets, thereby enhancing the flexibility of city-mountain spatial relationship analysis. Attached Figure Description

[0051] To make the objectives, technical solutions, and advantages of the invention clearer, the invention will now be described in further detail with reference to the accompanying drawings, wherein:

[0052] Figure 1 This is a logical flowchart of a method for analyzing the spatial relationship between cities and mountains based on ancient spatial images.

[0053] Figure 2 A flowchart for acquiring ancient spatial images;

[0054] Figure 3 This is a schematic diagram illustrating the recognition and extraction of text from ancient spatial images.

[0055] Figure 4 This is a network structure diagram of a morphological recognition (CNN) model;

[0056] Figure 5 This is a network structure diagram of the SegNet model for morphological segmentation. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but only to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0058] The following detailed explanation illustrates the specific implementation methods:

[0059] Example:

[0060] This embodiment discloses a method for analyzing the spatial relationship between cities and mountains based on ancient spatial images.

[0061] like Figure 1 As shown, the method for analyzing the spatial relationship between cities and mountains based on ancient spatial images includes:

[0062] S1: Obtain ancient spatial images of the target area (such as a city or region);

[0063] Combination Figure 2As shown, the sources of ancient spatial images can be divided into six categories, including: ① illustrations in typical classic texts (such as the "Map of the Nine Provinces of Yu Gong" in the Book of Documents); ② illustrations in local gazetteers: including maps, administrative diagrams, and the Eight Views. Figure 3 ③ Other ancient maps (such as maps of local scenic spots, maps carved on stone tablets, maps whose sources have been lost, etc.); ④ Local landscape paintings; ⑤ Han Dynasty brick paintings, rock paintings, murals; ⑥ Modern urban survey maps.

[0064] Images in categories ① and ② can be collected from platforms such as the *Basic Ancient Chinese Books Database*, the *Digitalization Project of Chinese Philosophy Books*, the *Chinese Local Chronicles Database*, and the *Chinese Digital Local Chronicles Database*. Images in category ③ are collected from all images in the *Atlas of Ancient Chinese Maps*, the *Atlas of Chinese Historical Maps*, and complete collections of local maps. Images in category ④ are collected from all verifiable landscape paintings in the *Complete Collection of Pre-Qin, Han, and Tang Paintings*, the *Complete Collection of Song Paintings*, the *Complete Collection of Ming Paintings*, and the *Complete Collection of Qing Paintings*. Images in category ⑤ are collected from natural-themed paintings in the *Complete Collection of Chinese Han Dynasty Pictorial Stones*, the *Complete Collection of Chinese Tomb Murals*, and the *Complete Collection of Chinese Dunhuang Murals*. Images in category ⑥ are collected from case studies of modern local maps found in massive online databases. Preliminary collection and digitization of these six categories of images have been conducted to form a closed "city-mountain" image database, currently totaling 13,141 images. The main data types are local gazetteer illustrations and other ancient maps. Currently, the clarity of more than 9,803 local gazetteer illustrations and other ancient maps of 141 historical and cultural cities has been improved and the images and text have been digitized. Among them, there are 1,259 maps, 282 administrative maps, 224 scenic spots maps, and 8,038 other ancient maps.

[0065] S2: Perform text recognition and extraction on the ancient spatial image of the target area to obtain the Chengshan text elements;

[0066] S3: Perform morphological recognition and extraction on the ancient spatial image of the target area to obtain the morphological elements of the city and mountains;

[0067] S4: Associate the city and mountain morphological elements of the target area with the corresponding city and mountain text elements to form city and mountain text-morphological element pairs;

[0068] S5: Classify the text-morphological element pairs of the city and mountain into city element datasets and mountain element datasets;

[0069] S6: Analyze the spatial relationship between the city and the mountain based on the city element dataset and the mountain element dataset of the target area.

[0070] This invention extracts both textual and morphological elements of ancient spatial images of cities and mountains, constructing textual-morphological element pairs. Firstly, textual elements reflect the names and descriptions of cities and mountains, while morphological elements reflect their shapes and structures. Linking textual and morphological elements creates a more complete information system. For example, textual recognition identifies a location as a city, while morphological recognition confirms the outline and layout of the city walls. Combining these two methods allows for more accurate location and analysis of the relationship between the city and surrounding mountains, thus improving the accuracy of spatial relationship analysis. Secondly, comprehensively considering both textual (elemental) and morphological information avoids the limitations of relying on a single information source. For instance, relying solely on textual information may fail to accurately depict the actual layout of a city, while relying solely on morphological information may overlook important historical background information, thereby improving the comprehensiveness of the spatial relationship analysis. Finally, constructing textual-morphological element pairs provides foundational data for subsequent spatial relationship analysis. This paired data facilitates quantitative analysis, spatial modeling, and other operations, leading to a deeper understanding of the spatial relationship between cities and mountains.

[0071] This invention categorizes city-mountain text-morphological element pairs into city element datasets and mountain element datasets, thereby analyzing the spatial relationship between cities and mountains. By dividing the element pairs into city element datasets and mountain element datasets, information about the city and the mountain can be reflected separately, facilitating targeted analysis and processing of cities and mountains. Furthermore, the categorized datasets allow for easy extraction of the required city and mountain information, enabling targeted analysis of the spatial relationship between cities and mountains, thus improving the efficiency and convenience of city-mountain spatial relationship analysis. Additionally, the city element datasets or mountain element datasets can be further subdivided, allowing for spatial relationship analysis at different scales based on the subdivided subsets, thereby enhancing the flexibility of city-mountain spatial relationship analysis.

[0072] In the specific implementation process, after extracting the city and mountain characters from the ancient spatial image, the location information of the city and mountain characters in the corresponding ancient spatial image is located; and the city and mountain characters are bound to the location information of the corresponding ancient spatial image.

[0073] In this embodiment, the ancient spatial image can be gridded, and then the lower left corner of the ancient spatial image can be used as the origin to calculate the position coordinates of the Chengshan text elements in the ancient spatial image as position information.

[0074] In the specific implementation process, after extracting the city and mountain morphology elements from the ancient spatial image, the location information of the city and mountain morphology elements in the corresponding ancient spatial image is located.

[0075] In step S4, the city mountain morphological element is associated with the city mountain text element corresponding to its position information in the corresponding ancient spatial image to form a city mountain text-morphological element pair.

[0076] This invention, after extracting the textual and morphological elements of the city and mountain landscape, locates the positional information of these elements in ancient spatial images. Subsequent retrieval of a specific element through a database allows for direct location of its exact position in the spatial image, facilitating accurate extraction of element information. Furthermore, by using the positional information as a benchmark for associating textual and morphological elements, the association between the textual and morphological elements of the city and mountain landscape can be accurately established, improving the accuracy and comprehensiveness of subsequent analyses of the spatial relationship between the city and the mountain.

[0077] In the specific implementation process, combined with Figure 3 As shown, the Chengshan script elements of ancient spatial images are extracted through the following steps:

[0078] S201: Preprocess ancient spatial images;

[0079] In this embodiment, ancient spatial images may be affected by factors such as time erosion, pollution, and fading, causing text information to become blurred or difficult to recognize. Therefore, image enhancement processing is required, such as noise reduction, sharpening, and color correction, to improve the clarity of the text in the image.

[0080] S202: Binarize the preprocessed ancient spatial image to obtain the binarized image of Chengshan.

[0081] In this embodiment, binarization can be achieved using either a global thresholding method or an adaptive thresholding method. The global thresholding method selects a global threshold, sets pixels with grayscale values ​​higher than this threshold as foreground (white), and the rest as background (black), suitable for cases with uniform background brightness. The adaptive thresholding method (such as the Otsu method) automatically calculates the optimal threshold based on the image's grayscale histogram, suitable for cases with uneven background brightness.

[0082] S203: Perform morphological processing on the binarized image of Chengshan, including erosion, dilation, opening or closing operations;

[0083] In this embodiment, erosion refers to removing small pixels at the edges of the image, which helps to remove noise. Dilation refers to enlarging the white areas in the image, which helps to fill the holes inside the characters. Opening operation (erosion followed by dilation) removes small white areas (noise) while maintaining the shape of the characters. Closing operation (dilation followed by erosion) fills small black areas (holes) while maintaining the separation between characters.

[0084] S204: Identify and label connected components in the morphologically processed binarized image of Chengshan (where each connected component corresponds to a character or a part of a character); segment the identified connected components into individual characters;

[0085] In this embodiment, a connected component analysis algorithm (such as depth-first search or breadth-first search) is used to traverse the binarized image of Chengshan and label each connected component. Based on features such as the size and shape of the connected components, character regions that meet the criteria are selected. For example, connected components that are too small or too large can be removed. A contour detection algorithm (such as Canny edge detection) is used to extract the contours of the connected components, and then the characters are segmented based on the shape and position information of the contours.

[0086] S205: The Chengshan text elements are obtained by recognizing the corresponding text based on the segmented characters using an OCR (Optical Character Recognition) model.

[0087] In this embodiment, character recognition can be achieved using existing OCR (Optical Character Recognition) models or tools, such as the Tesseract model, Baidu OCR model, LightPDF, and CamScanner.

[0088] This invention improves the clarity and operability of ancient spatial images through image preprocessing, binarization, and morphological processing; at the same time, it can accurately extract and recognize textual information in ancient spatial images through connected component analysis algorithms and OCR recognition technology, thereby improving the accuracy of extracting Chengshan textual elements.

[0089] In the specific implementation process, the city and mountain morphology elements of ancient spatial images are extracted through the following steps:

[0090] S301: Preprocess ancient spatial images;

[0091] In this embodiment, the preprocessing can be referred to step S201.

[0092] S302: Input the preprocessed ancient spatial image into the trained shape recognition model to identify and label the target shapes in the ancient spatial image, and output the city and mountain spatial image with target shape segmentation mask; wherein, the shape recognition model is built based on the convolutional neural network (CNN) model;

[0093] S303: Input the city and mountain spatial image with target shape segmentation mask into the trained shape segmentation model, segment the target shape from the background of the ancient spatial image, and output the target shape image as the city and mountain morphological element; wherein, the shape segmentation model is built based on the SegNet model.

[0094] Specifically, in combination Figure 4As shown, the shape recognition model is trained through the following steps:

[0095] S3021: Obtain a city-mountain image sample containing the target shape, annotate the target shape in the city-mountain image sample, and generate an annotated image containing the target shape segmentation mask;

[0096] In this embodiment, the target shapes include mountains, city walls, urban structures, and landmark buildings. Image annotation tools (such as LabelImg, VIA, etc.) are used to annotate the target shapes.

[0097] S3022: Divide all labeled images into training set, validation set and test set;

[0098] In this embodiment, the labeled images need to be preprocessed to make them suitable for input into the CNN model. Preprocessing includes image scaling, data augmentation, and normalization. Image scaling: Adjusting all images to the same size to fit the model's input requirements. Data augmentation: Increasing data diversity through methods such as rotation, flipping, cropping, and color transformation to improve the model's generalization ability. Normalization: Normalizing image pixel values ​​to a specific range (e.g., 0-1) to accelerate the model training process and improve convergence speed.

[0099] S3023: Constructing a shape recognition model based on a convolutional neural network;

[0100] In this embodiment, a pre-trained CNN model (such as VGG, ResNet, MobileNet, etc.) can be selected as the base model. Additional convolutional layers, pooling layers, and fully connected layers are added to the base model to extract more complex features and perform classification. Based on the task requirements, the output layer of the shape recognition model selects segmentation mask prediction.

[0101] S3024: Input the training set into the shape recognition model, calculate the model loss through forward propagation, and update the model parameters through back propagation until the shape recognition model achieves satisfactory performance on the validation set;

[0102] S3025: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

[0103] Specifically, in combination Figure 5 As shown, the shape segmentation model is trained through the following steps:

[0104] S3031: Obtain city and mountain image samples containing the target shape, and prepare a corresponding segmentation mask for each city and mountain image sample;

[0105] In this embodiment, the target shape includes mountains, city walls, urban structures, and landmark buildings. The segmentation mask is a binary image, with the target shape in white and the background in black.

[0106] S3032: Divide all the city and mountain image samples and their corresponding segmentation masks into training set, validation set and test set;

[0107] In this embodiment, the Chengshan image samples and segmentation masks need to be preprocessed. The preprocessing includes: image scaling, adjusting the image and mask to the size required for the SegNet model input; data augmentation, applying data augmentation techniques such as rotation, flipping, and scaling to increase the diversity of the dataset and improve the model's generalization ability; and normalization, normalizing the image pixel values ​​to the range of [0,1] to accelerate model training and improve performance.

[0108] S3033: Construct a shape segmentation model based on SegNet and randomly initialize the weights of the shape segmentation model;

[0109] In this embodiment, the shape segmentation (SegNet) model is an encoder-decoder architecture. The encoder is used for layer-by-layer downsampling to extract image features. The decoder is used for layer-by-layer upsampling to restore image resolution and generate a segmentation mask.

[0110] S3034: Input the Chengshan image samples and segmentation mask in batches into the shape segmentation model for training, and update the model weights through the backpropagation algorithm until the shape recognition model achieves satisfactory performance on the validation set.

[0111] In this embodiment, the cross-entropy loss function is used to calculate the difference between the model output and the true mask, and an optimizer (such as Adam, SGD, etc.) is used to minimize the loss function.

[0112] S3035: Evaluate the performance of the shape recognition model using the validation and test sets, and make necessary adjustments.

[0113] In this embodiment, the intersection-over-union ratio (IoU) between the model output mask and the ground truth mask is calculated to evaluate segmentation accuracy. The precision and recall of the model output mask are calculated to evaluate model performance.

[0114] This invention first uses a CNN to identify and label target shapes in ancient spatial images, obtaining a city-mountain spatial image with target shape segmentation masks. Then, based on the city-mountain spatial image with target shape segmentation masks, the SegNet model segments the target shapes from the background of the ancient spatial image to obtain the city-mountain morphological elements. Firstly, CNNs can automatically extract local features from images, such as edges and textures, through their convolutional layers. These features are crucial for identifying key elements such as mountains, city walls, and city gates in ancient spatial images. Simultaneously, CNNs are robust to image translation, rotation, and scale changes, and can cope with image distortions caused by factors such as shooting angle and lighting conditions in ancient spatial images. Secondly, the SegNet model employs an encoder-decoder architecture, enabling pixel-level fine-grained classification of the input image, achieving precise segmentation of city-mountain morphological elements in ancient spatial images. Furthermore, SegNet, through a pooling index propagation mechanism, better reconstructs object edges and details during upsampling, improving the accuracy of segmentation boundaries. Finally, by combining CNN and SegNet models, we can achieve efficient and accurate identification and segmentation of city and mountain morphological elements in ancient spatial images, thereby improving the accuracy and efficiency of subsequent analysis of the spatial relationship between cities and mountains.

[0115] In the specific implementation process, the text names of the text elements of the city and mountains and the morphological structure of the city and mountains are combined to classify the text-morphological element pairs of the city and mountains, resulting in city element datasets and mountain element datasets.

[0116] In this embodiment, as shown in Table 1, the mountain element dataset is mainly categorized based on the mountain's name and morphological structure (triangular-like structure or combination of triangular structures). The mountain elements have rich textual annotations and detailed morphological descriptions, exhibiting a dual dependence on both text and form.

[0117] Table 1. Urban-Mountain Spatial Image Recognition Table

[0118]

[0119]

[0120] For the subset of city wall elements, they are mainly categorized based on the shape and structure of the city walls (linear or strip-shaped enclosure). The city wall elements have virtually no textual annotations and are therefore more dependent on their shape.

[0121] For subsets of urban administrative elements, classification is primarily based on the specific names of urban administrative structures (such as government offices, academies, ancestral temples, passes, and city gates) and their structural forms (1. ordinary abstract buildings (structural combinations of trapezoids and rectangles), courtyards; 2. city gates: two-story buildings with arched forms superimposed on linear or strip-shaped enclosures (structural combinations of trapezoids, rectangles, and arches)). Textual labels for urban administrative elements directly indicate the building's function, leading to high textual dependence. Architectural descriptions are highly abstract, and building forms are homogeneous, making it difficult to summarize the functional nature of elements through morphological representation.

[0122] For the subset of landmark building elements, classification is mainly based on the specific names of the landmark buildings (buildings, pavilions, towers, and kiosks) and their morphological structures (buildings and pavilions: multiple layers of ordinary abstract buildings; towers: multiple layers of ordinary abstract buildings with isosceles triangles whose apex angle is less than 30°; kiosks: a combination of triangles and rectangles). Landmark building elements have prominent morphological characteristics and are more form-dependent.

[0123] This invention classifies city-mountain text-morphology element pairs based on the text names of city-mountain text elements and the morphological structure of city-mountain morphological elements, and can accurately classify element pairs into city element datasets and mountain element datasets.

[0124] In the specific implementation process, urban elements include city walls, urban structure, and landmark buildings;

[0125] The city element dataset includes subsets of city wall elements, city structure elements, and landmark building elements.

[0126] In this embodiment, the mountain element dataset mainly includes mountains. The city wall element subset mainly includes city walls. The city structure element subset mainly includes government offices, academies, ancestral temples, passes, and city gates. The landmark building element subset mainly includes towers, pavilions, pagodas, and kiosks.

[0127] In the specific implementation process, based on the mountain element dataset and city wall element subset of the target area, the macro-scale spatial relationship between the city and the mountains is analyzed;

[0128] In this embodiment, the macro-scale city-mountain relationship information can be extracted primarily from local gazetteer maps and regional scenic maps. By recognizing the morphological characteristics of mountain and city wall elements in each image, the elements are overlaid to form macro-spatial relationship information between the city and the mountains, such as combinations like: mountains inside the city, mountains outside the city, and the city on the mountain.

[0129] Based on the mountain element dataset and urban establishment element subset of the target area, the mesoscale spatial relationship between the city and the mountain is analyzed.

[0130] In this embodiment, the spatial relationship information between urban administrative elements and mountains at the mesoscale is extracted primarily from local gazetteer maps, administrative maps, and maps of local scenic spots. By overlaying the text recognition of government offices, academies, and ancestral temples in each image with the morphological recognition of mountain elements, the important buildings such as government offices, academies, and ancestral temples, as well as the mountains in their front, back, left, and right directions, are labeled, forming the mesoscale spatial relationship between important buildings and mountains.

[0131] Based on the mountain element dataset and landmark building element subset of the target area, the micro-scale spatial relationship between the city and the mountains is analyzed.

[0132] In this embodiment, the spatial relationship information between micro-scale landscape architecture and mountains can be extracted from images primarily consisting of local gazetteer maps, eight scenic spots maps, and local landscape maps. By recognizing the morphology of landmark building elements and mountain elements, the elements are overlaid to identify the overlapping combination patterns of buildings, pavilions, towers, and mountains, thus obtaining the construction location information of landscape elements in the mountains.

[0133] In this invention, the city element dataset is subdivided into city wall element subsets, city establishment element subsets, and landmark building element subsets. Spatial relationship analysis at different scales is then performed on these subsets and the mountain element dataset, thereby improving the flexibility of the spatial relationship analysis between the city and the mountain.

[0134] First, this study analyzes the macro-scale spatial relationship between cities and mountains based on a subset of mountain element datasets and city wall element datasets. Firstly, as a crucial defensive structure in ancient cities, the location and form of city walls directly reflect the strategic considerations of ancient city site selection. Analyzing the city wall element subset and mountain element datasets allows for the precise calculation of parameters such as spatial distance, relative height, and visual obstruction between city walls and mountains, thereby improving the accuracy of the spatial relationship analysis. Secondly, macro-scale analysis helps reveal historical patterns of long-term interaction between cities and mountains, such as whether cities prospered or declined due to mountains, and the strategies cities employed to utilize and protect mountain resources in different historical periods. Finally, macro-scale spatial relationship analysis can provide historical evidence for the formulation of modern urban planning and protection strategies, such as determining suitable directions for urban expansion and key areas for protecting mountain ecosystems.

[0135] Second, this study analyzes the mesoscale spatial relationship between cities and mountains based on a dataset of mountain elements and a subset of urban administrative elements. Firstly, the relationship between the layout of urban administrative elements (such as government offices, academies, ancestral temples, passes, and city gates) and the mountains reflects the logic and characteristics of ancient urban spatial organization. Analyzing the spatial relationship between these elements and mountains can deepen our understanding of urban spatial layout, functional zoning, and transportation networks. Secondly, mesoscale analysis helps explore pathways for the integrated development of urban culture and ecology, such as how cities can leverage mountain resources to develop tourism and cultural industries, and how to integrate ecological protection concepts into urban construction. Finally, the mesoscale spatial relationship analysis can provide guidance for modern urban renewal and redevelopment practices, such as prioritizing urban renewal projects and formulating ecological protection and restoration plans.

[0136] Third, the micro-scale spatial relationship between the city and the mountains is analyzed based on a dataset of mountain elements and a subset of landmark building elements. Firstly, landmark buildings, as important carriers of urban history and culture, directly reflect the city's historical character and cultural features through their spatial relationship with the mountains. Analyzing this micro-scale spatial relationship enhances the readability of urban history and culture, providing a new perspective for urban tourism and cultural dissemination. Secondly, micro-scale analysis helps identify innovative points in urban landscape design, such as utilizing mountain resources to create unique urban landscapes and incorporating mountain elements into architectural design. These innovations can provide inspiration and reference for modern urban landscape design. Finally, optimizing the micro-scale spatial relationship between the city and the mountains allows for better urban development, such as constructing viewing platforms and walking trails.

[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit the technical solutions. Those skilled in the art should understand that any modifications or equivalent substitutions to the technical solutions of the present invention without departing from the spirit and scope of the present invention should be covered within the scope of the claims of the present invention.

Claims

1. A method for analyzing the spatial relationship between cities and mountains based on ancient spatial images, characterized in that, include: S1: Obtain ancient spatial images of the target area; S2: Perform text recognition and extraction on the ancient spatial image of the target area to obtain the Chengshan text elements; In step S2, the Chengshan script elements of the ancient spatial image are extracted through the following steps: S201: Preprocess ancient spatial images; S202: Binarize the preprocessed ancient spatial image to obtain the binarized image of Chengshan. S203: Perform morphological processing on the binarized image of Chengshan; S204: Identify and label connected components in the morphologically processed binarized image of Chengshan; segment the identified connected components into individual characters; S205: The OCR recognition model identifies the corresponding text based on the segmented characters to obtain the Chengshan text elements; S3: Perform morphological recognition and extraction on the ancient spatial image of the target area to obtain the morphological elements of the city and mountains; In step S3, the city and mountain morphology elements of the ancient spatial image are extracted through the following steps: S301: Preprocess ancient spatial images; S302: Input the preprocessed ancient spatial image into the trained shape recognition model to identify and label the target shapes in the ancient spatial image, and output the city mountain spatial image with target shape segmentation mask; wherein, the shape recognition model is built based on the convolutional neural network model; S303: Input the city-mountain spatial image with target shape segmentation mask into the trained shape segmentation model, segment the target shape from the background of the ancient spatial image, and output the target shape image as the city-mountain morphological element; wherein, the shape segmentation model is built based on the SegNet model; S4: Associate the city and mountain morphological elements of the target area with the corresponding city and mountain text elements to form city and mountain text-morphological element pairs; S5: Classify the text-morphological element pairs of the city and mountain into city element datasets and mountain element datasets; S6: Analyze the spatial relationship between the city and the mountain based on the city element dataset and the mountain element dataset of the target area; In step S6, the city elements include city walls, city structure, and landmark buildings; The city element dataset includes subsets of city wall elements, city structure elements, and landmark building elements; In step S6: Based on the mountain element dataset and city wall element subset of the target area, the macro-scale spatial relationship between the city and the mountains is analyzed; by recognizing the morphology of mountain elements and city wall elements in each image, the elements are overlaid to form macro-scale spatial relationship information between the city and the mountains. Based on the mountain element dataset and urban establishment element subset of the target area, the mesoscale spatial relationship between the city and the mountains is analyzed. By superimposing the text recognition of government offices, academies, and ancestral temples in each image with the morphological recognition of mountain elements, important buildings including government offices, academies, and ancestral temples, as well as mountains in the front, back, left, and right directions, are labeled to form the mesoscale spatial relationship between important buildings and mountains as the mesoscale spatial relationship between the city and the mountains. Based on the mountain element dataset and landmark building element subset of the target area, the micro-scale spatial relationship between the city and the mountain is analyzed. By recognizing the morphology of landmark building elements and mountain elements, the elements are superimposed to identify the overlapping combination patterns of buildings, pavilions, towers and mountains, and the construction location information of the landscape elements in the mountains is obtained as the micro-scale spatial relationship between the city and the mountain.

2. The method for analyzing city-mountain spatial relationships based on ancient spatial images as described in claim 1, characterized in that: In step S2, after extracting the city and mountain characters from the ancient spatial image, the location information of the city and mountain characters in the corresponding ancient spatial image is located; and the city and mountain characters are bound to their location information in the corresponding ancient spatial image.

3. The method for analyzing city-mountain spatial relationships based on ancient spatial images as described in claim 2, characterized in that: In step S3, after extracting the city and mountain morphology elements from the ancient spatial image, the location information of the city and mountain morphology elements in the corresponding ancient spatial image is located. In step S4, the city mountain morphological element is associated with the city mountain text element corresponding to its position information in the corresponding ancient spatial image to form a city mountain text-morphological element pair.

4. The method for analyzing city-mountain spatial relationships based on ancient spatial images as described in claim 1, characterized in that: In step S302, the shape recognition model is trained through the following steps: S3021: Obtain a city-mountain image sample containing the target shape, annotate the target shape in the city-mountain image sample, and generate an annotated image containing the target shape segmentation mask; S3022: Divide all labeled images into training set, validation set and test set; S3023: Constructing a shape recognition model based on a convolutional neural network; S3024: Input the training set into the shape recognition model, calculate the model loss through forward propagation, and update the model parameters through back propagation until the shape recognition model achieves satisfactory performance on the validation set. S3025: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

5. The method for analyzing city-mountain spatial relationships based on ancient spatial images as described in claim 1, characterized in that: In step S303, the shape segmentation model is trained through the following steps: S3031: Obtain city and mountain image samples containing the target shape, and generate a corresponding segmentation mask for each city and mountain image sample; S3032: Divide all Chengshan image samples and their corresponding segmentation masks into training set, validation set and test set; S3033: Constructing a shape segmentation model based on SegNet; S3034: Input the Chengshan image samples and segmentation mask in batches into the shape segmentation model for training, and update the model weights through the backpropagation algorithm until the shape recognition model achieves satisfactory performance on the validation set. S3035: Evaluate the performance of the shape recognition model using the validation and test sets, and make necessary adjustments.

6. The method for analyzing city-mountain spatial relationships based on ancient spatial images as described in claim 1, characterized in that: In step S5, the city-mountain text-morphology element pairs are classified based on the text names of the city-mountain text elements and the morphological structures of the city-mountain morphological elements, resulting in city element datasets and mountain element datasets.

Citation Information

Patent Citations

  • Rural landscape function area division method and system based on scale self-adaption

    CN114611638A

  • Method for identifying and extracting morphological feature elements of historical and cultural blocks

    CN116740506A