Multiple Videocapture object for a new written single video [closed]
Hi,
How can I write a multiple VideoCapture object as an separating variable like VideoCapture() named cap1 for Video A, cap2 for VideoB and so on.
def make4side(image, scale=0.5):
# image = cv2.imread(image)
h = int((image.shape[0])) #height
w = int((image.shape[1])) #width
image = cv2.resize(image, (w,h ), interpolation = cv2.INTER_CUBIC) #shrink image to half
output = np.zeros((w+h+h , w + h + h, 3), dtype="uint8")
# top
output[0:h, h:h+w] = image
# left >> rotate 90
output[h:h+w, 0:h] = np.rot90(image,1)
# right >> rotate 270
output[h:h+w, h+w:h+w+h] = np.rot90(image,3)
# bottom >> rotate 180
output[h+w:h+w+h, h:h+w] = np.rot90(image,2)
return output
The code above is the function which I am going to apply during the time I read the VideoCapture. For this, its only read just one single file which is image. My question is how can I write a Videocapture object to read multiple videos and named it separately like cap1, cap2 so that I can placed for example cap1 for a top side, cap2 for left side, cap3 for right side and cap4 for bottom side (by changing the image in each of the side to be exact video that I want to place)
Thank you
@reso737 From your question, what I am understood is that, you have 4cameras and you have to take video from 4 cameras. I am right? You want to capture feed parallelly or serially?
It's right that I have 4 cameras and have to take 4 videos. But let assume that I already have 4 video files. I want the processing time to be less so should I capture it by parallel or serial?
capture it parallel using multithreading.
@reso737 follow below blog. Link: https://putuyuwono.wordpress.com/2015... Here you will get code for multi-thread camera capture. I think this will solves your problem.
thank you :) will look in it
Sorry, I tried to read the blog that you gave but I don't seem to understand about the code(which is C)and explaination of it. @ak1
@reso737 You know multi-threading ? Specify which line you are not understanding. Try to check online tutorial on multi-threading. It is C++ not C.
I knew the simple idea of multi-threading. Sorry but I don't get the idea of the link on how to apply to mine, I never write C++ before which made me struggle
@reso737 you want to me to edit his code for you ? I will ask you to again go through the explanation of his blog. This is exactly doing the same, which you are trying to do.
Thank you for helping, I did it without using a multi-threading >> instead use only a videocapture() objects for each of the input video @ak1