Firefox OS App Development Session 01

Firefox OS is a Fastest HTML5 Mobile Application environment. It challenges to the famous OSs Android and iOS

We can create applications for firefox just use of HTML5,CSS and Javascript knowladge. we don’t need to know more.

Just watch this video for your introductions.







Today the devices support for firefox OS increases and users count also increasing.

Firefox OS is an valuable gift from god for web developers.Just knowing the web designing language like HTML5,CSS,Java script you will be a firefox OS Developer. and also you can proud to say I’m a Mobile Developer too.

Firefox.org introduce Market Place for selling or distributing your applications.
https://marketplace.firefox.com/

There is a handy simulator available as a add-on in firefox browser. you can add it to your browser and test your applications without using firefox OS phone. It is a developing technology in initial state so the firefox OS phones are still not available in some countries.
01. Before you try to install simulator on you browser you should update the version of firefox. Because firefox OS is not available for older versions of Mozilla.


02.After your update of browser install the firefox OS simulator add-on using following link.
03.There is a  green colour button avaliable in the page. Click the button to install firefox on your browser.
    


04. Go to the menu ( press alt if menu not visible ) Tools –> Web Developer –>Firefox OS Simulator follow these steps to start the simulator.
    

Now if you have a firefox OS embedded simulator on your hand. Just go a tour to do a visit to every thing in firefox OS. 

 
Hope you run the sexy simulator successful Meet you on session II in Firfox OS App Development.



Unsharp Masking(USM) filtering to sharpen edge in Images using Image Processing Techniques

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
I=imread('lenna.JPG');

if length(size(I)) == 3
I=rgb2gray(I);
end

[row,col]=size(I);
J=zeros(row+4,col+4);
J(3:row+2,3:col+2) = I;

% I*H
K=edge(J,'canny');

% M = I - (I*H)
M = [];
for i=1:row+4
for j=1:col+4
M(i,j)= J(i,j) - K(i,j);
end
end

% I' = I + alpha*M
N = [];
for i=1:row+4
for j=1:col+4
N(i,j)= J(i,j) + (0.7)*M(i,j);
end
end

J=uint8(J);
N=uint8(N);

subplot(1,2,1);imshow(J);
subplot(1,2,2);imshow(N);


facebook,youtube,download,movies,google,streaming

Giving Border to a Image

Giving border to a image using image processing techniques. I used this way to give border to an image like this.

Have you notified the border? If not try this code in your mat-labhttps://github.com/nifrasismail/ImagePading.m/blob/master/ImagePadding.m

 1
2
3
4
5
6
7
8
9
10
11
12
I=imread('lenna.JPG');

if length(size(I)) == 3
I=rgb2gray(I);
end

[row,col]=size(I);
J=zeros(row+4,col+4);
J(3:row+2,3:col+2) = I;
J=uint8(J);
subplot(1,2,1);imshow(I);
subplot(1,2,2);imshow(J);

Project a 3D Hexognal using perspective projection OpenGL in C++

Figure 1

Perspective in the graphic arts, such as drawing, is an approximate representation, on a flat surface (such as paper), of an image as it is seen by the eye.(wikipedia)

Figure 2

Using these technique to generate an 3D object in 2D plane. The code is here :

  1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#include 
#include
#include
#include

typedef struct{float x;float y;}Point2D;
typedef struct{float x;float y;float z;}Point3D;
int d = 600;
GLfloat vlist[8][4];

void init(void)
{
vlist[0][0] = 140;
vlist[0][1] = 270;
vlist[0][2] = 100;

vlist[1][0] = 220;
vlist[1][1] = 270;
vlist[1][2] = 100;

vlist[2][0] = 260;
vlist[2][1] = 200;
vlist[2][2] = 100;

vlist[3][0] = 220;
vlist[3][1] = 130;
vlist[3][2] = 100;

vlist[4][0] = 140;
vlist[4][1] = 130;
vlist[4][2] = 100;

vlist[5][0] = 100;
vlist[5][1] = 200;
vlist[5][2] = 100;

vlist[6][0] = 140;
vlist[6][1] = 270;
vlist[6][2] = 300;

vlist[7][0] = 220;
vlist[7][1] = 270;
vlist[7][2] = 300;

vlist[8][0] = 260;
vlist[8][1] = 200;
vlist[8][2] = 300;

vlist[9][0] = 220;
vlist[9][1] = 130;
vlist[9][2] = 300;

vlist[10][0] = 140;
vlist[10][1] = 130;
vlist[10][2] = 300;

vlist[11][0] = 100;
vlist[11][1] = 200;
vlist[11][2] = 300;

}

void rotateObj_x(float deg_x){ // rotate the Object about a line which is parallel to X axis
float ang = deg_x * 3.14159265359 / 180.0; //angle in radians

for(int i=0; i<12; i++){
float tmpx = vlist[i][0];
float tmpy = vlist[i][1];
float tmpz = vlist[i][2];
vlist[i][0] = tmpx;
vlist[i][2] = tmpz*cos(ang) - tmpy*sin(ang);
vlist[i][1] = tmpz*sin(ang) + tmpy*cos(ang);
}


glutPostRedisplay(); //this will call the function "myDisplay()" again
}

