Instead of opencv_createsamples (OpenCV 4.0 and later) on Windows? - python

I want to train my own Haar cascade to recognise my phone in images.
I have a large number of negative/background images and an image of my phone. I wanted to use opencv_createsamples() to generate a large number of positive images, using the negative/background images and the image of my phone.
However according to How to build opencv correctly in windows to get "opencv_createsamples.exe", opencv_createsamples() has been disabled.
Is there another module I could use, or should I install an older version of OpenCV? I'm on Python (3.7.4) and Windows (10).
I've checked out https://docs.opencv.org/2.4/doc/tutorials/introduction/windows_install/windows_install.html but they say the tutorials may be obsolete. Could someone recommend an up to date source of information?
I really want to learn how do this in Windows, not using a Linux server.

Related

Informations about adding image to a video

I'm trying to add an image to a pre-existing video in python. I haven't write any code yet, but I've done some research. Most of people seem to use OpenCV or ffmpeg to manipulate image and video.
So my questions are :
Can we add images to video with OpenCV or ffmpeg?
Can we do that without OpenCV or ffmpeg
If yes, do you have some informations on it
If no, should I use OpenCV or ffmpeg ? Maybe another ?
Which version of OpenCV should I use ? and why ?
I've read that they are a problem with OpenCV and Ubuntu, did they correct it ?
If you have some other informations or advice for me
In OpenCV you could extract all the frames from the video and then use the VideoWriter class to create a new video from the frames plus your extra images. One issue I’ve had in the past using VideoWriter is using the correct video codec, you will have to do some research on this and see what’s compatible with your particular setup.
https://docs.opencv.org/3.2.0/dd/d9e/classcv_1_1VideoWriter.html
You may be able to do something similar with PIL (Python Imaging Library) although I’m not entirely sure on that. As for ffmpeg I’m also not sure.
The latest release of OpenCV would be sufficient for this. I currently have OpenCV 3.4 with Ubuntu 16.04 LTS on a Virtual Machine and I have no problems using the VideoWriter class. Have a look at this blog post for advice on installing OpenCV on Ubuntu.
https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/

Is it possible to install pymedia on recent Ubuntu builds?

I have all the dependencies for pymedia, but they are all "not found" by the installation script. I see that pymedia is no longer in active development, but just want to see if anyone has been able to install it on Ubuntu 14.04, on a 64-bit machine. I require it for a function in pyschopy.
Given that pymedia hasn't been touched for 9 years I think you'll be struggling to build it. Is the aim to build a movie from some frames? I'd suggest outputting them from PsychoPy as png images and then combining them with ffmpeg.
I intend in the future to add support back in to output movie files directly using pymovie to combine the frames (which uses ffmpeg in the background), but this isn't on the top of the priorities list! ;-)

How to detect license plate in an image with Python and without cvblob?

I want to detect the presence of a license plate in an image, using Python code.
I got multiple suggestions to use the package cvblob, but I am unable to install cvblob on my Ubuntu system.
What is the best approach to this problem that does not require cvblob?
You may use SimpleCV, it is a wrapper on opencv-python alongwith OCR support which may help you read the license plate text, if its clearly visible. In my experience, it is the most beginner-friendly.

How to Scale images in Django

Background:
I have to upload images from users.
Problem:
The images need to be re-sized so that I don't end up with huge images on my disk. This re-sizing should happen just after the image is saved.
I have checked the following code
Django Snippet for image scaling
But couldn't use it directly, as the windows path of the image was giving a issue. Is there a simple way in which the scaling can be done. Are there any python or django modules which can directly be used for this ?
If yes which will be the most optimized one ?
Make use of the Python PIL library. With this library you can manipulate images and make the changes you require. There are loads of examples of using PIL over the net.
I would recommend you using the PIL library and writing your own code as it can be a lot easier than trying to get third party libraries working (personal experience).

Prosilica GigE camera with OpenCV/python

I'm using a GigE (ethernet) prosilica GC camera on Mac OS X, and have been able to read it out through the proprietary sample viewing software from Allied Vision.
I would like to be able to read out the camera using OpenCV. I have opencv installed correctly, but I am not sure how to read out the camera. The last person to ask this question (~2 years ago) was told to use the native camera API to do this, and then analyze the images with opencv:
OpenCV with GigE Vision Cameras
However, I would like to know if it is even possible to do this with python/ opencv. There seems to be very little information online about how to do this, so I'm curious if anyone managed to get it to work, and could post some example code/etc. I have all my camera IP address information, model, etc, if that helps, but I don't know how to even tell opencv where to look.
Thanks in advance,
Mike
I believe OpenCV interfaces to the Prosilica cameras via the PvAPI. You'll need to make sure OpenCV is compiled with this setting using the WITH_PVAPI CMake option (you will need to build from source). cap_pvapi.cpp is the wrapper for the PvAPI driver that will allow you to use the VideoCapture class.
To build OpenCV from source, take a look at the tutorials here.
Try Pymba
You can use Allied Vision's new SDK Vimba and a python interface called Pymba. Instructions are on the Pymba github page but basically you
Install Vimba
Install Pymba via pip install pymba
There's example code in the repo. I've been using it and it's pretty straight forward.

Categories

Resources