AguaClara / sensor_dev

The sensor development team's repo.
0 stars 6 forks source link

Programming [programming in C for the turbidity sensor and programming in Java for the mobile/website app] #4

Closed lois-lee closed 6 years ago

lois-lee commented 6 years ago

Preliminary coding for the turbidity sensor is finished, we just need to figure out a reliable relation and then test.

Coding for the mobile application is in the works. We are using OpenCV.

HannahSi commented 6 years ago

I've installed OpenCV for Java on my computer and am having trouble adding the library's "external JAR" to Eclipse. I can ask my (Java) CS instructor for guidance. I was hoping to write a basic program for computing average grayscale to test the precision of the endoscope images. If we're testing this week, we may have to find another temporary method of computing this.

HannahSi commented 6 years ago

The OpenCV library is now working in Eclipse! I had to use a soft link for the library directory since it had hidden folders. Now looking into ways to collect and display camera feedback without involving too much third party software. Note to self: remember the links on Confluence about connecting to cameras and visual processing.

HannahSi commented 6 years ago

Just committed Java code for viewing the endoscope video in a computer and obtaining its camera settings. I tried to modify certain settings so that we can hold the gain and exposure constant, but so far it has been unsuccessful. Maybe it's a deficiency of the Java OpenCV library, maybe I need to use another part of it.

HannahSi commented 6 years ago

It seems like OpenCV can't change the camera parameters for this USB camera (perhaps because the camera is not advanced enough; it also doesn't work with my computer's built-in webcam). However, when I search "Java set camera parameters", there seems to be more documentation for doing so with the Java Android libraries. So maybe we should try figuring it out directly through app programming? Also, I wrote some code that averages the light intensity value of every pixel in the camera image. Next step is to see how sensitive it is to small spots of light against a black background (if it's not sensitive enough we could probably square/exponentiate the values).

HannahSi commented 6 years ago

Came across this error while running the endoscope code: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Width (0) and height (0) must be > 0. It seems there are two cases in which this occurs:

  1. The camera could not be found. This should be accompanied by an error at the very beginning saying OpenCV: out device of bound (0-0): 1 / OpenCV: camera failed to properly initialize!. Since I could see that my computer itself could detect the USB camera ( > About This Mac > System Report > USB), I restarted my computer and the problem was resolved (mostly, see next case).
  2. The error also occurs if the endoscope image is completely black. We may not be able to achieve full blackness with the LEDs on, but if this is an issue hopefully we can correct it programmatically.