A method for compensating image segmentation lines, suitable for an electronic apparatus with a processor, the method comprising: segmenting a captured medical image by adopting a segmentation model to obtain a segmentation image comprising at least one segmentation line between a plurality of layers in the medical image; performing a convolution operation on the segmentation image by adopting a kernel (60, 60a) of a trained classification model to predict a position of a next pixel connected to a current pixel of the respective segmentation line in the segmentation image, wherein the predicted pixel is a neighboring pixel of the current pixel in a prediction direction, wherein the segmentation image is adopted as an input image of the trained classification model, the convolution operation is performed on the segmentation image using the kernel (60, 60a) to obtain values of a plurality of convolution layers of the classification model, and the values are input to a fully connected layer of the classification model to obtain an output image, wherein a plurality of weights of each of the kernel and a plurality of nodes in the convolution layers and the fully connected layer are obtained by training the classification model using a plurality of training input images and a plurality of training output images; and connecting a plurality of predicted pixels to form a compensated segmentation line for the respective segmentation line, thereby outputting a complete segmentation line whose gap section has been repaired; characterised in that the method further comprises: detecting a gap section in the respective segmentation line; and determining a kernel size of the classification model based on a size of the gap section comprising calculating a distance between two endpoint pixels of the detected gap section in the prediction direction of the kernel (60, 60a), and setting a length of the kernel (60, 60a) in the prediction direction accordingly, so that the length is greater than the distance. segmenting a captured medical image by adopting a segmentation model to obtain a segmentation image comprising at least one segmentation line between a plurality of layers in the medical image; performing a convolution operation on the segmentation image by adopting a kernel (60, 60a) of a trained classification model to predict a position of a next pixel connected to a current pixel of the respective segmentation line in the segmentation image, wherein the predicted pixel is a neighboring pixel of the current pixel in a prediction direction, wherein the segmentation image is adopted as an input image of the trained classification model, the convolution operation is performed on the segmentation image using the kernel (60, 60a) to obtain values of a plurality of convolution layers of the classification model, and the values are input to a fully connected layer of the classification model to obtain an output image, wherein a plurality of weights of each of the kernel and a plurality of nodes in the convolution layers and the fully connected layer are obtained by training the classification model using a plurality of training input images and a plurality of training output images; and connecting a plurality of predicted pixels to form a compensated segmentation line for the respective segmentation line, thereby outputting a complete segmentation line whose gap section has been repaired; characterised in that the method further comprises: detecting a gap section in the respective segmentation line; and determining a kernel size of the classification model based on a size of the gap section comprising calculating a distance between two endpoint pixels of the detected gap section in the prediction direction of the kernel (60, 60a), and setting a length of the kernel (60, 60a) in the prediction direction accordingly, so that the length is greater than the distance. detecting a gap section in the respective segmentation line; and determining a kernel size of the classification model based on a size of the gap section comprising calculating a distance between two endpoint pixels of the detected gap section in the prediction direction of the kernel (60, 60a), and setting a length of the kernel (60, 60a) in the prediction direction accordingly, so that the length is greater than the distance.