def gcd(m, n):
fm = []
for i in range(1, m + 1):
if (m % i) == 0:
fm.append(i)
fn = []
for j in range(1, n + 1):
if (n % i) == 0:
fn.append(j)
cf = []
for f in fm:
if f in fn:
cf.append(f)
return (cf[-1]) for i in pick:
if scores[i] > min_threshold:
box = boxes_pixels[i]
box = np.round(box).astype(int)# Draw bounding box.
image = cv2.rectangle(
image, (box[1], box[0]), (box[3], box[2]), (0, 255, 0), 2)
label = "{}:{:.2f}".format(int(classes[i]), scores[i])
print(classes[i], end = ' ')# Draw label(class index and probability).
draw_label(image, (box[1], box[0]), label)
print(box[1])
print(box[1], box[0], box[3], box[2])# im = image.crop((105, 10, 131, 53))
cropped_image = image[10: 53, 105: 131]
else :
continue
for n in range(0, len(onlyfiles)): #Save and display the labeled image.
save_image(image[: ,: , ::-1])
Image(fname, onlyfiles[n])
imshow(image)
def save_image(data, fname = '/home/sunil/image/', swap_channel = True):
if swap_channel:
data = data[..., ::-1]
cv2.imwrite(fname, data)
error Traceback (most recent call last) in 38 for n in range(0, len(onlyfiles)): 39 #Save and display the labeled image. ---> 40 save_image(image[:, :, ::-1]) 41 Image(fname,onlyfiles[n]) 42 imshow(image)
in save_image(data, fname, swap_channel) 2 if swap_channel: 3 data = data[..., ::-1] ----> 4 cv2.imwrite(fname, data)
error: OpenCV(4.1.0) /io/opencv/modules/imgcodecs/src/loadsave.cpp:662: error: (-2:Unspecified error) could not find a writer for the specified extension in function 'imwrite_'