The horizontal directional drilling technology combined with the borehole TV imaging technology can be used to obtain most of the geological information in conventional adit exploration. This combination has little impact on the environment and is free from topographic constraints, thus contributing to green exploration. However, conventional algorithms for structural planes fail to accurately extract information on the attitudes of incomplete structural planes in boreholes of any azimuth. Moreover, existing borehole TV devices are mostly cable-based and, thus, difficult to put in place in horizontal drilling. They are prone to get stuck in the collapse section of boreholes, thus damaging the devices. Given these challenges, this study develops an optimization algorithm for structural planes: (1) first, information on multiple points in the 2D unfolded view is fitted using a sinusoidal function curve, three arbitrary points are constructed using the fitted curve, and the normal vector of the plane determined by the three points is calculated; (2) the normal vector in the geodetic coordinate system is obtained after two rotations of the spatial coordinate system based on the theory of transformation of Cartesian coordinate system; (3) finally, the dip angle and dip direction of a structural plane are calculated using the normal vector in the geodetic coordinate system. By making the best use of the information on multiple points in the 2D unfolded view, the optimization algorithm can overcome the defect that is difficult for conventional two-point methods to locate the highest and lowest points of discontinuous structural planes. Therefore, the optimization algorithm applies to calculating the attitudes of structural planes in boreholes of any azimuth. Based on this optimization algorithm, this study successfully develops a cable-free, storage-based TV device for boreholes of any azimuth. This device was employed for laboratory experiments on 20 complete structural planes and 32 incomplete structural planes. As indicated by the experiment results, the optimization algorithm proposed in this study is applicable to many types of structural planes, with a dip direction error of less than 10° and a dip angle error of less than 5°, thus meeting the production requirements.