OpenCV with watson studio - python-3.x

I am trying to use watson studio for detecting images taken from webcam. I use opencv to capture the video first and then read it frame by frame. Following is small part of the code to checck if video is getting captured.
import cv2
cap = cv2.VideoCapture(0)
cap.isOpened()
This code returns True when I use it with python 2.7 locally but this does not work at all and returns False when I use it in the notebook for watson studio. I am not able to understand why this is happening

I think this is not possible.
Given, cv2 would try to open/locate camera at the runtime attached to notebook and
not the user's camera who is browsing the notebook/url.
The cv2 running in runtimes have no way to talk to user's browser/camera.
Now when i say runtime, it can be spark service or Environment attached to the notebook.
I would suggest to capture images and then upload to COS to do further processing of those images using cv2 if thats the usecase.
Thanks,
Charles.

Related

Can you link a Python script to Android Studio?

My aim is to create a recommendation app for Android which communicates with a script from a server to perform the Machine Learning parts and to generate recommendations for the current user. My original idea was to use Tensorflow but I am wondering if I could also write a Python script which can be called as a REST API? Would the data be best passed in JSON format?
You can create a Python Flask API and sent a POST Request to it. From that, you can use the data passed to run your ML parts on that data. However, you will need to find a way to run those ML parts after you pass your data to your Flask API. To get started, I would watch a youtube tutorial on how to make and use a Flask API. It is not terribly difficult to get up and started.

Building Python OCR using machine learning

There are a ton of questions dealing with OCR and Machine Learning, I am looking for guidance building my own from scratch.
I have an obscene number of photographs that contain text pertaining to the feature in the photo. The text is the latitude, longitude and id of the feature. I am looking for a way to extract this information into a text file to feed into my GIS.
I am sure Tesseract and Pytesseract would do exactly what I want, I however have a blocker in that I cannot load additional software onto the PC I am working on.
My PC is connected to a strictly controlled and secure network. I cannot install new software. I can however “pip install” any Python libraries needed, using a mobile hotspot. I have installed the Pytesseract library in Python. However if I have understood there is a dependency requiring a windows install file to be downloaded and installed before this works.
So I have decided to try (as a side project) create my own OCR model using Python and whatever libraries I need. The only issue is, there is a ton of information online and trying to find a focused and easy to follow process is not easy.
I am looking for resources detailing step by step what I need to do to create a training dataset, train a model and feed the images into the train model to get an output that makes sense.
I have been using OpenCv to process an image (crop, filter etc) to get bounding boxes of all the identifiable text in the test image. I am not sure where to go from there.
Are there any recommended tutorials online / resources that might make sense to a complete novice? I am using Python 3.5.

upload file video on youtube using a python programm

I m working on a little project and I need a way to upload video on youtube using python programm, I searched on github and I find a programm that do this but it is in python2 and I need one in python3 also it is very difficult to manipulate. So does someone knows some programms thats upload video on youtube and it is written in python3
You didn't mention the program that you had found, so I searched github.
The first hit is https://github.com/tokland/youtube-upload, and according to the readme, this is compatible with Python 3.x. You will need the google api python client too, and of course you will need an api key to use with it, but these are available.
An alternative is shoogle https://github.com/tokland/shoogle, which only supports python 3.x

Is there a YouTube library for Python 3?

I want to build a Python app to automate some YouTube tasks, so I went to grab their files at https://developers.google.com/api-client-library/python/ and to my surprise, it's a Python 2 library.
I was looking around to see if there was an updated version hidden somewhere, but I wasn't able to find one, and I guess I'd rather ask here than waste more time following random links on YouTube.
Is there an official Python 3 library for YouTube?
If not, what are my options for building a Python 3 application which can retrieve YouTube video data?
The one you mentioned is sole official Python client library and I don't think there's official Python3 version of it.
But if you don't need whole wrapper of all YouTube APIs, it's more straight forward to call API directly using standard http.client module or 3rd party requests module.
Indeed there is pytube for Python3.
Example Download of a video:
from pytube import YouTube
# creating YouTube object
yt = YouTube("https://www.youtube.com/watch?v=1csFTDXXULY")
# accessing video stream of YouTube obj.(first one, more available)
stream = yt.streams.first()
# download into working directory
stream.download()

Play videos automatically in Raspberry Pi Qt

I want to play videos on Raspberry Pi which built Qt as well. thing is i have try out a example on github link but it seems to be not working for me. I want to play videos using omx player automatically once i have uploaded a xml config file
any clue
If you want to use omxplayer, then you should checkout it here: https://github.com/popcornmix/omxplayer. I see from the code it can be controlled using a pipe.
EDIT: omxplayer also has a dbus interface.

Resources