Q:

python multiprocessing and opencv VideoCapture read() error

I have problem with python multiprocessing.
I want used multiprocessing with opencv 
Here My source Code
--- main.py
if use_webcam:
    print("[INFO] Using Webcam")
    reader = cv2.VideoCapture(0)
    ret, frame = reader.read()
    if ret:
        img_height, img_width, C = frame.shape
    else:
        img_height = 360
        img_width = 640
    fps = 1000 // DELAY
else:
    reader = cv2.VideoCapture(video_path)
    fps = reader.get(cv2.CAP_PROP_FPS)
shape = [T, img_height, img_width, 3]

frame_q = Queue()
frame_reader = Process(target=read_frames, args=(reader,frame_q,use_webcam)

--- def read_frames()
def read_frames(reader, frame_q, use_webcam, shape):
    allframes = int(reader.get(cv2.CAP_PROP_FRAME_COUNT))
    resize_height = shape[1]
    resize_width = shape[2]

    for ii in range(allframes):
        if reader.isOpened():
            print("[INFO] reader is opended")
            # while frame_q.qsize() > 500:
            #     time.sleep(1)
            ret, frame = reader.read()
            print("[INFO] ret : ", ret)
            resize_img = cv2.resize(frame, dsize=(resize_width, resize_height), interpolation=cv2.INTER_LINEAR)
            cur_img = resize_img[:, :, ::-1]
            frame_q.put(cur_img)            

I try to my run source code
but reader.read() is not working when I run it.
It does not show any errors and Nothing to result.
And frame_q.qsize() is 0.
I need help.
If multiprocessing and opencv are not compatible, how should I handle them?
----------------------- EDIT
This problem used imageio library.
It is worked to MY Code
but i wondering this problem.
Why stop at 'read()' when used together? 

A:

In my opinion, don't object sharing between main process and sub process is possible.
so the object must be declared separately.
main.py
if use_webcam:
        print("[INFO] Using Webcam")
        reader = cv2.VideoCapture(0)
        ret, frame = reader.read()
        if ret:
            img_height, img_width, C = frame.shape
        else:
            img_height = 360
            img_width = 640
        fps = 1000 // DELAY
    else:
        reader = cv2.VideoCapture(video_path)
        fps = reader.get(cv2.CAP_PROP_FPS)
    shape = [T, img_height, img_width, 3]

    frame_q = Queue()
    frame_reader = Process(target=read_frames, args=(reader,frame_q,use_webcam)

def read_frames()
def read_frames(video_path, frame_q, use_webcam, shape):
    allframes = int(reader.get(cv2.CAP_PROP_FRAME_COUNT))
    resize_height = shape[1]
    resize_width = shape[2]
    cap = cv2.VideoCapture(video_path)

    for ii in range(allframes):
        if reader.isOpened():
            print("[INFO] reader is opended")
            # while frame_q.qsize() > 500:
            #     time.sleep(1)
            ret, frame = cap.read()
            print("[INFO] ret : ", ret)
            resize_img = cv2.resize(frame, dsize=(resize_width, resize_height), interpolation=cv2.INTER_LINEAR)
            cur_img = resize_img[:, :, ::-1]
            frame_q.put(cur_img)  

