Wednesday, July 12, 2017

ImageJ

Jim, a friend reading my blog, suggest I try out ImageJ for image processing. I had never heard of this program before and needed a few days before I could find the time to check it out. And boy am I glad I did.


ImageJ is a Java app that was developed by the National Institute of Health (the project developer was Wayne Rasband) to perform image processing. You can download the application from its location on the NIH Website.


After installing it n my laptop at NNU, I just click the ij executable file to get ImageJ's simple to use menu to pop up.


That's right, the ImageJ window is pretty small. Just a simple menu, really. 


It just took six total clicks to split a color image into its three channels. First, I had to open the image with File, Open, and then click on the image I wanted. After opening the image, I then used 3 more clicks to split the color image into its three RGB channels. I clicked on Image, Color, and Split Channels. The original color disappeared and was replaced with three images, one for each color.


I like that ImageJ automatically gives each image window a name that includes its color layer. 
Next I tested the subtraction of images. Subtracting images can be important for isolating cherries in an image of a cherry tree, because green leaves are bright in both red and green but cherries are only bright in red. Subtracting images requires the use of the Paste Control application. You'll find it under the Edit option.


The Paste Control Application showing some of its paste options in a pull down menu.
One color layer is subtracted from a second one first making sure that the Subtract option in Paste Control is selected. Then click on the color layer to be subtracted and then clicking Edit and Copy in ImageJ. Then click the second color layer, the one you want to subtract the first layer from, and then click Edit and Paste. Note that the order of the subtraction is important. Subtracting the red layer from the green layer does not produce the same result as subtracting the green layer from the red layer.


The red color was on the left, but it's been converted in the red layer minus the green layer with just a few clicks. 
An image can be segmented with ImageJ by first finding a global threshold. Setting a threshold is an interactive process, in that you can shift two sliders to set the high and low limits, if you desire. You can also let ImageJ set the boundaries. So click Image, Adjust, Threshold. The Threshold application opens up and the clicked layer suddenly appears as a segmented image with the default threshold values.



The Threshold application pops up in its default setting. Notice the modified red layer is displayed in the current threshold value.
You can now adjust the sliders in the Threshold application to set what range of pixel values to threshold with. It's interactive, so as you adjust the left and right limits, the image displays what it will look like under that threshold setting.


After applying a threshold and segmenting a layer, you can detect the edges of the image by clicking Process and then Find Edges.


These are the edges of the segmented layer displayed above.
Images, or layers, can be merged together to create a new color image. This is accomplished by clicking Image, Color, Merge Channels... Under the Merge Channels application, select which image to make which color and then click Okay.


A three color image of the edges detected in the original color image. I don't know if this is particularly useful, but it is pretty cool looking.
Counting the number of objects in an image is more important than creating pretty images of edges. So that's what I'm working on next. More about that soon (I hope).

Monday, July 10, 2017

UAVSonde Measurements of Surface and Air Temperature Multiople Times Throughout the Day

I fly my UAVSonde flights once per week, usually on the weekend, to gather temperature, pressure, and relative humidity once a day. I began to wonder how these conditions changed throughout the day. I know the ground temperature increases until around 4:00 PM before it begins falling again. But does this hold true 400 feet above the ground? I am investigating conditions at an altitude of 400 feet because that's how high my drone can legally fly.


So I ran the same sensors and collected data the same way five times on Sunday, July 9th. Now it was stinking hot on Sunday. My part of Idaho broke a temperature record with highs above 100 degrees. Also, the quadcopter lifted off from my driveway. That driveway was extra toasty. It was obviously the case if you looked at the driveway and the neighboring lawn with the thermal imager. Anyway, once I completed  the first flight, I was committed to repeating the rest of the flights in the same manner. Below are the results I got from the flights. The time is in 24 hour time.


 


First notes,  GPS receivers have errors in their measurements, so I needed to take an average ground elevation and air altitude for these charts. Second, the pressure sensor may be effected by the temperature. Third, the surface temperature is taken right above the cement driveway.


The first chart shows that the ground temperature did indeed increase throughout the day and began cooling at around 3:00 PM. It then spiked in temperature later in the evening. The air temperature at 400 feet AGL lagged behind the surface temperature by 7 to 10 degrees before cooling off by 7:00 PM.


The second chart shows the air pressure at 400 feet AGL is always lower than the surface pressure, but that amount of difference changes throughout the day. Also that the surface pressure spiked at around 7:00 PM. Meanwhile, the air pressure at 400 feet AGL spiked earlier at around 2:30 PM.


I really need to repeat this experiment again when it's not quite so hot. I'll also experiment with calibrating the pressure sensor with temperature in order to remove this possible effect. Finally, I'll launch the quadcopter from the lawn.


It's said you can look up lots of information on the Internet these days. It's probably true that someone already knows how the temperature of the air several hundred feet above the ground changes throughout the day. But I say why look it up when you could find out for your self. In the process, you learn more STEM and the importance of measurement. And you'll develop more skills and hone the ones you already have. An that's not a bad way to spend a Sunday afternoon.  

Flame Wheel Quadcopter

Part of my summer research is trying to find a good drone for my Introduction to Engineering class next year. I feel this list of requirements is suitable for this task.


The drone is affordable
The drone is student-built (this way students get a better idea of how it works)
The drone is flexible in its control system
The drone can carry a payload


Dr. Bulanaon suggested I look into the DJI Flame Wheel as a class drone. So we ordered one and I began assembling it after it arrived. The Flame Wheel was the second drone I had seen, so it was nice to have a change to work with it.




Open the box and you'll find bags of drone parts.
I needed to download the directions before I could begin assembling the Flame Wheel.  I also needed to watch a video to fill in the assembly steps not covered in the online directions. But after a couple of hours or assembly, disassembly, and reassembly, I ended up with this fine product.


