first you need a better image than that. that’s close to a thumbnail, and it’s squashed.
then you need to learn the basics. opencv documentation comes with tutorials.
you will need thresholding and contour extraction. that’ll give you a basis. then you’ll need to do calculations on that contour that correlate to “grading”