Category Archives: Beginner

Flip Image OpenCV Python

OpenCV provides the flip() function which allows for flipping an image or video frame horizontally, vertically, or both.

 

Reference:

OpenCV documentation:  http://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html#flip

Install ROS Kinetic on Ubuntu

If you haven’t heard of ROS before it is an acronym for Robot Operating System by the Open Source Robotics Foundation.

ROS provides libraries and tools to help software developers create robot applications. It provides hardware abstraction, device drivers, libraries, visualizers, message-passing, package management, and more. ROS is licensed under an open source, BSD license.

Kinetic is the tenth ROS distribution release and is short for “Kinetic Kane”.  It was released May 23rd, 2016.

 

Ubuntu install of ROS Kinetic

Debian packages are available for several Ubuntu platforms, listed below. These packages are more efficient than source-based builds and are our preferred installation method for Ubuntu. Note that there are also packages available from Ubuntu upstream. Please see UpstreamPackages to understand the difference.

Ubuntu packages are built for the following distros and architectures.

Distro amd64 i386 armhf
Ubuntu 15.10 (Wily Werewolf) X X
Ubuntu 16.04 LTS (Xenial Xerus) X X X

If you need to install from source (not recommended), please see source (download-and-compile) installation instructions.

Installation

 

Configure your Ubuntu repositories

 

Configure your Ubuntu repositories to allow “restricted,” “universe,” and “multiverse.” You can follow the Ubuntu guidefor instructions on doing this.

Setup your sources.list

 

Setup your computer to accept software from packages.ros.org. ROS Kinetic ONLY supports Wily (Ubuntu 15.10), Xenial (Ubuntu 16.04) and Jessie (Debian 8) for debian packages.

Mirrors

Source Debs are also available

 

Set up your keys

 



  •  

 

Installation

First, make sure your Debian package index is up-to-date:



  •  

There are many different libraries and tools in ROS. We provided four default configurations to get you started. You can also install ROS packages individually.

In case of problems with the next step, you can use following repositories instead of the ones mentioned above ros-shadow-fixed

  • Desktop-Full Install: (Recommended) : ROS, rqt, rviz, robot-generic libraries, 2D/3D simulators, navigation and 2D/3D perception


    • or click here

    Desktop Install: ROS, rqt, rviz, and robot-generic libraries


    • or click here

    ROS-Base: (Bare Bones) ROS package, build, and communication libraries. No GUI tools.


    • or click here

    Individual Package: You can also install a specific ROS package (replace underscores with dashes of the package name):



    • e.g.

       

To find available packages, use:

Initialize rosdep

Before you can use ROS, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS.

 

Environment setup

 

It’s convenient if the ROS environment variables are automatically added to your bash session every time a new shell is launched:

 

If you have more than one ROS distribution installed, ~/.bashrc must only source the setup.bash for the version you are currently using.

If you just want to change the environment of your current shell, instead of the above you can type:

 

Getting rosinstall

rosinstall is a frequently used command-line tool in ROS that is distributed separately. It enables you to easily download many source trees for ROS packages with one command.

To install this tool on Ubuntu, run:

Build farm status

The packages that you installed were built by the ROS build farm. You can check the status of individual packages here.

License

Installation how to modified from ROS wiki.  Content licensed under Creative Commons Attribution 3.0

Open an Image with OpenCV in Python

The following code will get you started to load and display an image with OpenCV and Python.

OpenCV functions used:

The code

 

Boilerplate code

 

Where to next?

Excel Delete Blank Rows while Preserving Data

You could use Excel’s “Remove Duplicates” feature, but any duplicate data that is supposed to be there will also get blown away.

To assuredly remove blank rows without removing duplicate data (and maintaining the original order), follow these steps:

  1. Locate or insert a blank column
  2. Optionally name the column “Order” or leave it blank if there are no headers
  3. Type the number “1” in the first row of data
  4. Fill down to the last row of data
  5. Sort by an actual data field
  6. Now the blank rows will be grouped together, so delete the blank rows.
  7. Re-sort by the column of numbers from Smallest to Largest.
  8. Optionally delete the column of numbers

Need to undo this operation? Here’s how to Insert a Blank Row Between Every Row in Excel