Assembled and looking for an RC receiver.


The Flame Wheel is a generic drone, it's designed for any number of RC systems and batteries. So after a little more investigation, I've developed the following shopping list.


FrSky RX8R 8/16 channel, S Bus receiver
FrSky Taranis Q X7 16 channel, 2.4 GHz ACCST transmitter
Storm 3s 5,500 mAh LiPo (with XT60 connector)


The 16 channel RC control system will allow remote pilots to control the flight of their drone and the gimbal carrying the drone's imagining system. However, there will be an extensive setup procedure to unite the RC control system to the flight controller (NAZA Lite) used by the Flame Wheel. I'll update my blog with the procedure I went through, so keep your eyes opened.


The drone will be Bind-n-Fly, meaning the receiver will only respond to commands from the transmitter its bound to. This way, many students can fly their drones simultaneously without interfering with each other. Of course, with multiple drones airborne, students will need to work in teams of pilots and visual observers for safety. Otherwise, I think my students are really going to like the Flame Wheel. I know their teacher is.



Sunday, July 9, 2017

Sunspot AR2665

I read this morning in my email from Space Weather that the sun was rotating a new sunspot towards Earth. After my success with photographing Daphnia through a microscope, I decided to attempt the same thing with my 90 mm cataoptric.

The sun magnified 20 power as seen through a cellphone camera. The sun is bright enough with even the solar filter that a less than steady hand could get this image.


Sunspot AR2665 is nearly the size of Jupiter, which is 11 times larger than Earth. The sunspot has produced an M-class solar flare and a radio blackout over Australia and Asia. We might see coronal mass ejections from this sunspot, which increases our chances of seeing aurora. Keep your eyes and ears open.

UAVSonde Data for NearSys Station, 9 July 2017

UAVSonde data were collected at 7:30 AM. Here are the data.

Altitude: 2,240 feet
Temperature: 100 *F
Relative Humidity: NA
Pressure: 916.4 mb

Altitude: 2,680 feet
Temperature: 93 *F
Relative Humidity: NA
Pressure: 914.6 mb

The UAV launches from the cement drive way, so the ground temperature is higher than expected.

Thursday, July 6, 2017

Using Octave in Place of Matlab

Matlab, from MathWorks is a very powerful program designed to perform technical computing with matrix-based mathematics (which includes arrays). It's used extensively by mathematicians, scientists, and engineers to analyze their data. I'm using now at NNU to analyze images of fruit trees recorded by drones and from the ground.


Checking the MathWorks website, I see there's a home edition available for $149. Additional Add-ons at $45 each allow you to increase the functionality of Matlab and even perform simulations (using Simulink).  The home edition webpage contains links on how Matlab was used for things like an Arduino-based weather station. And at $145, the cost really isn't too much when you consider how much we pay for other productivity software.


I'm however, looking into using a program named Octave to perform the same analysis that I am using Matlab do to. The reason I'm testing Octave is that it's freeware under the GNU General Public License. Using Octave in place of Matlab let's my classroom analyze drone-recorded images while saving money. My students will  then be able to install the freeware at home and complete their homework at their leisure (and I hope take up an interest in mathematical computing).


You can download the Window's version of Octave  and then install it on as may PCs or laptops as needed. I found that Octave, like Matlab does not have an image package built in. So you'll also need to download the Image Package separately and then install it. Loading the Image Package is done from the Octave Command Window by typing the following command,


pkg load image-2.6.1.tar.gz


Note that every add-on package is installed using the same syntax. In the case above, the Image Package is a compressed file called image and its version number is 2.6.1. The only issue I'm less than happy about how Octave doesn't generate a message after the successful completion of a package install. So I was uncertain if the install was complete or of I needed to wait a while longer. However, Octave will generate an error message if the install fails.


You might want to install multiple packages into Octave, so repeat the above command with every package. If you lose track of the installed packages, type the command below into the Command Window.


pkg list  


Octave generates a message listing every package installed as shown below.





After installation, you'll need to load the Image Package every time you start Octave. This is done in the Command Window by typing the following command,


pkg load image


Well, that's all you need to do to install Octave and its Image Package on a PC or laptop. I'll keep testing Octave to verify it does everything my classroom needs to analyze images from their drones next year. The 2017-2018 school year promises to be very exciting and I think my engineering students are going to love it.








             

Tuesday, July 4, 2017

Photopolarimeter Data for July 3rd

I decided to give the photopolarimeter another test this week, now that we're experiencing summer weather. It's the same instrument I used for February 12th's blog entry http://nearsys.blogspot.com/2017/02/a-modification-to-balloonsat-recording.html?m=1, but modified to see if it could also detect polarization in blue or violet light.

To reach the shorter wavelengths, I taped a second polarizing filter to the first. I was hoping the two filters would act like a single filter with more narrowly spaced lines of polarization. It appears that this did help bring out polarization differences in the blue, but not violet to ultraviolet.

Here are the results for your pleasure. As you'll see, I need to do some more measurements to see if my results from the 3rd are typical.

Sunlight intensity peaked between 3:00 and 4:00 PM for most light wavelengths. And you notice the effects the cloud had between 4:00 and 5:00 PM. However, it appears blue and violet/ultraviolet didn't get the message. They increased in intensity all the way to between 6:30 and 8:00 PM. 
The colors of the sky were brighter in the East-West direction from 12:30 to 4:30 PM and then brighter in the North-South direction from 5:00 to 8:00 PM. But unlike blue, their total intensity's did decrease after 3:30 PM.

The violet/ultraviolet wavelengths were an anomaly. The sky continued to get brighter in this portion of the spectrum until 6:30 PM. The clouds also had a smaller effect on the sky brightness in this region. Odd.