## 2 Related Works  
Recently, a significant increase in the use of artificial intelligence methods for path planning has been observed [2]. This is related to current technological development. An example of such methods can be artificial neural network-based methods such as deep reinforcement learning [3; 4; 5; 6; 7]. Popular path planning methods also include those based on animal behaviour and evolution, such as ant colony (ACO) [8], particle swarm optimisation (PSO) [9; 10], and genetic algorithms (GAs) [11; 12], which are still being modified to increase their effectiveness. Another group of intelligent path planning methods includes heuristic methods. The most popular example of such a method is the A* algorithm. It allows for finding the shortest path to a destination in the presence of static obstacles, assuming that both the environment and the location of the obstacles are known. For this purpose, a heuristic function is used to calculate the path cost, assuming passing through individual map cells. In this method, an increased amount of computation is needed for large areas of analysis or areas with many obstacles. This significantly increases the path planning time. The efficiency of the A* method can be improved by combining it with other efficient algorithms, such as GA for pre-determining the effective path [13], or in combination with the visibility graph-based space representation [14] instead of occupancy grid representation, which significantly reduces the number of nodes to search and substantially speeds up the algorithm. Since the visibility graph connects obstacles' vertices that can see each other, the path determined based on these vertices will be near-optimal in terms of the path length. On the other hand, the successive waypoints border on an obstacle. From a practical point of view, calculating a path based on a visibility graph for AUVs/ASVs is very risky due to the error of navigation positioning systems and the possible occurrence of sea currents or unfavourable weather conditions. The proposed method utilises occupancy grid representation. Mathematical morphology-based processing allows for the regulation of the safety zone around an obstacle and the closure of very narrow passages or trap obstacles. It determines a path that will be more practical and feasible for AUVs/ASVs to use than the one calculated based on the visibility graph. Additionally, a visibility graph is hard to implement in 3D space due to the difficulties in representing and parameterising lines in 3D space and the loss of separability [15; 16; 17]. In the case of space representation as an occupancy grid, this problem does not occur, and the cells are clearly described. For this reason, implementing map processing using mathematical morphology, e.g., a cube-shaped structural element, is a relatively straightforward process. Therefore, the map preprocessing approach presented in this article could increase the relative gain in path planning efficiency. The disadvantage of the proposed approach compared to the visibility graph is the loss of information about the exact shape of obstacles, which in some situations may result in difficult access to cells located very close to obstacles. Excessive resolution reduction may cause significant map distortions, making it impossible to determine the path or leading to an excessive increase in the path length (depending on the set mathematical morphology parameters). Additionally, in the case of places where the target point is located inside an almost closed obstacle, it may result in fully closing the obstacle and making it impossible to determine the path. For this reason, the algorithm is unsuitable for calculating paths, e.g., in narrow mazes. However, the algorithm's main purpose is to compute a path based on maps representing a large area of the real environment.