I’m trying to detect the scenes of two clips:
cap = cv2.VideoCapture(‘first.mp4’, 0)
scene_manager = SceneManager()
scene_manager.add_detector(ContentDetector(threshold=30.0))
cap2 = cv2.VideoCapture(‘second.mp4’, 0)
scene_manager2 = SceneManager()
scene_manager2.add_detector(ContentDetector(threshold=30.0))
if (cap.isOpened()== False):
print(“Error opening video stream or file”)
if (cap2.isOpened()== False):
print(“Error opening video stream or file”)
src_image = scene_manager.detect_scenes(cap)
src_image_example = cv2.cvtColor(src_image, cv2.COLOR_BGR2RGB)
tar_image = scene_manager2.detect_scenes(cap2)
tar_image_example = cv2.cvtColor(tar_image, cv2.COLOR_BGR2RGB)
However, I get the following error:
error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.simd_helpers.hpp:94: error: (-2:Unspecified error) in function ‘cv::impl::{anonymous}::CvtHelper<VScn, VDcn, VDepth, sizePolicy>::CvtHelper(cv::InputArray, cv::OutputArray, int) [with VScn = cv::impl::{anonymous}::Set<1>; VDcn = cv::impl::{anonymous}::Set<3, 4>; VDepth = cv::impl::{anonymous}::Set<0, 2, 5>; cv::impl::{anonymous}::SizePolicy sizePolicy = (cv::impl::::SizePolicy)2u; cv::InputArray = const cv::_InputArray&; cv::OutputArray = const cv::_OutputArray&]’
Unsupported depth of input image:
‘VDepth::contains(depth)’
where
‘depth’ is 6 (CV_64F)
Looking at the tutorial https://pyscenedetect.readthedocs.io/projects/Manual/en/latest/api/scene_manager.html#scenedetect.scene_manager.SceneManager.detect_scenes
I think my issue is that SceneManager.detect_scenes() just returns an int representing how many frames have been processed, but
cv2.cvtColor()
is expecting to be passed an image, or a numpy array.
Is there any way how I can overcome this issue?
Thanks in advance!