Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CHILD INTELLIGENT ASSESSMENT TOOL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-046
CHILD INTELLIGENT ASSESSMENT TOOL
Commits
0ba37063
Commit
0ba37063
authored
Apr 07, 2020
by
Gunasinghe M.D.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Classification - read images
parent
a922e4a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
TrainANN.java
TrainANN.java
+37
-0
No files found.
TrainANN.java
0 → 100644
View file @
0ba37063
package
opencvapp
;
import
java.io.File
;
import
org.opencv.core.Core
;
public
class
TrainANN
{
public
static
void
main
(
String
[]
args
){
String
currentDirectory
=
System
.
getProperty
(
"user.dir"
);
System
.
load
(
currentDirectory
+
"\\OpenCVDLL\\x64\\"
+
Core
.
NATIVE_LIBRARY_NAME
+
".dll"
);
String
[]
classesNames
=
{
"vert_line"
,
"hor_line"
,
"circle"
,
"rectangle"
,
"triangle"
,
"rhombus"
};
for
(
int
classIdx
=
0
;
classIdx
<
classesNames
.
length
;
classIdx
++){
String
currClassName
=
classesNames
[
classIdx
];
String
currClassDir
=
currentDirectory
+
"\\Dataset\\Train\\"
+
currClassName
+
"\\"
;
System
.
out
.
println
(
"Current Class Directory : "
+
currClassDir
);
File
folder
=
new
File
(
currClassDir
);
File
[]
listOfFiles
=
folder
.
listFiles
();
// Counter for the number of image being processed within the class.
int
imgCount
=
0
;
for
(
File
listOfFile
:
listOfFiles
)
{
// Check whether the file and its extension is JPG.
if
(
listOfFile
.
isFile
()
&&
(
currClassDir
+
listOfFile
.
getName
()).
endsWith
(
".jpg"
))
{
System
.
out
.
println
(
"\nClass Index "
+
classIdx
+
"("
+
currClassName
+
")"
+
", Image Index "
+
imgCount
+
"("
+
listOfFile
.
getName
()
+
")"
);
String
currImgPath
=
currClassDir
+
listOfFile
.
getName
();
System
.
out
.
println
(
currImgPath
);
imgCount
++;
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment