Skip to content

Commit

Permalink
adds MRNG data
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKutschera committed Mar 9, 2022
1 parent f3f681d commit 39cc511
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,27 @@
/build
.externalNativeBuild
.idea
/app/.cxx/cmake/debug/x86/android_gradle_build.json
/app/.cxx/cmake/debug/x86/android_gradle_build_mini.json
/app/.cxx/cmake/debug/x86/build.ninja
/app/.cxx/cmake/debug/x86/build_command.txt
/app/.cxx/cmake/debug/x86/build_model.json
/app/.cxx/cmake/debug/x86/build_output.txt
/app/.cxx/cmake/debug/x86/CMakeFiles/cmake.check_cache
/app/.cxx/cmake/debug/x86/cmake_install.cmake
/app/.cxx/cmake/debug/x86/cmake_server_log.txt
/app/.cxx/cmake/debug/x86/CMakeCache.txt
/app/.cxx/cmake/debug/x86/CMakeFiles/3.10.2/CMakeCCompiler.cmake
/app/.cxx/cmake/debug/x86/CMakeFiles/3.10.2/CMakeCXXCompiler.cmake
/app/.cxx/cmake/debug/x86/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_C.bin
/app/.cxx/cmake/debug/x86/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_CXX.bin
/app/.cxx/cmake/debug/x86/CMakeFiles/CMakeOutput.log
/app/.cxx/cmake/debug/x86/CMakeFiles/3.10.2/CMakeSystem.cmake
/app/.cxx/cmake/debug/x86/compile_commands.json
/app/.cxx/cmake/debug/x86/CMakeFiles/feature_tests.bin
/app/.cxx/cmake/debug/x86/CMakeFiles/feature_tests.c
/app/.cxx/cmake/debug/x86/CMakeFiles/feature_tests.cxx
/app/.cxx/cmake/debug/x86/json_generation_record.json
/app/.cxx/ndk_locator_record.json
/app/.cxx/cmake/debug/x86/rules.ninja
/app/.cxx/cmake/debug/x86/CMakeFiles/TargetDirectories.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ class CameraPreviewCallbackNative(private val mContext: Context) : Camera.Previe
val timeStampString = timestamp.toString()
Log.i("Hit-Detected", timeStampString)


try {
//Copy to CamerPreviewCallbackNative
//Information to store in the folder <timeStampString> on the moment of detection
Expand All @@ -206,8 +205,6 @@ class CameraPreviewCallbackNative(private val mContext: Context) : Camera.Previe
e.printStackTrace()
}



try {
// Store Hit-Bitmap onto device
val directory = File(
Expand Down Expand Up @@ -237,11 +234,12 @@ class CameraPreviewCallbackNative(private val mContext: Context) : Camera.Previe
}

try {
val epsilon = 20;
val epsilon = 21;
var pxTxt = ""
var mrngpx = ""
var mrngcl = ""
var rgbPx = ""
var mrng3 = ""
for (x in 0 until cropBitmap.getWidth()) {
for (y in 0 until cropBitmap.getHeight()) {
var px = cropBitmap.getPixel(x, y)
Expand All @@ -253,11 +251,11 @@ class CameraPreviewCallbackNative(private val mContext: Context) : Camera.Previe
var alpha = Color.alpha(px)
if (red > epsilon || green > epsilon || blue > epsilon) {
rgbPx = rgbPx + red + ";" + green + ";" + blue + ";" + alpha + ";" + x +";" + y + "\n"
mrng3 = mrng3 + ((red%2) + (green%2) + (blue%2))%2
}

}
}
// Log.e("MRNG-RGBRaw-YYY:"+timeStampString,"CenterXY:" + centerX + ":" + centerY + ";" + rgbPx)

// Write MRNG data to file
try {
Expand All @@ -272,8 +270,13 @@ class CameraPreviewCallbackNative(private val mContext: Context) : Camera.Previe
val mrngFile = "/" + timeStampString + "_mrng.txt"
val myfile = File(directory,mrngFile)

val mrng1 = timeStampString.subSequence(timeStampString.length-4,timeStampString.length).toString().toInt()
val mrng2 = (centerX%2).toString() + (centerY%2).toString()

myfile.printWriter().use { out ->
out.println("CenterXY:" + centerX + ";" + centerY)
out.println(Integer.toBinaryString(mrng1).toString() + mrng2 + mrng3)
out.println(timeStampString)
out.println("" + centerX + ";" + centerY)
out.println(rgbPx)
}
} catch (e: Exception) {
Expand Down

0 comments on commit 39cc511

Please sign in to comment.