void rotateObj_y(float deg_y){ // rotate the Object about a line which is parallel to Y axis
float ang = deg_y * 3.14159265359 / 180.0;

for(int i=0; i<12; i++){
float tmpx = vlist[i][0];
float tmpy = vlist[i][1];
float tmpz = vlist[i][2];
vlist[i][1] = tmpy;
vlist[i][0] = tmpx*cos(ang) - tmpz*sin(ang);
vlist[i][2] = tmpx*sin(ang) + tmpz*cos(ang);
}


glutPostRedisplay(); //this will call the function "myDisplay()" again
}

Point2D ProjectXY(float x, float y, float z){ //Perspective projection on XY plane with COP is at (180,200,-d)
Point2D p0;
d= abs(d);
p0.x = (x*d)/(d-z);
p0.y = (y*d)/(d-z);

return p0;
}

void drawObj(Point2D A,Point2D B,Point2D C,Point2D D, Point2D E,Point2D F, Point2D G,Point2D H, Point2D I,Point2D J,Point2D K, Point2D L)
{
glPointSize(1.0);
glLineWidth(2.0);
//Draw front
glBegin(GL_LINE_LOOP);

glVertex2f(A.x,A.y);glVertex2f(B.x,B.y);glVertex2f(C.x,C.y);glVertex2f(D.x,D.y);glVertex2f(E.x,E.y);glVertex2f(F.x,F.y);
glEnd();

//Draw BACK

glBegin(GL_LINE_LOOP);
glVertex2f(G.x,G.y),glVertex2f(H.x,H.y);glVertex2f(I.x,I.y);glVertex2f(J.x,J.y);glVertex2f(K.x,K.y);glVertex2f(L.x,L.y);
glEnd();

//Connect Lines
glBegin(GL_LINES);
glVertex2f(A.x,A.y);glVertex2f(G.x,G.y);
glVertex2f(B.x,B.y);glVertex2f(H.x,H.y);
glVertex2f(C.x,C.y);glVertex2f(I.x,I.y);
glVertex2f(D.x,D.y);glVertex2f(J.x,J.y);
glVertex2f(E.x,E.y);glVertex2f(K.x,K.y);
glVertex2f(F.x,F.y);glVertex2f(L.x,L.y);
glEnd();
glFlush();
}

void myDisplay()
{
glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0f, 0.0f, 0.0f);

Point2D pro_A = ProjectXY(vlist[0][0],vlist[0][1],vlist[0][2]);
Point2D pro_B = ProjectXY(vlist[1][0],vlist[1][1],vlist[1][2]);
Point2D pro_C = ProjectXY(vlist[2][0],vlist[2][1],vlist[2][2]);
Point2D pro_D = ProjectXY(vlist[3][0],vlist[3][1],vlist[3][2]);
Point2D pro_E = ProjectXY(vlist[4][0],vlist[4][1],vlist[4][2]);
Point2D pro_F = ProjectXY(vlist[5][0],vlist[5][1],vlist[5][2]);
Point2D pro_G = ProjectXY(vlist[6][0],vlist[6][1],vlist[6][2]);
Point2D pro_H = ProjectXY(vlist[7][0],vlist[7][1],vlist[7][2]);
Point2D pro_I = ProjectXY(vlist[8][0],vlist[8][1],vlist[8][2]);
Point2D pro_J = ProjectXY(vlist[9][0],vlist[9][1],vlist[9][2]);
Point2D pro_K = ProjectXY(vlist[10][0],vlist[10][1],vlist[10][2]);
Point2D pro_L = ProjectXY(vlist[11][0],vlist[11][1],vlist[11][2]);
drawObj(pro_A,pro_B,pro_C,pro_D,pro_E,pro_F,pro_G,pro_H,pro_I,pro_J,pro_K,pro_L);
}



void keyboard(unsigned char key, int x, int y)
{
if (key == 'q' || key == 'Q')
exit(EXIT_SUCCESS);
if (key == '+')
{
if(d > 0 && d < 2000){
d++;
glutPostRedisplay();
}
}
if (key == '-')
{
if(d > 0 && d < 2000){
d--;
glutPostRedisplay();
}
}
}

void special(int key, int, int) {
switch (key) {
case GLUT_KEY_LEFT: rotateObj_y(-1); break; // decreasing the angle by 1 degree
case GLUT_KEY_RIGHT: rotateObj_y(1);break; // increasing the angle by 1 degree
case GLUT_KEY_UP: rotateObj_x(-1);break; // decreasing the angle by 1 degree
case GLUT_KEY_DOWN: rotateObj_x(1);break; // increasing the angle by 1 degree
default: return;
}
}

int main( int argc, char ** argv ) {
glutInit( &argc, argv );
glutInitWindowPosition( 0, 0 );
glutInitWindowSize( 800, 600 );
glutCreateWindow( "Hexagonal Prism " );

glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluOrtho2D( 0, 800, 0, 600 );
glViewport(0, 0, 800, 600);

init();

glutKeyboardFunc(keyboard);
glutSpecialFunc(special);
glutDisplayFunc( myDisplay );
glutMainLoop();

return( 0 );
}