Something More for Research

Explorer of Research #HEMBAD

Posts Tagged ‘Ubuntu Software Center’

OpenCV Tutorials 1

Posted by Hemprasad Y. Badgujar on May 18, 2014


Image Watch: viewing in-memory images in the Visual Studio debugger

Image Watch is a plug-in for Microsoft Visual Studio that lets you to visualize in-memory images (cv::Mat or IplImage_ objects, for example) while debugging an application. This can be helpful for tracking down bugs, or for simply understanding what a given piece of code is doing.

Prerequisites

This tutorial assumes that you have the following available:

  1. Visual Studio 2012 Professional (or better) with Update 1 installed. Update 1 can be downloaded here.
  2. An OpenCV installation on your Windows machine (Tutorial: Installation in Windows).
  3. Ability to create and build OpenCV projects in Visual Studio (Tutorial: How to build applications with OpenCV inside the Microsoft Visual Studio).

Installation

Download the Image Watch installer. The installer comes in a single file with extension .vsix (Visual Studio Extension). To launch it, simply double-click on the .vsix file in Windows Explorer. When the installer has finished, make sure to restart Visual Studio to complete the installation.

Example

Image Watch works with any existing project that uses OpenCV image objects (for example, cv::Mat). In this example, we use a minimal test program that loads an image from a file and runs an edge detector. To build the program, create a console application project in Visual Studio, name it “image-watch-demo”, and insert the source code below.

// Test application for the Visual Studio Image Watch Debugger extension

#include <iostream>                        // std::cout
#include <opencv2/core/core.hpp>           // cv::Mat
#include <opencv2/highgui/highgui.hpp>     // cv::imread()
#include <opencv2/imgproc/imgproc.hpp>     // cv::Canny()

using namespace std;
using namespace cv;

void help()
{
    cout
        << "----------------------------------------------------" << endl
        << "This is a test program for the Image Watch Debugger " << endl
        << "plug-in for Visual Studio. The program loads an     " << endl
        << "image from a file and runs the Canny edge detector. " << endl
        << "No output is displayed or written to disk."
        << endl
        << "Usage:"                                               << endl
        << "image-watch-demo inputimage"                          << endl
        << "----------------------------------------------------" << endl
        << endl;
}

int main(int argc, char *argv[])
{
    help();

    if (argc != 2)
    {
        cout << "Wrong number of parameters" << endl;
        return -1;
    }

    cout << "Loading input image: " << argv[1] << endl;
    Mat input;
    input = imread(argv[1], CV_LOAD_IMAGE_COLOR);

    cout << "Detecting edges in input image" << endl;
    Mat edges;
    Canny(input, edges, 10, 100);

    return 0;
}

Make sure your active solution configuration (Build ‣ Configuration Manager) is set to a debug build (usually called “Debug”). This should disable compiler optimizations so that viewing variables in the debugger can work reliably.

Build your solution (Build ‣ Build Solution, or press F7).

Now set a breakpoint on the source line that says

Mat edges;

To set the breakpoint, right-click on the source line and select Breakpoints ‣ Insert Breakpoint from the context menu.

Launch the program in the debugger (Debug ‣ Start Debugging, or hit F5). When the breakpoint is hit, the program is paused and Visual Studio displays a yellow instruction pointer at the breakpoint:

../../../../_images/breakpoint.pngNow you can inspect the state of you program. For example, you can bring up the Locals window (Debug ‣ Windows ‣ Locals), which will show the names and values of the variables in the current scope:

../../../../_images/vs_locals.pngNote that the built-in Locals window will display text only. This is where the Image Watch plug-in comes in. Image Watch is like anotherLocals window, but with an image viewer built into it. To bring up Image Watch, select View ‣ Other Windows ‣ Image Watch. Like Visual Studio’s Locals window, Image Watch can dock to the Visual Studio IDE. Also, Visual Studio will remember whether you had Image Watch open, and where it was located between debugging sessions. This means you only have to do this once–the next time you start debugging, Image Watch will be back where you left it. Here’s what the docked Image Watch window looks like at our breakpoint:

../../../../_images/toolwindow.jpgThe radio button at the top left (Locals/Watch) selects what is shown in the Image List below: Locals lists all OpenCV image objects in the current scope (this list is automatically populated). Watch shows image expressions that have been pinned for continuous inspection (not described here, see Image Watch documentation for details). The image list shows basic information such as width, height, number of channels, and, if available, a thumbnail. In our example, the image list contains our two local image variables, input and edges.

If an image has a thumbnail, left-clicking on that image will select it for detailed viewing in the Image Viewer on the right. The viewer lets you pan (drag mouse) and zoom (mouse wheel). It also displays the pixel coordinate and value at the current mouse position.

../../../../_images/viewer.jpgNote that the second image in the list, edges, is shown as “invalid”. This indicates that some data members of this image object have corrupt or invalid values (for example, a negative image width). This is expected at this point in the program, since the C++ constructor for edges has not run yet, and so its members have undefined values (in debug mode they are usually filled with “0xCD” bytes).

From here you can single-step through your code (Debug->Step Over, or press F10) and watch the pixels change: if you step once, over the Mat edges; statement, the edges image will change from “invalid” to “empty”, which means that it is now in a valid state (default constructed), even though it has not been initialized yet (using cv::Mat::create(), for example). If you make one more step over thecv::Canny() call, you will see a thumbnail of the edge image appear in the image list.

Now assume you want to do a visual sanity check of the cv::Canny() implementation. Bring the edges image into the viewer by selecting it in the Image List and zoom into a region with a clearly defined edge:

../../../../_images/edges_zoom.pngRight-click on the Image Viewer to bring up the view context menu and enable Link Views (a check box next to the menu item indicates whether the option is enabled).

../../../../_images/viewer_context_menu.pngThe Link Views feature keeps the view region fixed when flipping between images of the same size. To see how this works, select the input image from the image list–you should now see the corresponding zoomed-in region in the input image:

../../../../_images/input_zoom.pngYou may also switch back and forth between viewing input and edges with your up/down cursor keys. That way you can easily verify that the detected edges line up nicely with the data in the input image.

More …

Image watch has a number of more advanced features, such as

  1. pinning images to a Watch list for inspection across scopes or between debugging sessions
  2. clamping, thresholding, or diff’ing images directly inside the Watch window
  3. comparing an in-memory image against a reference image from a file

Please refer to the online Image Watch Documentation for details–you also can get to the documentation page by clicking on the Helplink in the Image Watch window:

../../../../_images/help_button.jpg

Advertisements

Posted in Computer Vision, OpenCV, OpenCV Tutorial | Tagged: , | Leave a Comment »

Installing CUDA Toolkit 5.5 on Ubuntu 12.10 Linux

Posted by Hemprasad Y. Badgujar on January 3, 2014


Installing CUDA Toolkit 5.5 on Ubuntu 12.10 Linux

The following explains how to install CUDA Toolkit 5.5 on 64-bit Ubuntu 12.10 Linux. I have tested it on a self-assembled desktop with AMD Phenom II X4 CPU, 4GB RAM, 500GB hard drive, 650W power supply, and NVIDIA GeForce GTX 550 Ti graphics card. The instruction assumes you have the necessary CUDA compatible hardware support. Depending on your system configuration, your mileage may vary.

 

CUDA Repository

Retrieve the CUDA repository package for Ubuntu 12.10 from the CUDA download site and install it in a terminal.

$ sudo dpkg –i cuda-repo-ubuntu1210_5.5-0_amd64.deb
$ sudo apt-get update

 

Linux Kernel Header

Then you need to install the necessary Linux kernel headers.

$ sudo apt-get install linux-headers-‘uname -r‘

 

Proprietary Video Driver

The built-in nouveau video driver in Ubuntu is incompatible with the CUDA Toolkit, and you have to replace it with the proprietary NVIDIA driver.

$ sudo apt-get remove –purge \
    xserver-xorg-video-nouveau

$ sudo apt-get install nvidia-settings \
    nvidia-current-dev nvidiamodprobe

You can reboot the system afterwards and verify the driver installation with the nvidia-settings utility.

 

CUDA Toolkit

Then you can install the CUDA Toolkit using apt-get.

$ sudo apt-get install cuda

 

Environment Variables

As part of the CUDA environment, you should add the following in the .bashrc file of your home folder.

export CUDA_HOME=/usr/local/cuda-5.5
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64

PATH=${CUDA_HOME}/bin:${PATH}
export PATH

 

CUDA SDK Samples

Now you can copy the SDK samples into your home directory, and proceed with the build process.

cuda-install-samples-5.5.sh  ~
cd ~/NVIDIA_CUDA-5.5_Samples
$ make

If everything goes well, you should be able to verify your CUDA installation by running thedeviceQuery sample in bin/linux/release.

Posted in Computer Languages, Computing Technology, CUDA, GPU (CUDA), PARALLEL | Tagged: , , , , , | Leave a Comment »

Installing CUDA 5 on Ubuntu 12.04

Posted by Hemprasad Y. Badgujar on January 3, 2014


This guide is based on Ubuntu 12.04 LTS, but the same principles apply in newer versions of Ubuntu. Let’s begin.

nvidia-cuda

1. Make sure you have a CUDA supported GPU

You must have a nVIDIA GPU that supports CUDA, otherwise you can’t program in CUDA code. Here’s a list with the CUDA supported GPU models.

2. Install nVIDIA proprietary drivers

Use Jockey (additional drivers) or just pick the driver you want from the NVIDIA official website.

3. Download CUDA Toolkit 5.0 for Ubuntu

I used the Ubuntu 11.10 32bit version. It’s the latest version so far, but it currently works fine. So please download.

4. Fix the libglut.so error

There will be an error when you’ll try to install the CUDA 5.0 examples. The driver is trying to find the libglut.so file and it doesn’t look for other versions, such as so.1so.2 etc.

First confirm that you have a libglut file:

$ sudo find /usr -name libglut\*

If you do, symlink that file to libglut.so.

For 64bit:

$ sudo ln -s /usr/lib/x86_64-linux-gnu/libglut.so.3 /usr/lib/libglut.so

For 32bit:

$ sudo ln -s /usr/lib/i386-linux-gnu/libglut.so.3 /usr/lib/libglut.so

5. Install the CUDA Toolkit and Samples

Press CTRL+ALT+F1 to open a shell — yeah, we’re going to do this in old (yet powerful) command-line way, but there’s no need to be afraid of the black and white terminal with a blinking cursor. After all you know what they say, once you go black…

5.1 Shutdown the all the graphics

Ubuntu uses LightDM, so you need to stop this service:

$ sudo service lightdm stop

5.2 Run the installer

Go to (using cd) the directory where you have the CUDA installer (a file with *.run extension) and type the following:

$ sudo chmod +x *.run
$ sudo ./*.run

Accept the License and install only the CUDA 5 Toolkit and the Samples. DO NOT install the drivers because we have already done that.

6. Enable the nvcc compiler

In order to compile CUDA code you have to use the nvcc compile. In that so you have to tweak some environment variables into your ~/.bashrc file:

For 32bit:

export PATH=$PATH:/usr/local/cuda-5.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib

For 64bit:

export PATH=$PATH:/usr/local/cuda-5.0/bin
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib64:/lib

If you want to compile a CUDA file (*.cu extension) you can use the following command:

nvcc -o file file.cu

./file

Or use the NSight Eclipse Edition.

– See more at: http://www.unixmen.com/how-to-install-cuda-5-0-toolkit-in-ubuntu/#sthash.IScUBu1O.dpuf

Posted in Computer Softwares, Computing Technology, CUDA, GPU (CUDA), GPU Accelareted, Installation, PARALLEL, Project Related, Research Menu, UNIX OS | Tagged: , , , , , , | Leave a Comment »

10 Things to Do After Installing Ubuntu 12.04

Posted by Hemprasad Y. Badgujar on December 27, 2013


So you’ve downloaded it, you’ve installed it, and now you’re about to use it.

But before you dive on in to explore, be sure to take some time out to follow our bi-annual rundown of the best post-install tips and tricks.

1. Learn What’s New

There are a lot of new features in Ubuntu 12.04 – so take a few minutes out to learn about 10 of the best.

 

2. Check for Updates

Ubuntu 12.04 may be hot-off-the-press but that doesn’t mean a few last-minute bug fixes aren’t waiting for you already.

New updates alert will be listed in the Power Menu(the right-hand cog icon), although you can also manually check by launching the ‘Update Manager’ from the Dash.

Ubuntu Updates

3. Install Media Codecs

If you plan on listening to your music library or watching films in Ubuntu then you’ll need to have the necessary codecs installed.

For legal reasons Ubuntu can’t provide these ‘out of the box’, but the installer does offer to install them during set-up.

If you didn’t check that box during installation it’s no biggy: hit the button below to begin installation of the most common codecs through the Ubuntu Software Centre.

Click to Install Third-Party Codecs

4. Customize your Desktop

There are 14 new wallpapers included in Ubuntu 12.04 – including an illustrated Pangolin and the usual stunning snaps of flowers, animals and landscapes. Rather neatly, the semi-transparent parts of Unity will change colour to compliment your set wallpaper – try it and see!

Appearance in Ubuntu 12.04

The Unity Launcher (the bar on the left hand screen) can be resized if you’re find it too big or too small.

And the ‘theme’ used by windows can also be changed to a lighter, elegant version.

All of these above (and a bit more) can be achieved through the Appearance entry in the System Settings.

5. Adjust Your Privacy Settings

When you first open the Unity Dash you’ll see an overview of your recent activity: apps, files and folders you’ve recently used, etc.

privacy options

But you may not want all of this to stuff to show.

Well that’s easy enough to change: the new Privacycontrols available in the System Settings panel offer you the chance to choose what is logged and what isn’t.

6. Set up Ubuntu One

Every user of Ubuntu is given 5GB of free online cloud storage with Ubuntu One – so be sure to make use of it!

Open the ‘Ubuntu One’ entry from the Messaging Menu(‘envelope’ icon) and follow the prompts to set up an account.

If you already have one then be sure to sign in so all of your music, photos and folders are safely in sync with your fresh-new desktop.

7. Explore New Apps

The Ubuntu Software Center is home to thousands of extra applications – from music players and web browser to accounting apps and games.

Some are good, some are bad – but it’s always worth browsing around to see if you can find something you like.

8. Grab Google Chrome (Or Flash)

“What?!!” you may scream, “Why not just use Firefox?”

Flash is the reason.

Google Chrome in ubuntu 12.04

Earlier this year Adobe announced that it was, in effect, abandoning support of the ubiquitous Flash Player plugin on Linux. Google will, instead, be taking over the reigns, integrating Flash for Linux into their Chrome browser.

So if you want the latest stable and bug-free Flash player in Linux, Google Chrome is the only way to get it.

Download Google Chrome for Linux

Not that bothered about the latest and greatest, or not interested in switching browser? No worries. The last independent release of Adobe Flash for Linux is available to install through the Ubuntu Software Center.

Click to Install Flash

9. Install LibreOffice Global Menu

The default office suite in Ubuntu doesn’t not support integrate with the application menu bar by default.

To enable it (and add some consistency to your desktop) just hit the button below to install the necessary package.

Click to Install Global Menu for LibreOffice

10. Enjoy It!

Finally, to end on a corny note, take some time out to just enjoy using it.

Forget about finding and installing new apps for an hour or so and just use Ubuntu like anyone else would: check your Facebook or Google+ profile, chat to your mates on Empathy, type up that letter in LibreOffice and listen to some music in Rhythmbox

Ubuntu 12.04 is a bold upgrade from 11.10, and an even bigger one from 10.04, so be sure to take some time to get used to it as it comes before changing anything major.

You might fear missing a certain application or feature, but most of the changes have happened for a reason: to make Ubuntu easier to use.

Posted in Mixed | Tagged: , , , , , , , | Leave a Comment »

 
Extracts from a Personal Diary

dedicated to the life of a silent girl who eventually learnt to open up

Num3ri v 2.0

I miei numeri - seconda versione

ThuyDX

Just another WordPress.com site

Algunos Intereses de Abraham Zamudio Chauca

Matematica, Linux , Programacion Serial , Programacion Paralela (CPU - GPU) , Cluster de Computadores , Software Cientifico

josephdung

thoughts...

Tech_Raj

A great WordPress.com site

Travel tips

Travel tips

Experience the real life.....!!!

Shurwaat achi honi chahiye ...

Ronzii's Blog

Just your average geek's blog

Karan Jitendra Thakkar

Everything I think. Everything I do. Right here.

VentureBeat

News About Tech, Money and Innovation

Chetan Solanki

Helpful to u, if u need it.....

ScreenCrush

Explorer of Research #HEMBAD

managedCUDA

Explorer of Research #HEMBAD

siddheshsathe

A great WordPress.com site

Ari's

This is My Space so Dont Mess With IT !!

%d bloggers like this: