Mixture of OpenCV version?
I'm confused about the following code in crop_plates.py at https://github.com/openalpr/train-det...:
import os
import sys
import json
import math
import cv, cv2
...
moment = cv.Moments(points)
...
cv2.randu(crop_img, (0,0,0), (255,255,255))
It seems to use different version of OpenCV. But I have problems to install different OpenCV at the same time so that I change the code to only use cv2. Here comes a new question. There is no Moments function at cv2, or at least the function is different. Here is my code:
points = [(x1,y1), (x2,y2), (x3,y3), (x4,y4)]
# moment = cv.Moments(points)
moment = cv2.moments(points)
centerx = int(round(moment.m10/moment.m00))
centery = int(round(moment.m01/moment.m00))
But I got the following error message:
moment = cv2.moments(points)
TypeError: array is not a numpy array, neither a scalar
Any idea?
My code:
Solved the problem.