Darhi Moodhna in Islam

OpenCV configuration with Visual Studio

Today i'll show you the how can you manually configure OpenCV 2.4.11 with Visual Studio 2013.

Open the visual studio File > New > New Project > Installed > Template > Visual C++ > CLR then click on CLR Console Application and named the project as TestOpenCV then hit OK.




Go to Link and download opencv 2.4.11, you can choose any latest version of opencv, process will be same as following.
Create a new folder in Drive C named as cv2411 and extract in it. Your directory should be like following image.


First of all you need to set System Environment Variable in windows. Open Control panel > System and Security > System > Advance system settings > Advanced click on Environment Variables button. Select Path from System variables then click Edit and paste bin path as following then click OK OK and OK :).

  • C:\cv2411\opencv\build\x86\vc12\bin





Go back to Visual Studio, right click on project and select properties. I'm building opencv for x86 platform in visual studio but you can also use x64. For this you just need to change path as x64. In properties panel go to Configuration Properties > VC++ Directories > Include Directories then click drop down edit button and add following path.

  • C:\cv2411\opencv\build\include

In Libraries Directories add following path
  • C:\cv2411\opencv\build\x86\vc12\lib



Go to C/C++ > Additional Include Directories and paste following directory

  • C:\cv2411\opencv\build\include

Go to Linker > Additional Library Directories and paste following directory

  • C:\cv2411\opencv\build\x86\vc12\lib
Go to Linker > Input >Additional Dependencies and paste following libraries name 
  • opencv_calib3d2411d.lib
  • opencv_contrib2411d.lib
  • opencv_core2411d.lib
  • opencv_features2d2411d.lib
  • opencv_flann2411d.lib
  • opencv_gpu2411d.lib
  • opencv_highgui2411d.lib
  • opencv_imgproc2411d.lib
  • opencv_legacy2411d.lib
  • opencv_ml2411d.lib
  • opencv_nonfree2411d.lib
  • opencv_objdetect2411d.lib
  • opencv_photo2411d.lib
  • opencv_stitching2411d.lib
  • opencv_superres2411d.lib
  • opencv_ts2411d.lib
  • opencv_video2411d.lib
  • opencv_videostab2411d.lib
If you want to configure opencv in Release mode the simply remove d from above libraries names.
Then click on Apply button then OK. Your opencv has been configured. Now let's run some lines of code to test OpenCV, just copy following code and paste in TestOpenCV.cpp file.
  • #include "stdafx.h"
    #include <iostream>
    #include <opencv/cv.h>
    #include <opencv/highgui.h>
    #include <opencv2/core/core.hpp>
    #include <opencv2/opencv.hpp>
    #include <opencv2/imgproc/imgproc.hpp>
    #include <opencv2/highgui/highgui.hpp>

    using namespace std;
    using namespace cv;

    int main()
    {
      Mat image;
      image = cv::imread("C:\\test.png");
      namedWindow("Display window", 1);
      imshow("Display window", image);
      waitKey(0);
      return 0;
    }
Build the project and run.
If you are facing dll missing errors then simply go to following path and copy all dll files and paste them with project .exe file. You can find project exe file in Project directory. it will be in Debug or Release folder.

  • C:\cv2411\opencv\build\x86\vc12\bin
If you have any issue or suggestion please comment below.
, , ,

How to configure opencv in Eclipse IDE

Firstly, I'm assuming that you have installed OpenCV on Ubuntu. If not, then follow the link. Secondly You need to install Eclipse + JDK7. Following command will install eclipse for c++ developer with JDK7. Just Run following command.

  • sudo apt-get install eclipse eclipse-cdt g++

Open Eclipse and right click or Go to File > new project > C/C++ > C++ Project > Next

Name the project as TestOpenCV and select Hello World C++ Project then click next. Write Author name whatever you want then click next next and finish.


