Skip to content

predict image width video #1

@xcbtrader

Description

@xcbtrader

Hello.
I test your script and work fine.

I want to do the same with videos, but the only way I can do it is by recording the image on disk and then reading it.
How can I use the frame image directly without burning it to disk?

I give an example of my program.

#!/usr/bin/env python

-- coding: utf-8 --

from keras.models import load_model

MODEL_PATH = 'model.hdf5'

classifier = load_model(MODEL_PATH)

from keras.preprocessing import image
import cv2
import os
import numpy as np
import PIL.Image as Image

IMAGE_LENGTH = 192

Read the video from specified path

n_video = input('Video Name:? ')
cam = cv2.VideoCapture(n_video)
info_video = n_video.split('.')

try:

# creating a folder named data 
if not os.path.exists( info_video[0]): 
	os.makedirs( info_video[0]) 

if not created then raise error

except OSError:
print ('Error: Creating directory of data')

frame

currentframe = 0
salto_frames = 30
frames_analizados = 0
labels = ['nsfw', 'sfw']

while(True):

# reading from frame 
ret,frame = cam.read() 

if ret:

I need to use frame in the predict process.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions