Make “Shared Folder” between windows 7 and Ubuntu 12 in VirtualBox (6 Steps)

machinelearning1:

Updated post.

Originally posted on machinelearning1:

If you have a windows 7 OS and you are trying Ubuntu 12.xx on a VirtualBox, here I am going to explain how to make a shared folder and have access to files between two OS.

1- Run VirtualBox and start Ubuntu

2- Install Guest Additions under Devices menu in VirtualBox

3- Create a Folder in your windows OS (wherever you like). You can put any kind of file in this folder later to share them. (example: VBoxShared)

4- Go to Devices>Shared Folders… and add your folder which you created in previous step, also check the “make permanent” option.

5- Create a folder in your Ubuntu OS (wherever you like ). for example: path: /home/user/Desktop/Shared
and folder name: (example: VBoxShared)

6- Open a terminal (ctrl+alt+T) and enter the following command:

1

Now If you move some files in the windows 7 shared…

View original 14 more words

Posted in Uncategorized | Leave a comment

Connect from Windows to Ubuntu-on-VirtualBox using Putty through SSH

machinelearning1:

Updated post.

Originally posted on machinelearning1:

So, here are some steps you need to take for connecting from Windows to Ubuntu-onVirtualBox using putty through SSH:

1- before running the Ubuntu inside the virtual box check this setting:

Setting > Network >  Adaptor 1 > Attached to> Bridge Connection

You can try using the Bridge Connection with option:

Intel Centrino Wireless-N 1030
or
Realtek PCIe GBE family Controller

2- Start the Ubuntu inside the virtual box

3- Open a Console (Ctrl + Alt + T)

4- Enter : ifconfig and check your virtual-box ubuntu IP. It should be in the same range as your main OS, for example both should be something like: 192.168.x.x (not: 10.2.x.x)
You may try different options for the Adapter in step.1 After each change, if you do not see any changes in the connection inside the VirtualBox, you can use the following commands to refresh the network connection:

1
~$ nmcli nm enable…

View original 102 more words

Posted in Uncategorized | Leave a comment

Function Approximation – 1 (Radial Basis Network)

Here I give an example about the function approximation technique in MATLAB, than can be used in many areas, e.g., machine learning, robotics, artificial intelligence, optimization. The function approximation in this tutorial is accomplished using Radial Basis Networks. There are 5 simple steps that I explain individually.

1- first we make a sine wave with variable domain that will be the target of function approximation. (This is similar to MATLAB documentation)

X=-1:0.1:1;
T1 = [-.9602 -.5770 -.0729 .3771 .6405 .6600 .4609 ...
.1336 -.2013 -.4344 -.5000 -.3930 -.1647 .0988 ...
.3072 .3960 .3449 .1816 -.0312 -.2189 -.3201];

2- to make it different from the MATLAB example, I add the same wave in reverse to the data. This makes the function approximation task more interesting.

X=-1:0.1:3.1;
T2 = T1(1,end:-1:1);
T = [T1 T2];

3- I want to start from a number of points, not all of them (say the 10 first points), accomplish the function approximation and then add a new point each time and update the function approximation. This would help to understand how we can use function approximation inside an algorithm at each iteration. So we have to define the followings:

eg = 0.02;           % sum-squared error goal
sc = 1;                  % spread constant
o = 10;                 % number of points to start from
iii = 1;                  % counter-1
jjj = 2;                 % counter-2
c = hsv(size(T,2));
h = figure;

4- Now the main loop is as follows:

for ii=1:size(T,2)-o+1
TT = T(1,1:o+ii);                                                        % add one point at each iteration
XX = X(1,1:o+ii);                                                      % add one point at each iteration
figure(h);plot(XX,TT,'+','color',c(ii,:));hold on
saveas(h,['x' num2str(iii) '.png']);                        % save figure
iii = iii + 1;
net = newrb(XX,TT,eg,sc);                                     % train a radial basis network
Y = net(XX);                                                              % use the trained network
figure(h);plot(XX,Y,'color',c(ii,:));hold on
saveas(h,['x' num2str(jjj) '.png']);
jjj = jjj + 1;
end

5- the result can be seen in the following animated Gif:

4126986

Posted in Linux, Machine Learning, MATLAB, Neural Networks, Optimization, programming, Robotics, SIMULINK, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Extract numeric data from MATLAB figures

In order to extract numeric data from a MATLAB figure you can do the following steps:

1- open the fig file

2- execute the following lines of code

h=get(gca,'Children'); %get the handle of the object
xData=get(h,'XData'); %get the x data
yData=get(h,'YData'); %get the y data

3- if the extracted xData and yData vectors/Matrices are cells then you can easily convert them as follows:

xDataNum = cell2mat(xData);
yDataNum = cell2mat(yData);
Posted in Linux, MATLAB, programming, SIMULINK, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Kashi (Kashani) the Mathematician

Al-Kashi was one of the best mathematicians in the Islamic world. He was born in 1380, in Kashan, in central Iran.

In order to determine sin 1°, al-Kashi discovered the following formula often attributed to François Viète in the 16th century.

sin(3\theta) = 3sin(\theta) - 4sin^3(\theta)

This is just one of his amazing mathematical discoveries.

A method algebraically equivalent to Newton’s method was known to his predecessor Sharaf al-Dīn al-Tūsī. Al-Kāshī improved on this by using a form of Newton’s method to solve x^P - N = 0 to find roots of N. In western Europe, a similar method was later described by Henry Biggs in his Trigonometria Britannica, published in 1633.

Posted in Thoughts | Tagged , , , , , , , | Leave a comment

Simple Object Detection in 3 lines of Code (OpenCV/Python)

img_filt = cv2.medianBlur(cv2.imread('f.jpg',0), 5)
img_th = cv2.adaptiveThreshold(img_filt,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,11,2)
contours, hierarchy = cv2.findContours(img_th, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)

figure_1

Posted in Linux, Machine Learning, OpenCV, programming, Python, Robotics, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Read, write, show images in OpenCV (Python)

In order to load or read an image you can use imread function.

>>> import numpy
>>> import cv2
>>> img = cv2.imread('filename.jpg',0)

In order to display an image you can use imshow function.

>>> cv2.imshow('image',img)
>>> cv2.waitkey(0)
>>> cv2.destroyAllWindows()

After you applied some changes to an Image you can write it into the disk. In order to write an image you can use imwrite function.

>>> imwrite('newfilename.png',img)

Finally you can do all above in the following snippet:

import numpy as np
import cv2
img = cv2.imread('myImage.jpg',0)
cv2.imshow('image',img)
k = cv2.waitKey(0)
if k == 27:
    cv2.imwrite('newImage.png',img)
    cv2.destroyAllWindows()

 

 

 

 

Posted in Linux, Machine Learning, OpenCV, programming, Python, Robotics, Software, Ubuntu | Tagged , , , , , , , , , , , , , , , , , , , | Leave a comment