Before to run project expand src directory and add following lines of code in TestOpenCV.cpp



  • #include "stdfix.h"#include <iostream>
    #include <opencv/cv.h>
    #include <opencv/highgui.h>
    #include <opencv2/core.hpp>

    #include <opencv2/opencv.hpp>

    #include <opencv2/imgproc/imgproc.hpp>

    #include <opencv2/highgui/highgui.hpp>


    using namespace std;
    using namespace cv;

    int main()
    {
            Mat image;
            image  = cv::imread("/home/test.png");
            namedWindow("Display window", 1);
            imshow("Display window",image);
            waitKey(0);
            return 0;
    }
Now Right on project > properties > C/C++ Build > Settings > Cross G++ Compiler > Includes

Run following commands to get includes paths
  • pkg-config --cflags opencv
Copy all include paths and add into include paths (-I) tab like following
Run following command in terminal to get all libraries paths and lib files
  • pkg-config --libs opencv
Now Click on Cross G++ Linker > Liberalities
and add lib path in Library search path (-L) tab and all OpenCV libs in Libraries(-I) tab
  • Path: /usr/local/lib
  • Libs: opencv_calib3d opencv_contrib opencv_core opencv_features2d opencv_flann opencv_gpu opencv_highgui opencv_imgproc opencv_legacy opencv_ml opencv_nonfree opencv_objdetect opencv_ocl opencv_photo opencv_stitching opencv_superres opencv_ts opencv_video opencv_videostab
It may be different if you installed different version.
Click OK and build the project the project and run.

, , , ,

How to install Opencv on Ubuntu Desktop/Ubuntu Server

To install OpenCV on your system run the following commands in terminal. You should have Ubuntu/Server 12 or 14 LTS to install it.


  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install libtiff5-dev
  • sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff5-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev default-jdk ant libvtk5-qt4-dev
You can change OpenCV version in following command, just go to link and change the version in following OpenCV URL, like I'm using 2.4.11 here.
  • cd~
    wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.11/opencv-2.4.11.zip
    unzip opencv-2.4.11.zip
    cd opencv-2.4.11
  • mkdir build
    cd build
    cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_VTK=ON ..
Now, you are ready to compile and install OpenCV 2.4.11:

  • make
  • sudo make install
Now, you have to configure OpenCV first. Open the opencv.conf file with the following command if you are using Ubuntu desktop

  • sudo gedit /etc/ld.so.conf.d/opencv.conf
If you are using Ubuntu Server then open file with following command

  • sudo nano /etc/ld.so.conf.d/opencv.conf
Add following lines at the end of the file (it may be an empty file, that is ok) and then save it:

  • /usr/local/lib
To save file use CTRL+X then press y then hit enter.
Run the following command to configure the library

  • sudo ldconfig
Now you have to open another file:

  • if you are using Ubuntu Desktop then use this command
    • sudo gedit /etc/bash.bashrc
  • if you are using Ubuntu Server then use this command
    • sudo nano /etc/bash.bashrc
Add these two lines at the end of the file and save it:

  • PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
    export PKG_CONFIG_PATH
Finally, close the terminal and open a new one, restart the computer or logout and then login again. OpenCV will not work correctly until you do this.

To see where opencv installed use following command

  • pkg-config --cflags opencv
To see lib files directory use following command

  • pkg-config --libs opencv
Let run simple c++ code with opencv code using g++ compiler. Create new file and named it as test.cpp and add following code in it

  • #include "stdfix.h"#include <iostream>
    #include <opencv/cv.h>
    #include <opencv/highgui.h>
    #include <opencv2/core.hpp>

    #include <opencv2/opencv.hpp>

    #include <opencv2/imgproc/imgproc.hpp>

    #include <opencv2/highgui/highgui.hpp>


    using namespace std;
    using namespace cv;

    int main()
    {
            Mat image;
            image  = cv::imread("/home/test.png");
            namedWindow("Display window", 1);
            imshow("Display window",image);
            waitKey(0);
            return 0;
    }
Save the file, open terminal cd to directory where you save test.cpp file and write following command in terminal

  • g++ `pkg-config --cflags opencv` text.cpp `pkg-config --libs opencv` -o test
