There is a lot involved in that. A LOT but I'm not going to get into designing a whole image inspection system for you. Let's just say that you have an image with one of more cabbages that are completely contained in the field of view. Then you should segment them from the belt and compute the area. It could get a lot more complicated but I'm not going to go into that. Let's just say you ask regionprops() to compute the "EquivDiameter" and take half of it and assume the cabbage is a sphere and use the formula for a sphere V = (4/3)*pi*radius^3. That should be a good estimate for the relative volume. If you need it more accurate than that, then that's where it gets complicated and why machine vision companies will charge tens of thousands of dollars for a turnkey, automated, on-production-line system. You need to be concerned with lighting, triggering the camera and storing the image, automatically analyzing it, saving the results somewhere, etc. You might also need to vary the volume computation based on the orientation of the cabbage (side view or top view or at an angle). It can get very complicated very fast. Since I doubt you've been hired to build such a system and this is probably just a homework problem, I'd start with getting the estimated spehrical volume like I told you..
If you need more help, see my Image Segmentation Tutorial in my File Exchange: