Identify head and tail of the fish

I just started learning about python and opencv. I want to measure fish length by picture. The first is to identify the head and tail of the fish which is a bit difficult for me. How should i solve it. Thanks for the help.This is the picture i used to measure

different tasks:


  • intrinsic camera calibration (projection matrix, lens distortion)
  • extrinsic calibration (camera–surface pose): put a checkerboard or ARUCO/CHARUCO in frame

assuming the fish is flat and on the surface, now you can get physical lengths from the picture.


use a different color for the background. the fish itself appears white in parts. use a color that will certainly not appear on the fish.

threshold to get a mask.