Monday, 11 December 2017

Week 12: The Coding

Heyyy guyssss...we are back on week 12! This week, we gonna begin with the java coding part. And of course, when it comes to coding, a lot of problems and obstacles will come to us, well, seeing things at different prospective, it might be a good thing as the sense of achievement will come to you whenever you managed to solved the error or any obstacles came to you during the progress XD.

Discussing about the math part of the coding, it is believed that we should use "for" loop to deal with the summation (the sharpness function can be view on week 11 post). And also, things are not that easy of course. As the sharpness function will deal with the array of pixel as mentioned during week 11, we need to code the apps so that it will perceive the pixels as an array form and obtain information from there. After that, the multi color pixel should be converted to gray scale pixel, so that it will exhibit intensity between 0 to 255 (black to white) and thus will interpret and process with the contrast measure. The reason we convert the RGB pixel to gray scale pixel is because that RGB pixel would need vector or coordinate system to interpret their intensity, and it will be very complicated and hard to solve for the contrast measure, therefore, gray scale pixel is preferred to be refer for contrast measure no matter which part of the world it is.

However, before proceed to the math coding part, we should first have access to the phone camera. Different methods are used in order to access the camera on our smartphone and the apps are successfully developed in this week, unfortunately, things do not go as expected as there are few problems as listed below:

1) Image captured from the self build camera apps appear to be blurry and pixelated.
- This is due to that the image appeared are in thumbnail, meaning that the blurry image appeared is actually a small image representing the large image. Thus, we should get the full size of image from the camera directly. However, to convert thumbnail to a full size picture, the java codes related to it are implemented on the apps but it seems to be no effect and the same problem still appear! *sigh*

2) The image captured cannot be saved in the phone storage.
- Codes related to access of public storing (built in SD card) within the smartphone are implemented. However, there seems to be lacking of "something" which does not allow the image to enter the storage.

Figure 1: Camera Apps Built. Camerag and CameraHanCheng.
A lot more of camera apps built before this two was made, however, all are uninstalled as they posses the same problem.

Figure 2: Layout of "Camera HanCheng" apps.

Figure 3: Blurry Image Capture


On the process of solving for the two problems mentioned above, different project files, methods, coding are used. The direct related code to "cure" for the problem are also been modified and implemented, unfortunately, things don't seem to work well. 

Another problem faced in week 12 is that the antivirus detect some of the SDK (Software Development Kit) in Android Studio as Malware and quarantine them. This causes the Android Studio to be not able to run the apps either on the emulator or a real smartphone. Upon releasing the quarantined component of Android Studio in the antivirus, it seems that part of the component are gone missing or deleted by the antivirus, thus causing the error of
IllegalArgumentException: Unable to locate adb in Android Studio " to appear whenever we try to run the code in the emulator(or on a real smartphone). This error simply means that there is some missing component in the Android Studio that causes it to be not able to perform at its finest. This can be solved by going to Tools >> Android >> SDK-Manager >> SDK-Tools. Uncheck "Android SDK Platform-Tools" and press Apply to uninstall it, and then, reinstall the SDK again. Based on StackOverFlow, it seems to work for some people, but for me, it does not work that way. Upon unzipping the re-downloaded component, the progress somehow stopped halfway and eventually the error " Installing Android SDK: Stopping ADB" appeared. This means that some component in the zipped file are still missing and are unable to unzip the whole file in order to give the complete SDK for Android Studio to run normally. This problem has caused me to stuck for days finding ways to troubleshoot and configure the problem. In the process, I had uninstalled the whole Android Studio and reinstall again, but somehow the problem still occur. But then, I had finally found the way to solve it, which is by copying adb.exe from the AppData/Local/Android/Android-SDK/Platform-Tools folder and copied it to AppData/Local/Android/SDK/Platform-Tools. This is to give back what the file is missing directly to it's file location and Android Studio seemed to be run normally again after that! 

Week 12 is definitely a week of sorrow. But however, looking things at a brighter side, I did learned a lot more on the Android Studio. Including how to create a new class of Java, have a better and deeper understand on the SDK required to run and support the Android Studio, how to solve for different type of error, meaning of different Java code, arrangement and structure of the code in the way it should, how to direct a file path, meaning of XML code and an overall better understanding and handling of the Android Studio software. 

Besides, on the moral side, I have learned to be more humble, willing to accept other's advice and polite to seek for help from others whenever I feel that situation is not under my control. I also make sure that I'm the one taking initiative to ask for consultation and request to meet up because we should not let other people to come to us as we are the one who are seeking for help, this is the basic respect for the people that are going to help us. We must also always remember to say "Thank You" whenever help or consultation is given as a sign of appreciation to the helper.

Well, that's all for this week! Continue to check on us on week 13 to see what will happen! See ya guys ^^.

No comments:

Post a Comment