Your file is build with opencv, just write following command to run test file


  • ./test
Thanks :)
,

How to access other computer through LAN (local network area) and copy/delete all files

Today i'll show you a simple method to hack into a computer and you can copy the files or paste the files using command prompt. You just need to follow some easy steps

  1.  Go to command prompt

    1. Press Windows button and type command or

    2. Press Windows + R

    3. Then hit enter

  2. On command prompt just type "net view". it will show all the computers that are connected to you network.
  3. The type "tracert name of computer" this will give you the IP address of victim computer, or you can simply use an IP scanner to get victim IP address.
  4. Type "net view \\IP-Address" for example: net view \\10.0.33.79 and hit enter.
    This will show you the folders and drivers which you shared by victim.
  5. Now type "net use L: \\IP-Address\\ the file which he shared" for example: net use L: \\10.0.33.79\Users.
    In above command i have given L  is just for an example. You can give any letter except the driver names which are not in your computer like C, E, D, F etc.) and hit enter if command completed successfully.
  6. Go to My Computer there you will see a new drive which is of the name of the IP Address.
    Now you can explore it and can do anything.

KeyBoard Lights Bliking Continuously


Hi! Today we play a little trick. Through this trick your keyboard lights blinking like they are dancing.
So lets Start 

  • Open Notepad copy and paste following green code

Set wshShell=wscript.CreateObject("WScript.Shell")
do
wscript.sleep 100
wshShell.sendkeys "{CAPSLOCK}"
wshShell.sendkeys "{NUMLOCK}"
wshShell.sendkeys "{SCROLLLOCK}"
loop

  • Save as file to your dextop, named disco.vbs.
  • Go to dextop you see your disco file of extension vbs. Double click on it 
There we go. You see your keyboard lights dancing (blinking).
If you want to stop these lights follow these steps
  • Right click on Task Bar 
  • Click Task Manager 
  • Find and click on wscript.exe file 
  • Press End Process

How to earn Money Online By Adfly?

Trick: Adfly Money Earning
Some people facing some problem in google addsense account to earn by adds on your site. 
This become easy by Adfly. Some people thought  it as a scam at first but that as basically due to the fact that they did not knew how to use the site.

Steps
There are three main steps require to earn money by Adfly:
  1. Sign Up Here
  2. Shrink The Links
  3. Share The Links
These steps are for Professionals and can start earning now otherwise read
the more detailed steps below.

Detail Steps

  • Follow this link here and you will be directed to Adfly website main page.
    Click "JOIN NOW" button.


  • When you Joined then you have to fill your information e.g 
  1. Your Name
  2. Username
  3. Email
  4. Password
  5. Account Type
  6. Humane Check
    at 5th point there will be two Account Types at Adfly that being An Advertiser
    or Publisher.
    You can advertise your website for visitors and all by signing up at adfly as an advertiser but as we are discussing the subject of earning let's leave Advertising topic here.

    After you have filled everything correctly , make sure you checked check box of terms and conditions and then click the Join Button


Go to your Email that you entered now. You may receive a account verification email. Copy the
verification code and paste it in given link. 
  • Now you are successfully have Adfly dashboard like mine one given below. 



Red bar is the main thing. In this bar you can paste any link of your site then press Shrink . For Example if i was convert www.windowscreativestar.blogspot.com into a adfly money generating link
then it would become http://adf.ly/slesw. Now i can share this shrinked link to any ware like twitter, 
facebook etc. where i get more traffic of my site. When ever some one clicks on this link money will be generated for me as shown in my Dashboard.

Adfly share earning through advertising with you 50/50. The Actual amount you will receive per visitor varies depending on the location of the person and what advertisers are currently on the system. You view the current publisher payout rate here. Minimum payout of $5.00 and they pay with PayPal or Payoneer once per month.

You can also earn through referral. Just get referral in your Dashboard copy the URL and paste in twitter or facebook or any ware.

Note: Per click earning depends on visitor's country.





Windows 10 Features VS Windows 8.1

