Skip to content

Commit 77a3012

Browse files
authored
Add files via upload
1 parent 3b9f1c5 commit 77a3012

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+681
-0
lines changed

Future maybe.pdf

282 KB
Binary file not shown.

MORSERx/MORSERx.ino

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
//Morse Code Binary Tree
3+
// Left child at 2n+1
4+
// Right child at 2n+2
5+
6+
const char MorseTree[] = {'\0','E', 'T', 'I', 'A', 'N', 'M', 'S',
7+
'U', 'R', 'W', 'D', 'K', 'G', 'O', 'H',
8+
'V', 'F', 'U', 'L', 'A', 'P', 'J', 'B',
9+
'X', 'C', 'Y', 'Z', 'Q', '\0','\0','5',
10+
'4', '\0','3', '\0','\0','\0','2', '\0',
11+
'\0','+', '\0','\0','\0','\0','1', '6',
12+
'=', '/', '\0','\0','\0','(', '\0','7',
13+
'\0','\0','\0','8', '\0','9', '0', '\0',
14+
'\0','\0','\0','\0','\0','\0','\0','\0',
15+
'\0','\0','\0','?', '_', '\0','\0','\0',
16+
'\0','"', '\0','\0','.', '\0','\0','\0',
17+
'\0','@', '\0','\0','\0','\0','\0','\0',
18+
'-', '\0','\0','\0','\0','\0','\0','\0',
19+
'\0',' ', '!', '\0',')', '\0','\0','\0',
20+
'\0','\0',',', '\0','\0','\0','\0',':',
21+
'\0','\0','\0','\0','\0','\0','\0'
22+
};
23+
24+
//PIN 4 is LDR
25+
int val = 0; // A Variable to Store the Light Value from the LDR
26+
int ctrHigh = 0;
27+
int ctrLow = 0;
28+
int codePtr = 0;
29+
int dotLen = 400;
30+
31+
void setup()
32+
{
33+
Serial.begin(9600);// Start a Serial Connection
34+
Serial.print(codePtr);
35+
}
36+
37+
void loop()
38+
{
39+
val = analogRead(4);
40+
41+
if (val >= 400) //on and light received //change this value
42+
{
43+
//Serial.print(val);Serial.print("\n");}
44+
45+
ctrHigh++;
46+
ctrLow = 0;
47+
digitalWrite(13, HIGH);
48+
tone(9, 1000);
49+
} else { //off and no light
50+
ctrLow++;
51+
if ((ctrHigh >= dotLen) && (ctrHigh < dotLen*2)) {
52+
Serial.print(".");
53+
codePtr = (2*codePtr) + 1;
54+
} else if (ctrHigh >= dotLen * 2) {
55+
Serial.print("-");
56+
codePtr = (2*codePtr) + 2;
57+
} else {
58+
if(ctrLow == dotLen*2){
59+
Serial.print(MorseTree[codePtr]);
60+
codePtr = 0;
61+
}
62+
}
63+
64+
ctrHigh = 0;
65+
digitalWrite(13, LOW);
66+
noTone(9);
67+
}
68+
}

MORSETx/MORSETx.ino

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
//TRANSMITTER
2+
//CONNECT LASER to spin 13
3+
const char* MorseTable[] = {
4+
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
5+
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
6+
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
7+
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
8+
// space, !, ", #, $, %, &, '
9+
NULL, "-.-.--", ".-..-.", NULL, NULL, NULL, NULL, ".----.",
10+
// ( ) * + , - . /
11+
"-.--.", "-.--.-", NULL, ".-.-.", "--..--", "-....-", ".-.-.-", "-..-.",
12+
// 0 1 2 3 4 5 6 7
13+
"-----", ".----", "..---", "...--", "....-", ".....", "-....", "--...",
14+
// 8 9 : ; < = > ?
15+
"---..", "----.", "---...", "-.-.-.", NULL, "-...-", NULL, "..--..",
16+
// @ A B C D E F G
17+
".--.-.", ".-", "-...", "-.-.", "-..", ".", "..-.", "--.",
18+
// H I J K L M N O
19+
"....", "..", ".---", "-.-", ".-..", "--", "-.", "---",
20+
// P Q R S T U V W
21+
".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--",
22+
// X Y Z [ \ ] ^ _
23+
"-..-", "-.--", "--..", NULL, NULL, NULL, NULL, "..--.-",
24+
// ' a b c d e f g
25+
NULL, ".-", "-...", "-.-.", "-..", ".", "..-.", "--.",
26+
// h i j k l m n o
27+
"....", "..", ".---", "-.-", ".-..", "--", "-.", "---",
28+
// p q r s t u v w
29+
".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--",
30+
// x y z { | } ~ DEL
31+
"-..-", "-.--", "--..", NULL, NULL, NULL, NULL, NULL,
32+
};
33+
34+
int dotLength = 50;
35+
int dashLength = dotLength*3;
36+
37+
void setup() {
38+
// put your setup code here, to run once:
39+
pinMode(13, OUTPUT);
40+
Serial.begin(9600);
41+
}
42+
43+
void loop() {
44+
char ch;
45+
if(Serial.available()){
46+
ch = Serial.read();
47+
flashDashDot(MorseTable[ch]);
48+
delay(dotLength*2);
49+
}
50+
}
51+
52+
void flashDashDot(const char * morseCode)
53+
{
54+
int i = 0;
55+
while(morseCode[i] != 0)
56+
{
57+
if(morseCode[i] == '.'){
58+
dot();
59+
} else if (morseCode[i] == '-'){
60+
dash();
61+
}
62+
i++;
63+
}
64+
}
65+
66+
void dot()
67+
{
68+
digitalWrite(13, HIGH);
69+
delay(dotLength);
70+
digitalWrite(13, LOW);
71+
delay(dotLength);
72+
}
73+
74+
void dash()
75+
{
76+
digitalWrite(13, HIGH);
77+
delay(dashLength);
78+
digitalWrite(13, LOW);
79+
delay(dotLength);
80+
}

