You can use the Scale-invariant feature transform (SIFT) to detect the logo in an image. Most of the logo shape is constant, so it's easy to extract features from an image every time.
This algorithm detects corners from the logo. For example Nike’s logo, the two sharp ends would be detected first and then the more dark pixels will be detected. In this way, a logo is detected.
On training, the model keeps remembering corners, on matching stage it finds the nearest neighbors for every feature in the database obtained during training. You will get extracted features in the end.
You can you Random sample consensus (RANSAC) to remove the wrong matches. You can perform transformation, rotation, and translation on the final logo matrix.
Extracting logos from an image can result in a distorted logo image. You can also use Conventional SIFT, which does not consider color information. Logos usually have constant colors, that’s why you might want to consider color information somehow.
Hope this answer helps.