Related how-to’s using the functions mentioned here:

Excel create a GETURL function

  1. Open the workbook
  2. Enter into the VBA editor (Press Alt+F11)
  3. Insert a new module (Insert > Module)
  4. Copy and Paste the Excel user defined function below
  5. Exit out of VBA (Press Alt+Q) the function will be saved
  6. Use this syntax for this custom Excel function: =GETURL(cell)

By the way

  • VBA stands for Visual Basic for Applications

References

Excel: Insert blank row between every row

There is no inbuilt way in Excel to insert a blank row between every existing row, but it is achievable without doing it manually.

The process is to create a column with repeated numerals (1 to n, where n is the number of rows with data) equal to twice the number of rows of data (2n) and sort by that column so blank lines appear between each data row.  Here’s how…

  1. Locate or insert a blank column
  2. Optionally name the column “Order” or leave it blank if there are no headers
  3. Type the number “1” in the first row of data
  4. Fill down to the last row of data
  5. Select and Copy all the numbers just created in that column
  6. Paste the selection below the data into the first blank row
  7. Sort by the column of numbers from Smallest to Largest.
  8. Optionally delete the column of numbers

Tip: if you need multiple blank rows between, repeat step 6 as necessary

Related:

Excel month name, abbreviation from date

In Excel the Text formatting formula (=TEXT()) is capible of re-formatting Excel’s built in date storage format.

Type Date Example Result Formula
Full Month Name 1/25/2016 January =TEXT(B2, “mmmm”)
Abbreviated Month 1/25/2016 Jan =TEXT(B3, “mmm”)
Two digit month number 1/25/2016 01 =TEXT(B4, “mm”)
Single/double month number 1/25/2016 1 =TEXT(B5, “m”)

Related search:

  • excel text month name

Resources:

How to Extract links from a Webpage

Turn this…

20160616-scott-on-technology-page-source

into a neat file with clean links…

20160616-scott-on-technology-extracted-links

Things you need:

  1. A web browser
  2. A webpage from which to extract links
  3. An online tool to automatically extract the links
  4. A program to open .csv files (Excel/Google Sheets/free alternative, etc.)

Hint: If you only need links from a portion of the page use Firefox.  It allows you select a portion of the page and view only the “selection source” instead of the entire page.

Process

  • Navigate to the desired webpage in your favorite browser
  • View and copy the page source
    • Chrome: “View page source”
    • Firefox: “View Page Source” or “View Selection Source”
  • Paste the copied html into an online tool and click the button to generate a CSV file with the resulting links
  • Download, open, & enjoy!

Once the file is open you can do more other things in Excel like sorting by Domain or removing duplicate links.

Online Tool for Extracting Links from webpages:

What does “| tee -a build.log” do?

What does “| tee -a build.log” do?

This command will display the output in the terminal and also write the output to a file called build.log

Let’s examine each part of the command

| (pipe)
allows the output of one program to be sent to another

tee
split the output to the terminal and to the file

-a
appends the input to the given file(s) instead of overwriting

build.log
is the name of the file to which the input is written

Variants:
|& tee configure.log
|& tee make.log
|& tee make.log
|& tee install.log
| tee $BUILDLOG

Source: http://en.wikipedia.org/wiki/Tee_(command)

 

Adapted from my 12/9/13 post http://advancedmarketingllc.com/what-does-tee-a-build-log-do/

What does “apt-get upgrade -y” do?

What does “apt-get upgrade -y” / “sudo apt-get upgrade -y” do?

This command will upgrade all packages that have updates available and answer Yes (y) to the subsequent prompt (typically whether or not to continue after displaying the additional disk space that will be used)

Example:
After this operation, X kB/MB of additional disk space will be used.
Do you want to continue [Y/n]?
Will continue because the answer alreay provided is Y

Let’s examine each part of the command

sudo
execute a command as another user (typically root)

apt-get
a simple command line interface for downloading and installing packages

upgrade
Perform an upgrade

-y
Assume Yes to all subsequent queries and do not prompt

Adapted from my 12/10/13 post http://advancedmarketingllc.com/what-does-apt-get-upgrade-y-do/