Windows 10 VS Windows 8.1
Using Windows 10 almost from day of released. I have discovered little changes and feature
that Microsoft hasn't yet discussed . Let's dive straight in with favorite secret features of
Windows 10.

"Home" tab in Explorer now

In the last few version of windows, opening My Computer or a new Explorer window
would show you your computer's various storage locations and shortcuts to default folders
like Documents and My Pictures. In Windows 10, you now end up in a new view called
Home, which shows Favorites, Frequent Folders, and Recent Files. Take loo at the 
screen shot below and you'll see what i mean.

Windows 10 This PC Home
Favorites seems to be where Documents or My Pictures should appear. I don't know the
 math behind the Frequent Folders, but it looks like just tracks which folders I have 
opened the most times. Recent Files is like the Recent Places feature That premiered in
Windows Vista, but just for files.

I assume that folders can be added to the Favorites section, but I've not yet worked
out how to do it. (To be honest, the more advances features of Explorer, lie Libraries, are
still pretty hard to penetrate).

"This PC" is still available from the left-hand menu if you want to manage your various storage locations/default folders. I like the new Home tab a lot.

Windows 10 Home Tab

  
Recycle Bin on the task bar

Rather than having to take around Explorer or minimize everything and find the Recycle
Bin icon on Dextop, in Windows 10 you can now add the Recycle Bin to both
the task bar and the Start menu. Yes, that is the sound of many brains exploding as they catastrophically realize the enormity of this change.

Recycle Bin at Task Bar and Start Menu


Windows 10 Start menu is re-sizable

This feature is much odd one. You can make the Windows 10 Start menu as tall or as wide as you
like. If you want to have a Start menu that takes up the entire left side of your screen, or a narrow
strip across the task bar, the that's show now possible. The task bar itself is also re sizable, which means you can do weird stuff this:

Re sizable Windows 10




Cortana is coming to Windows 10

Search with Cortana also coming in Windows 10 new features. There is a lot of references to Cortana in windows 10 Technical Preview, there is even a

Windows.Cortana .dll       just sitting in System32 directory.

You also get lot of Cortana-related hits if you search "Cortana "  within the Registry Editor.

I'm hopefully see Cortana in the next beta of Windows 10. None of this is say that
Cortana is definitely coming to Windows 10.
Windows 10 Cortana



Toasts Notification in Windows 10

There are some pretty toasts/notifications that pop up in the top right corner of the screen.
These notification appear to replace the speech bubble s that used to pop out of the system tray
(this task bar , unless you are one of those heathens who has moved the task bar to a non-standard location).You can see Example Image below, but there are similar toasts for successful uploads to
Drop-box and similar activities.

It seems that notification or toasts are configures though the same interface that Metro notification used in Windows 8/8.1 i.e PC settings (see below).

Windows 10 Toast Notification

Windows 10 Toast Notification


The new Notification Tray might only be coming soon in Metro interface.




Why did Microsoft Skip Windows 9 [Rumor]



Few day back when Microsoft announced the windows 10 as their next version of Windows was the most unexpected surprised at San Francisco event.
However why did Microsoft skip windows 9 and jump directly to Windows 10.

One of the developer from Microsoft named cranbourne stated on Reddit that
Microsoft dev here, the internal rumours are that early testing revealed just how many third party products that had code of the form

