import cv2
import os, sys
import numpy as np
v_cap = cv2.VideoCapture(sys.argv[1])
v_len = int(v_cap.get(cv2.CAP_PROP_FRAME_COUNT))
for i in range(v_len):
ret, frame = v_cap.read()
th = cv2.inRange(frame, (9, 13, 104), (98, 143, 255))
points = np.where(th>0)
p2 = zip(points[0], points[1])
p2 = [p for p in p2]
rect = cv2.boundingRect(np.float32(p2))
cv2.rectangle(th, (rect[1], rect[0]), (rect[1]+rect[3], rect[0]+rect[2]), 255)
cv2.imshow("t", th)
cv2.waitKey(10)
I dont think this is quite capturing the region around the segmented area. Don’t we need to do some kind of blob analysis like in the Matlab version?
No need for blob analysis. Actually i later discovered that with changing the 9 to 0 you get very good solid line. You can now use findcontours.
Were you able to process all images using that thresholding function? Are you sure that it crops the required region? It will be helpful if you can please upload the updated code snippet.
Yes, even with this i got perfect cropping. Did you try it? If you find anything not cropped properly, let me know.
I was able to write my own cropping function. Did you ever check the performance of the models without cropping i.e using the full image?
Yes. It didn’t do very well, which makes sense, although ymmv… It depends probably on the model, etc
Hello. I just jumped in the competition. I studied machin learning, but i.am.new to the industry. So I am trying to gain real world experience here.
DK