OCRDemoMatlab-master/Arduino.m

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
clc
2+
clear all
3+
arduino=serial('COM4','BaudRate',9600); % create serial communication object
4+
fopen(arduino); % initiate arduino communication
5+
pause(1);
6+
text=input('enter','s');
7+
text='aman is the king of the world';
8+
fprintf(arduino,'%s\n',text,'sync'); % send answer variable content to arduino
9+
pause(1);
10+
fclose(arduino);

OCRDemoMatlab-master/FINAL.m

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
clc
2+
clear all
3+
4+
% TEXT TO SPEECH
5+
NET.addAssembly('System.Speech');
6+
obj = System.Speech.Synthesis.SpeechSynthesizer;
7+
obj.Volume = 100;
8+
9+
Speak(obj,"Optical character recognition.");
10+
pause(0.5);
11+
Speak(obj,"SELECT IMAGE");
12+
[file,path] = uigetfile({'*.bmp;*.png'});
13+
if isequal(file,0)
14+
disp('User selected Cancel')
15+
else
16+
imagen=imread(file);
17+
%imagen = imflatfield(imagen,30);
18+
imagen=imsharpen(imagen);
19+
unstr=OCR(imagen);
20+
str=lower(unstr);
21+
pause(1);
22+
23+
24+
%SPEAK OUT TEXT
25+
for i=1:length(str)
26+
disp(str(i));
27+
Speak(obj,str(i));
28+
end
29+
30+
end
31+

OCRDemoMatlab-master/FINAL_OPTO.m

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
clc
2+
clear all
3+
[file,path] = uigetfile({'*.bmp;*.png'},...
4+
'Select Image File To send');
5+
if isequal(file,0)
6+
disp('User selected Cancel')
7+
else
8+
imagen=imread(file);
9+
%imagen = imflatfield(imagen,30);
10+
imagen=imsharpen(imagen);
11+
unstr=OCR(imagen);
12+
str=lower(unstr);
13+
pause(1);
14+
15+
for i=1:length(str)
16+
disp(str(i));
17+
arduino=serial('COM4','BaudRate',9600); % create serial communication object
18+
fopen(arduino); % initiate arduino communication
19+
pause(0.5);
20+
text=input('Converted.. transmiting now...? Enter k ','s');
21+
text=str(i);
22+
fprintf(arduino,'%s\n',text,'sync'); % send answer variable content to arduino
23+
text2=input('Received? Enter k ','s');
24+
pause(0.5);
25+
fclose(arduino);
26+
end
27+
end
28+

OCRDemoMatlab-master/OCR.m

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
function str=OCR(imagen)
2+
% OCR (Optical Character Recognition).
3+
warning off %#ok<WNOFF>
4+
close all
5+
% READ THE IMAGE
6+
%imagen=imread('sentence.bmp');
7+
8+
% SHOW IMAGE
9+
imagen1 = imagen;
10+
figure,imshow(imagen1);
11+
title('INPUT IMAGE WITH NOISE')
12+
% Convert to gray scale
13+
%if size(imagen,3)==3 %RGB image
14+
% imagen=rgb2gray(imagen);
15+
%end
16+
17+
% CONVERT THE IMAGE TO GRAYSCALE FOR EASIER READING
18+
threshold = graythresh(imagen);
19+
imagen =~im2bw(imagen,threshold);
20+
imagen2 = imagen;
21+
figure,imshow(imagen2);
22+
word=[ ];
23+
str=string(100);
24+
i=1;
25+
re=imagen;
26+
27+
28+
29+
fid = fopen('text.txt', 'wt'); %OPEN TEXT FILE FOR THE OUTPUT
30+
load templates %LOAD THE TEMPLATES OF THE LETTERS
31+
global templates
32+
num_letras=size(templates,2); %Compute the number of letters in template file
33+
while 1
34+
%'lines_crop':SPLITS THE WHOLE PIC INTO LINES
35+
[fl re]=lines_crop(re); %fl= first line, re= remaining image
36+
imgn=fl;
37+
n=0;
38+
% figure,imshow(fl);pause(0.5)%SHOWS EACH LINE
39+
spacevector = []; %TOTAL NMBER OF SPACES
40+
rc = fl;
41+
42+
while 1
43+
%'letter_crop' SEPARATES EACH LETTER FROM THE IMAGE
44+
[fc rc space]=letter_crop(rc); %fc = first letter in the line
45+
%rc = remaining cropped line
46+
%space = space between the letter
47+
% cropped and the next letter
48+
49+
%figure,imshow(fc);pause(0.5) %SHOW LETTERS ONE BY ONE
50+
img_r = imresize(fc,[42 24]); %RESIZE FOR CORRELATION
51+
n = n + 1;
52+
spacevector(n)=space;
53+
54+
%'read_letter' CORRELATION IS DONE TO FIND THE CORRECT LETTER
55+
%given in the folder 'letters_numbers'
56+
letter = read_letter(img_r,num_letras);
57+
word = [word letter]; %LETTER CONCATENATION
58+
59+
if isempty(rc) %breaks loop when there are no more characters
60+
break;
61+
end
62+
end
63+
64+
max_space = max(spacevector);
65+
no_spaces = 0; %NUMBER OF SPACES
66+
67+
for x= 1:n %LOOP TO FIND SPACES BETWEEN CHARACTERS
68+
if spacevector(x+no_spaces)> (0.75 * max_space)
69+
no_spaces = no_spaces + 1;
70+
for m = x:n
71+
word(n+x-m+no_spaces)=word(n+x-m+no_spaces-1);
72+
end
73+
word(x+no_spaces) = ' ';
74+
spacevector = [0 spacevector];
75+
end
76+
end
77+
78+
fprintf(fid,'%s\n',word); %WRITE WORD READ INTO TEXT FILE
79+
str(i)=word;
80+
i=i+1;
81+
word=[ ];
82+
%BREAK LOOP WHEN SENTENCE ENDS
83+
if isempty(re) %See variable 're' in Fcn 'lines'
84+
break
85+
end
86+
end
87+
fclose(fid);
88+
% winopen('text.txt') %OPEN THE TEXT FILE TO DISPLAY
89+
end

OCRDemoMatlab-master/TEST.m

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
clc
2+
clear all
3+
close all
4+
5+
[file,path] = uigetfile({'*.bmp;*.png'});
6+
if isequal(file,0)
7+
disp('User selected Cancel')
8+
else
9+
imagen=imread(file);
10+
% imagen = imflatfield(imagen,30);
11+
% imagen=imsharpen(imagen);
12+
unstr=OCR(imagen);
13+
str=lower(unstr);
14+
15+
% pause(1);
16+
17+
% %SPEAK OUT TEXT
18+
for i=1:length(str)
19+
disp(str(i));
20+
% Speak(obj,str(i));
21+
% pause(0.5);
22+
end
23+
end
24+

OCRDemoMatlab-master/bsentence.bmp

470 KB
Binary file not shown.

OCRDemoMatlab-master/characters/0.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/1.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/2.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/3.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/4.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/5.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/6.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/7.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/8.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/9.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/A.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/B.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/C.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/D.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/E.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/F.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/G.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/H.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/I.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/J.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/K.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/L.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/M.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/N.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/O.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/P.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/Q.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/R.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/S.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/T.bmp

230 Bytes
Binary file not shown.
7.5 KB
Binary file not shown.

OCRDemoMatlab-master/characters/U.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/V.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/W.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/X.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/Y.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/Z.bmp

230 Bytes
Binary file not shown.

OCRDemoMatlab-master/characters/a.png

169 Bytes

OCRDemoMatlab-master/characters/b.png

149 Bytes

OCRDemoMatlab-master/characters/c.png

163 Bytes

OCRDemoMatlab-master/characters/d.png

151 Bytes

OCRDemoMatlab-master/characters/e.png

165 Bytes

OCRDemoMatlab-master/characters/f.png

121 Bytes

OCRDemoMatlab-master/characters/g.png

178 Bytes

OCRDemoMatlab-master/characters/h.png

122 Bytes

OCRDemoMatlab-master/characters/i.png

118 Bytes

OCRDemoMatlab-master/characters/j.png

127 Bytes

OCRDemoMatlab-master/characters/k.png

159 Bytes

OCRDemoMatlab-master/characters/l.png

91 Bytes

OCRDemoMatlab-master/characters/m.png

135 Bytes

OCRDemoMatlab-master/characters/n.png

130 Bytes

OCRDemoMatlab-master/characters/o.png

152 Bytes

OCRDemoMatlab-master/characters/p.png

151 Bytes

OCRDemoMatlab-master/characters/q.png

148 Bytes

OCRDemoMatlab-master/characters/r.png

129 Bytes

OCRDemoMatlab-master/characters/s.png

179 Bytes
504 Bytes
941 Bytes

OCRDemoMatlab-master/characters/t.png

124 Bytes

OCRDemoMatlab-master/characters/u.png

128 Bytes

OCRDemoMatlab-master/characters/v.png

147 Bytes

OCRDemoMatlab-master/characters/w.png

146 Bytes

OCRDemoMatlab-master/characters/x.png

173 Bytes

OCRDemoMatlab-master/characters/y.png

159 Bytes

OCRDemoMatlab-master/characters/z.png

146 Bytes

0 commit comments

Comments
 (0)