Can't open file: './config/PixelBasedAdaptiveSegmenter.xml' in write mode

Viewed 22

I am testing different background segmentation algorithm from the library pybgs. Unfortunately, I am facing an error that I don't understand.

The code is :

import cv2
import pybgs as bgs


video_path = "video.mp4"

# create VideoCapture object for further video processing
captured_video = cv2.VideoCapture(video_path)
# check video capture status
if not captured_video.isOpened:
    print("Unable to open: " + video_path)
    exit(0)

background_sub_method = bgs.SuBSENSE()

while True:
    # read video frames
    ret, frame = captured_video.read()
    # check whether the frames have been grabbed
    if not ret:
        break

    # pass the frame to the background subtractor
    foreground_mask = background_sub_method.apply(frame)
    # obtain the background without foreground mask
    img_bg_model = background_sub_method.getBackgroundModel()

    cv2.imshow("Initial Frame", frame)
    cv2.imshow("FG Mask", foreground_mask)
    cv2.imshow("Subtraction Result", img_bg_model)

    key = cv2.waitKey(10)
    if key == 27:
        break

Except that the algorithm don't work properly, I get this error that I don't understand.

[ERROR:0@0.002] global /home/usr/opencv-4.x/modules/core/src/persistence.cpp (505) open Can't open file: './config/SuBSense.xml' in write mode Failed to open ./config/SuBSense.xml

In my lib pybgs, I have a config folder but there is no SuBSense.xml file. So I don't know where this error is from, where this SuBSense.xml file is suppose to be.

0 Answers
Related