as segmentation is defined as to separate out the regions of the image corresponding to objects in which we are interested, from the regions of the image that correspond to background.
There are many segmentation algorithms which are available the basic being thresholding -->
so in a thresholding algo we set some range of intensity either from the histogram or in general lets say around 150(for 8 bit pixels, gray scale images) so In a single pass, each pixel in the image is compared with this threshold. If the pixel's intensity is higher than the threshold, the pixel is set to white in the output. If it is less than the threshold, it is set to black.
so according to the above the i/p to the verilog module could be a single pixel and output a pixel and here u have the comparator module comparing the pixels with the base value, then u get a o/p which is the required segmented image.
Finally it depends on the algo which u have selected for segmentation. here is a link of a seg alg and its source code Image Segmentation
pls check it