The gray-code kernels (GCK) family, which has Walsh Hadamard transform on sliding windows as a member, is a family of kernels that can perform image analysis efficiently using a fast algorithm, such as the GCK algorithm. The GCK has been successfully used for pattern matching. In this paper, we propose that the G4-GCK algorithm is more efficient than the previous algorithm in computing GCK. The G4-GCK algorithm requires four additions per pixel for three basis vectors independent of transform size and dimension. Based on the G4-GCK algorithm, we then propose the segmented GCK. By segmenting input data into Ls parts, the SegGCK requires only four additions per pixel for 3Ls basis vectors. Experimental results show that the proposed algorithm can significantly accelerate the full-search equivalent pattern matching process and outperforms state-of-the-art methods.