This Thursday is Thanksgiving in the United States, arguably the most celebrated holiday of the year for American citizens.
And let me tell you, I’ve got a lot to be thankful for this year:
- Not only will I be celebrating Thanksgiving with my parents’ family, but we’ll also be joined by my fiancĂ©e’s family as well.
- Given that both families will be together the parents have decided to turn Thanksgiving into a joint engagement party for myself and my girlfriend of 7.5 years. This will be quite the celebration! I’m very lucky to be part of two amazing families.
- Lastly, I want to say that I am so incredibly thankful to you, the PyImageSearch reader, for being supportive of myself and the blog the past couple of years. Without you, this blog would not be possible. It doesn’t have to be Thanksgiving for me to recognize this — I literally feel this lucky every day I get up in the morning and start working.
As I sat down to write today’s blog post I clearly had the spirit of Thanksgiving in mind.
And you certainly can’t have Thanksgiving without Thanksgiving dinner.
A traditional American feast consists of roasted turkey, mashed potatoes, stuffing, yams, and of course…pumpkin pie.
But I’d like to talk to you about a different type of Pi today:
Raspberry Pi.
Today’s blog post covers three MASSIVE updates related to the Raspberry Pi and the PyImageSearch blog:
- To start, I have released my own personal Raspbian .img file with OpenCV pre-configured and pre-installed as part of Practical Python and OpenCV. This is the exact Raspbian image I use for my own projects. Simply download the .img file, flash it to your SD card, and enjoy OpenCV + Python pre-baked on your Pi. That’s right. No long compile times. No confusing error messages. No problems installing. Just download, boot, and start using OpenCV immediately.
- I am doing a Black Friday sale that will go LIVE on Thursday, November 24th at noon EST. This sale will include 25% OFF my book, Practical Python and OpenCV.
- To make this deal even sweeter, the first 15 readers who purchase the Hardcopy Bundle will also receive a hand-signed copy of my book + a FREE Raspberry Pi 3 pre-loaded with OpenCV.
As proof, take a look at this photo I took earlier today before writing this blog post:
That’s a lot of Pi. And my hope is that you’ll take advantage of this awesome deal and be among the first 15 readers to purchase a copy of Practical Python and OpenCV during the Black Friday 25% OFF discount.
You see, ever since I wrote the first PyImageSearch tutorial on installing OpenCV + Python on the Raspberry Pi B+ back in February 2015 it has been my dream to offer a downloadable, pre-configured Raspbian .img file with OpenCV pre-installed.
Today this dream has become a reality.
I am pleased to announce that both the Quickstart Bundle and Hardcopy Bundle of Practical Python and OpenCV now ship with a downloadable Raspbian .img file that comes with OpenCV pre-configured and pre-installed.
This .img file is also tiny, weighing in at only 1.7GB — that’s approximately the same size as the official Raspbian release!
All you have to do is download the .img file, flash it to your SD card, and boot your Pi.
From there, you’ll have a complete Python + OpenCV development environment at your fingertips, all without the hassle of configuring, compiling, and installing OpenCV.
To learn more about the Raspbian .img file and the Black Friday 25% OFF discount, keep reading.
Raspbian + OpenCV out-of-the-box
I went back to my recent tutorials on installing OpenCV on the Raspberry Pi and computed the amount of time it takes to perform each step.
You know what I found?
Even if you know exactly what you are doing it can take over 2.2 hours to compile and install OpenCV on your Raspberry Pi.
I then emailed a sample of novice readers who successfully installed OpenCV on their Pi and asked how long it took them to complete the compile and installation process.
Perhaps not surprisingly I found the amount of time for novice readers to install OpenCV on their Raspberry Pi jumped nearly 4x to over 8.7 hours.
Clearly, the barrier to entry for many PyImageSearch readers trying to learn OpenCV and computer vision is getting OpenCV itself installed on their Raspberry Pi.
In an effort to help these readers get the most out of their Raspberry Pi, I have decided to release my own personal Raspbian .img file that has OpenCV pre-configured and pre-installed.
By bundling the pre-configured Raspbian .img together with Practical Python and OpenCV my goal is to:
- Jumpstart your computer vision education by skipping the tedious process of installing OpenCV + Python on your Raspberry Pi.
- Provide you with my book, Practical Python and OpenCV, the best introduction to the world of computer vision and image processing that you can possibly get.
Of course, I will continue to create, support, and provide help to any PyImageSearch reader who is using the many free tutorials I offer on installing OpenCV + Python on the Raspberry Pi.
Again, this pre-configured Raspbian .img is intended for PyImageSearch readers who want to save time and jumpstart their computer vision education.
If this doesn’t sound like you, no worries, I totally understand — I’ll be still be providing free tutorials to help you get OpenCV up and running on your Raspberry Pi.
Thanksgiving and Black Friday sale — 25% OFF Practical Python and OpenCV
Two years ago when PyImageSearch was in its infancy, I decided to do a Black Friday sale for Practical Python and OpenCV.
To be completely honest with you, I had no idea how the Black Friday discount was going to go over — I had never offered one before!
But when I opened my Gmail inbox the morning after announcing the sale I was in for a huge surprise.
You see, my inbox was filled with emails from PyImageSearch readers just like yourself who were so happy that I offered a Black Friday deal.
During that Black Friday weekend over 100+ PyImageSearch readers got their hands on a copy if Practical Python and OpenCV at the discounted Black Friday price.
These readers were able to jumpstart their computer vision + OpenCV education before Thanksgiving weekend was even over!
This year I’m pleased to announce that I will be carrying on the Black Friday discount tradition and offer the same 25% OFF deal — and I’m hoping that you’ll join me in jumpstarting your computer vision education.
Starting Thursday, November 24th at noon EST I’ll be launching the 25% OFF Black Friday deal.
Be sure to keep an eye on your inbox for the launch email.
If you’re not already on the PyImageSearch Newsletter, be sure to join here.
And if the discount weren’t enough, I’ve decided to sweeten the deal even more and really turn this into the “Thanksgiving of Pi”…
FREE Raspberry Pi 3’s to the first 15 customers
Like I said, this Thanksgiving is all about the Raspberry Pi.
So, not only will I be offering Practical Python and OpenCV at 25% OFF…but the first 15 customers who purchase the Hardcopy Bundle will also receive:
- A FREE Raspberry Pi 3 with my Raspbian .img file pre-loaded on a micro-SD card. Simply plug the Pi in and start learning computer vision.
- A hand-signed edition of Practical Python and OpenCV.
It’s hard to beat a deal like this, but keep in mind that the Pi 3 + hand-signed edition will only be available on a first come, first serve basis and they WILL sell out quickly.
How quickly you ask?
I went back and ran the numbers from last year’s Black Friday sale when I offered just hand-signed editions of Practical Python and OpenCV…
…all 15 were sold out in exactly 17 minutes.
Now that I’m offering a Raspberry Pi 3 + a hand-signed edition of my book along with the Hardcopy Bundle I’m willing to bet these first 15 orders come in within 5 minutes.
The point is this:
If you’re serious about getting a FREE Raspberry Pi 3 + pre-configured Raspbian .img file with your order of the Hardcopy Bundle, you’ll need to act FAST!
To be amongst the first 15 Hardcopy Bundle orders I would suggest you:
- Set an alarm on your phone/desktop for Thursday, November 24th at noon EST (you can use the following link to convert the date and time to your timezone. Just use the “Add Another City” field to add your country/timezone).
- Start refreshing your inbox for the announcement email as soon as the alarm goes off.
- Keep refreshing the Practical Python and OpenCV page as well just in case there is a delay with your email provider delivering the announcement email to your inbox.
Remember, these first 15 copies are going to go quick, so don’t miss out!
Raspbian + OpenCV pre-configured and pre-installed
The rest of this document describes how to install and use the Raspbian pre-configured .img file included in your purchase of the Quickstart Bundle or Hardcopy Bundle of Practical Python and OpenCV.
Note: The pre-configured Raspbian + OpenCV .img file is not included in the Basic Bundle.
At the end of this guide you’ll also find answers to frequently asked questions regarding the Raspbian + OpenCV .img file. If you have a question that is not covered in FAQ, please send me a message.
Download and unpack the archive
After downloading your Quickstart Bundle or Hardcopy Bundle unzip the
Raspbian.zipfile using your favorite unarchiving utility:
After unzipping you should see the .img file similar to the screenshot above.
Write image to SD card
This Raspbian .img will work on 8GB, 16GB, and 32GB SD cards. I have not tested cards larger than 32GB at this time as I do not currently own a card that large. A 4GB card is too small.
To write the pre-configured Raspbian .img to your card simply follow the official Raspberry Pi documentation. I have provided quick links below:
Booting your Pi for the first time
After writing the the Raspbian .img to your card, insert the card into your Pi and boot it up. On the first boot your Raspbian filesystem will be auto-expanded to utilize the entire disk.
This means that you do not have to run
raspi-config => Expand Filesystemmanually.
After the auto-expansion has completed your Pi will reboot and you will be able to use it as normal (the auto-expansion of the filesystem is only performed on the first boot).
Here is a screenshot of the disk utilization on my Pi after it has been auto-expanded:
Notice that my entire 16GB card is being utilized.
Using Python and OpenCV on your Raspberry Pi
In order to get OpenCV 3 installed with both Python 2.7 and Python 3 bindings I leveraged Python virtual environments. Each Python virtual environment is totally independent from one another ensuring there are no dependency or versioning issues.
In the remainder of this section I explain (1) what Python virtual environments are and (2) how to access the OpenCV + Python 2.7/Python 3 bindings.
What are Python virtual environments?
At the very core, Python virtual environments allow us to create isolated, independent environments for each of our Python projects. This implies that each project can have its own set of dependencies, regardless of which dependencies another project has.
In the context of OpenCV, this allows us to have one virtual environment for Python 2.7 and then another virtual environment for Python 3. Furthermore, each of these virtual environments can be cloned and have their own set of dependencies for a given project.
For a detailed look at Python virtual environments please refer to this tutorial.
Accessing the Python 2.7 + OpenCV 3 environment
To access the Python 2.7 + OpenCV 3 virtual environment you need to run two commands:
$ source ~/.profile $ workon py2cv3
The
source ~/.profilecommand loads any
PATHconfigurations from your
~/.profilefile. The
workon py2cv3accesses the Python 2.7 + OpenCV 3 virtual environment.
Conveniently, when you boot up your Pi you’ll notice that I have included a single script that you can use to setup your development environment in your home directory:
$ source start_py2cv3.sh
This command will execute both the
sourceand
workoncommands for you. After executing it your shell will look like this:
Notice how the text
(py2cv3)appears before your shell. This implies that you are in the
py2cv3virtual environment. This command only needs to be executed once for each shell that you open up.
Accessing the Python 3 + OpenCV 3 environment
Similar to the section above, the Python 3 + OpenCV 3 environment can also be accessed using the
sourceand
workoncommands:
$ source ~/.profile $ workon py3cv3
You can also just use the following command located in your home directory:
$ source start_py3cv3.sh
This command only needs to be executed once for each shell you open up. After executing it you’ll notice that the text
(py3cv3)now appears before the prompt indicating that you have access to Python 3 + OpenCV 3:
Executing code from Practical Python and OpenCV on your Raspberry Pi
There are multiple methods to access the Practical Python and OpenCV source code on your Pi. The first is to use Chromium, Raspbian’s built-in web browser to download the .zip archive(s):
You may also use your favorite SFTP/FTP client and transfer the code from your system to your Pi:
Or you may want to manually write the code on the Pi using the built-in text editor as you follow along with the book:
I would suggest either downloading the Practical Python and OpenCV source code via web browser or using SFTP/FTP as this also includes the datasets utilized in the book as well. However, manually coding along is a great way to learn and I highly recommend it!
X11 forwarding with your Raspberry Pi
If you know how to use SSH then you can utilize X11 forwarding to access your Raspberry Pi. Simply provide the
-Xswitch when SSH’ing into your Pi, like this:
$ ssh -X pi@your_ip_address
You will then be able to execute Python examples that utilize
cv2.imshowand see the results on your laptop/desktop screen.
However, your X11 session will timeout/close so if you see the following error message:
WARNING **: Could not open X display Unable to init server: Could not connect: Connection refused Gtk-WARNING **: cannot open display: localhost:10.0
Then simply close your SSH connection and re-connect.
Note: Mac users may first need to install XQuartz to utilize X11 forwarding. Windows users should check their respective SSH client documentation for instructions on how to use X11 forwarding.
Frequently Asked Questions (FAQ)
In this section I detail the answers to frequently asked questions regarding the Raspberry Pi .img file.
Will this Raspbian image work with my Raspberry Pi 2 and/or Raspberry Pi 3?
Yes, this pre-configured Raspbian image is compatible with both the Raspberry Pi 2 and Raspberry Pi 3 out-of-the-box. This allows you to save potentially 8+ hours of compile and install time and get started learning OpenCV on your Raspberry Pi immediately.
What if I want to install OpenCV + Python on my Raspberry Pi by myself?
By all means, I encourage you to do so. It’s a great exercise and you’ll learn a lot about the Linux environment. I would suggest you follow one of my many free tutorials on installing OpenCV + Python your Raspberry Pi.
Again, this pre-configured Raspbian image is intended for readers who want to skip the install process and jumpstart their education.
How long will it take to install Python + OpenCV by hand?
I’ve ran the numbers and even if you know exactly what you are doing it will take a bare minimum of 2.2 hours to compile and install OpenCV.
If you have never installed OpenCV before or you are not familiar with Linux-based environments that number can easily jump to over 8.7 hours based on my survey of novice readers who successfully installed OpenCV on their Raspberry Pi.
It really comes down to how much you value your time and how quickly you want to get started learning computer vision. I always encourage you to use my free tutorials on installing OpenCV on the Raspberry Pi, but if you want to save yourself time (and headaches), then definitely consider going with the pre-configured Raspbian .img.
Which Practical Python and OpenCV bundles is the Raspbian image included in?
The pre-configured Raspbian image is included in both the Quickstart Bundle and Hardcopy Bundle of Practical Python and OpenCV. The pre-configured Raspbian image is not included in the Basic Bundle.
After installing your distribution of Raspbian, how do I access Python + OpenCV?
See the “Using Python and OpenCV on your Raspberry Pi” section above.
Is Wolfram’s Mathematica included in your Raspbian distribution?
No, I am now legally allowed to distribute a modified version of Raspbian (that is part of a product) with Mathematica installed.
How did you reduce the size of the Raspbian image file?
To start, I removed unneeded software such as Wolfram’s Mathematica and LibreOffice. Removing these two pieces of software alone saved nearly 1GB of space.
From there, the size of the main partition was reduced and was set to auto-expand on first boot.
What Python packages are installed on the Raspberry Pi?
After accessing either the respective
py2cv3or
py3cv3virtual environments run
pip freezeto see a full list of Python packages installed.
In short, I have included all necessary Python packages you will need to be successful executing the examples in Practical Python and OpenCV, including OpenCV, NumPy, SciPy, scikit-learn, scikit-image, mahotas, and many others.
Where can I learn more about Python virtual environments?
My favorite resource and introduction to Python virtual environments can be found here. I also discuss them in the first half of this blog post.
Where can I purchase a copy of Practical Python and OpenCV?
To purchase your copy of Practical Python and OpenCV, simply click here, select your bundle (I recommend either the Quickstart Bundle or the Hardcopy Bundle), and checkout.
I have another question.
If you have a question not listed in this FAQ, please send me a message.
Sound good?
To purchase your copy of Practical Python and OpenCV, just use this link.
You will find the pre-configured Raspbian .img file inside both the Quickstart Bundle and the Hardcopy Bundle (the Basic Bundle does not include the Rasbpian .img).
However, if you want a deal I would suggest waiting until Thursday, November 24th at noon EST when I’ll officially be launching the Black Friday discount of 25% OFF Practical Python and OpenCV.
I’ll also be offering a FREE Raspberry Pi 3 + hand-signed edition of Practical Python and OpenCV to the first 15 readers who purchase.
I’ve ran the numbers and I can guarantee these first 15 orders will come within 5 minutes so if you’re serious about this deal, you’ll need to act fast.
See you on Thursday!
The post Raspbian + OpenCV pre-configured and pre-installed. appeared first on PyImageSearch.
from PyImageSearch http://ift.tt/2guWnD7
via IFTTT
No comments:
Post a Comment