if(version.StartsWith("windows9"))
{
      /*95 and 98*/
}
else {

and that this was the pragmatic solution to avoid that.

And if Microsoft named Windows 10 as Windows 9, then all classic apps with
above code will deal it as windows 95 or Windows 98. So that's why Microsoft skip Windows 9.

Unity Keyboard Shortcuts For Game Developer

Unity Shortcuts Make Easy To Use

FFrame selected (ie, show the selected asset in its containing folder)
TabShift focus between first column and second column (Two columns)
Ctrl/Cmd + FFocus search field
Ctrl/Cmd + ASelect all visible items in list
Ctrl/Cmd + DDuplicate selected assets
DeleteDelete with dialog
Delete + ShiftDelete without dialog
Backspace + CmdDelete without dialogs (OSX)
EnterBegin rename selected (OSX)
Cmd + down arrowOpen selected assets (OSX)
Cmd + up arrowJump to parent folder (OSX, Two columns)
F2Begin rename selected (Win)
EnterOpen selected assets (Win)
BackspaceJump to parent folder (Win, Two columns)
Right arrowExpand selected item (tree views and search results). If the item is already expanded, this will select its first child item.
Left arrowCollapse selected item (tree views and search results). If the item is already collapsed, this will select its parent item.
Alt + right arrowExpand item when showing assets as previews
Alt + left arrowCollapse item when showing assets as previews

Unity From Scratch

Unity Interface

Unity Interface depends on 5 parts .Following interface can be adjusted in your way , just drag and drop set it as you like...
  1. Tool bar
  2. Scene
  3. Inspector
  4. Project
  5. Hierarchy

  • Hierarchy

Hierarchy contains some GameObject of your current Scene. Some of these are direct instance of asets files, like Prefabs and 3D Models.




Parenting

Unity uses a concept called Parenting, to make any GameObject the child of another. Just Drag the desired child into desired Parent in the Hierarchy. Inherited child will move and rotate according to it's Parent.





Store Procedure in SQL Server

Store Procedure is subroutine available to Application  that access Relational Database System.
Few important things are to be noted:
  • Not like Views in Access SP (Store Procedure) are pre-compiled in database.
  • Keyword is PROC or PROCEDURE.
  • Increase the Usability in Query Optimization.
  • Store in Database.
  • Wipe out from memory after their execution.

How to code?

Open SQL-Server, Create new Database named as EmployeeDB and Table named as Employee















Add following fields names in table







Make sure ID set as auto increment and Primary Key 
Expand Tables => right-click on dbo.Employee => Edit Top 200 Rows and Add dummy data like following







To make sure data is added, click on New Query (placed at right corner), and  paste following code and Click

SELECT * FROM [EmployeeDB].[dbo].[Employee];

How to Create Store Procedure ?

·          Using same query we create store procedure .
·          Paste/Replace following code and click Execute.

CREATE PROC SPAllEmployee
AS
SELECT * FROM [EmployeeDB].[dbo].[Employee];

It create store procedure named as SPAllEmployee.
You can also see that Store Procedure file is created in Database => EmployeeDB => Programmability => Store Srocedures.
Now, 

How To Call Store?

Click New Query Paste following Code and Execute.

Exec SPAllEmployee

How to Alter Store Procedure ?

·         Using same Store Procedure SPAllEmployee we alter this SP(Store Procedure). Now we are going to change the query . Click New Query Paste Following Code and Click Execute.
ALTER PROC SPAllEmployee
AS
SELECT * FROM [EmployeeDB].[dbo].[Employee] AS E
WHERE E.City='Lahore';

Click New Query Paste Following Code and Execute
            
            Exec SPAllEmployee

See query result is changed now.

How to Drop Store Procedure? 


Simple click on New Query and Execute Following code.

DROP PROCEDURE SPALLEmployee;

How to Create Store Procedure with Parameter?


      Again create new Store Procedure named as SPnewEmployee in New Query  and Execute following lines of code.

CREATE PROC SPnewEmployee
@param varchar(50)
AS
SELECT * FROM [EmployeeDB].[DBO].[Employee] AS E
WHERE E.[City]=@param;

EXEC SPnewEmployee 'Lahore'


If you want pass two or more parameter just separated with comma.
Now create new Store Procedure in New Query and Execute following lines of code it.

CREATE PROC SPnewEmployeeTwo
@city varchar(50),
@departmentName varchar(50)
AS
SELECT * FROM [EmployeeDB].[DBO].[Employee] AS E
WHERE E.[City]= @city AND E.DepartmentName=@departmentName;

And now click New Query paste following code and then click on Execute.

EXEC SPnewEmployeeTwo @city='Lahore', @departmentName='English';