Fix the incompatibility of gif saving
When cv2.imwirte() saves ".gif", it will cause _error: (-2:Unspecified error) could not find a writer for the specified extension in function 'cv::imwrite_'_. We add an if statement to check whether the saving file format is ".gif" so as to avoid the error.
This commit is contained in:
parent
cfdefbe1ba
commit
4bde18a1b7
|
@ -176,6 +176,8 @@ def main(args):
|
||||||
draw_img_save = "./inference_results/"
|
draw_img_save = "./inference_results/"
|
||||||
if not os.path.exists(draw_img_save):
|
if not os.path.exists(draw_img_save):
|
||||||
os.makedirs(draw_img_save)
|
os.makedirs(draw_img_save)
|
||||||
|
if flag:
|
||||||
|
image_file = image_file[:-3] + "png"
|
||||||
cv2.imwrite(
|
cv2.imwrite(
|
||||||
os.path.join(draw_img_save, os.path.basename(image_file)),
|
os.path.join(draw_img_save, os.path.basename(image_file)),
|
||||||
draw_img[:, :, ::-1])
|
draw_img[:, :, ::-1])
|
||||||
|
|
Loading…
Reference in New Issue