Journal:
5.6.07 This is it - the last entry and update to my website. The
presentation and defense are over, and went relatively well, but not perfectly.
It's to be expected that the project wasn't at 100% completion and success, and
it still isn't, but I didn't give up after those mile markers and major
deadlines. Over the past week, I've used what little free time I could manage
to continue working on this project to put together a better interface for an
everyday user that I can be a bit more proud of. You can find this updated
program on the Explore My Project page
with the other smaller, more specialized programs. This new interface offers a
menu of options for the user to choose (infinitely), and also allows the user
to input a file name for an image to open. It is definitely something I had
wanted to do earlier, but I just hadn't budgeted my time well enough to
complete it before the presentation and/or defense. That was a fault of my own
as well as a result of getting caught up in the issue of noise in my images for
so long. It may be too little too late, but I am much more satisfied with
myself and with this project being able to offer this program as part of the
finished product. I've also continued to look at different image formats and
sizes, and I have yet to fully understand how the IplImage structure deals with
the various formats and padding or alignment information. I have tested my
program(s) on various formats including .png, .gif., .bmp, and .jpg. I have
found success with various .jpg images including various sizes that are not all
multiples of 4 (for the word size to avoid padding). However, when I have tried
other image formats, or tried converting other image formats to a .jpg with an
exterior program, I have not had the same luck. When the Bresenham algorithm
resizes the image, the display becomes distorted. It is angled so I believe it
is due to an alignment or padding issue, but I have not been able to account
for it. I have tried testing the image width as well as playing with the
widthStep (used in alignment), but have been unsuccessful. I sincerely hope
that someone can look into this in the future because it is unfortunate that my
program will not work on 100% of images tried and tested. If anyone has a
suggestion or answer, I am open to ideas!
4.23.07 Hallelujah!! The night before I present, I have an epiphany! I
no longer have noise showing up in my scaled image. It makes life wonderful and
extensions possible! I have not figured it out with converting the data to ints
and back to bytes, but the problem has been solved! (Finally, right?) Solution:
split the image into three single-channel images (red, blue, and green) and
scale each separately then remerge. The problem I was having with this solution
before was the average function; when I typecast the data as unsigned chars
(rather than unsigned ints), there are no longer any overflow problems. Chars
are weird animals in C and C++. Referencing the data as unsigned chars left the
bits of data alone, but the typecasting (indirectly from the function call)
altered the data before averaging and overflow was occurring. But not anymore!
It's a big relief, and now I'm actually quite excited to present tomorrow. I promise to update the rest of this website as soon as the
presentation itself is over. Check back soon for MANY updates on the Explore
page and possibly for added pages.
4.22.07 (2nd entry) I found something exciting with OpenCV tonight! I found a
function where I could attach a "scroll bar" of sorts to one of my windows and
have it automatically updating a value. I used this to adjust my scale that I
am scaling the image by, as opposed to having the user press 1 or 2 to increase
or decrease. It is MUCH more user friendly and looks great! While I still
haven't been able to determine the source of my noise problems or conversion
issues, I'm excited to have been able to add another nice feature to the
interface!
4.22.07 Things should be winding down now, so close to the end of the
semester, but it seems that I just can't get past the struggle of the extra
noise in my images. I have tried a variety of techniques for converting the
array of bytes (chars) to ints and back as well as for averaging, and I just
cannot get over this hurdle. I'm scared since I have to present the project in
less than two days (1:00 on 4.24!), but I guess I'll just have to do my best
and explain my struggles. If I split up the three channel image into three separate one
channel images (blue, green, and red), I can get the image to scale pretty
well, but I see the noise as a result. If I don't split and re-merge the image,
I try to convert the data from an array of bytes as B,G,R,B,G,R,B,G,... to an
array of ints as 0BGR,0BGR,0BGR,... where a single int contains all the
information for one pixel (and four bits set to zero for padding). When I use
this technique, my image turns blue. I have tried a variety of methods on the
conversion as well as the averaging, and I haven't been able to determine why
only the blue is showing up. It must be in the way the data is stored, but I
thought I had that figured out... clearly I'm missing something here.
For better news, I have been able to take an image, scale it
using Bresenham, and rescale it back to the original size using Bresenham. It
seems that it would work pretty well except for the issue of the added noise in
the image. We see double the noise when the algorithm is run twice on the image
(once to scale, and another to return to the original size). I've also noted
that returning to the original is a pretty decent image when the original pass
enlarges the image. If the first pass of Bresenham scales the image down,
especially with a very small scale such as .5, returning to the original image
is much more difficult because pixel information from the original was lost or
dropped when the image was scaled down. This seems pretty natural, but at least
when returning from an enlarged image, Bresenham appears to do pretty well. Now
I should figure out a mathematical way to determine how "nice" of a job it
really does. I'm thinking about calculating the average difference between
pixel values of the two images, but the noise that shows up will distort this
calculation. It would sure be nice to figure out how to get rid of that.
<sigh>
Well...time to get back to experimenting with conversion and
averages again. Hope to see everyone Tuesday for the presentations!
4.15.07 Well, I have the Bresenham algorithm working to scale images,
but I'm still having some trouble with noise showing up when I use the
Bresenham algorithm to scale the image. I still think it is in the way I am
averaging the pixel values, but I'm not sure how to "fix" the problem. I'm
still working on that. I also have a feature added into the program that allows
a user to adjust the scale by which the image is resized (currently by pressing
1 to shrink or 2 to enlarge). I hope to change this feature to use the arrow
keys because it seems more logical and user-friendly.
I also want to add a way to save and open videos as opposed to
just using the webcam. I believe that the OpenCV platform has some built-in
functionality for this. I just need to spend some time searching and browsing
the online manual for what will work for me and do what I want to do. If there
isn't anything built-in, I will have a lot more work ahead of me so hopefully
it's really there like I believe it is! I'm also still wondering about working
with still images as opposed to streaming video. I struggled with it the few
times I tried to play around with still images in the OpenCV platform, so I
will have to keep looking for a better way to do that and what format is
necessary to make that work well with my program. Looking forward to finalizing some "fun" aspects of this
project and moving forward toward graduation! Kind of scared, nervous, excited,
anxious, and everything else all at once! What a busy time!
4.4.07 Feeling more relaxed today. After meeting with Dr. Pankratz, I
made more progress on the image processing. I was able to get the image to
resize with OpenCV function cvResize and display correctly. It can shrink or
magnify the image which is an improvement. I was having trouble with this
before with creating the header values (since it uses an IplImage format) and
allocating enough memory to store the entire image (it worked before to shrink
because it just didn't use all of the space). It was a big relief to see that
working. Now my concerns are turning toward how I allow the user to
change the scale of the resized image on the fly. I want to create a tool
(probably a type of scrollbar) for the user to adjust the scale as the video
continues to stream. Another concern I have is why the Bresenham algorithm is
giving "weird" data back and the image is distorted. I should look more into
how the data is stored in the IplImage format. Making progress!
4.1.07 Happy April Fool's Day! I have good news, and it isn't an
April Fool's joke! After working with John and Ted and playing around on my
own, I was able to get something working in the OpenCV platform. It might be
simple, but it can capture frames from the webcam and display them, as well as
an altered copy of the image in another window. I found some a resizing
function within the OpenCV platform and used that to test how the resizing
would work and showed the resized image in the second window. I am now working
on getting the Bresenham algorithm to work in that platform, and I think I'm
almost there! There are just a few small changes before I should have something
up and running to test the algorithm. The next step would be to find out how to open a still image
in that platform so I can test and compare quality of images (without trying to
keep up with the speed of the camera's frame capture). With this, I want to
find other alogrithms to use in the comparison, as well as ways to vary the
existing Bresenham algorithm. I also need to create a method for the user to
zoom in and out in real-time while watching the streaming video.
3.27.07 I had a great spring break. I received a job offer, and I'm
excited to be moving forward with my future. I have decided to wait for Grad
School for now; it isn't the right time for me. As for my project, I did take
some time away from it because I felt burnt out, and I had been going in
circles not getting anywhere. Dr. Pankratz and I met just before break to work
on the DLL process. We were successful in creating a mini DLL that worked with
a small sample VB program; however, I was not as lucky when attempting to
translate this process to the actual project. I also started working with John Moss and Ted Trisco (since we
returned from break) on using the OpenCV platform for image processing in stead
of the VB interface I had been working with. I have a LOT of work to do with
this, but they have been very helpful and shown me a lot of information about
where to look. I think this will take a lot of pressure off of me as far as
coding is concerned because OpenCV is all done in C. My algorithms and comfort
zone are in C++ so they should work together easily. I'm looking forward to
getting the OpenCV platform to work for me, but I know it will take some time
and work on my part. I need to set more time aside to work on this project.
Motivation is an issue for me right now so I am going to try writing it into my
schedule. Hopefully I can get back on track soon!
3.14.07 Well, I know it's been awhile. I have been struggling with a
few things, both personal and project-related. As for the project, I've been
working on organizing a tutorial or description on Bresenham and am making
progress. My hope is to go through at least a portion of it during my
walkthrough tomorrow. The other struggle has been creating a DLL for my C++
functions to be called from the VB program. I have tried a few different ways
of creating them, asked for help from those more experienced with it, and am
still stuck not quite getting it done. I will be meeting with Dr. Pankratz
again tomorrow, so hopefully we can make more progress on this. This is a big
road block for me since I find it difficult to test algorithms, compare
variations, and see if they work in general with the picture data without using
the real algorithms. Once this is cleared up, progress should be steadier. Look
forward to more frequent (or at least more consistent) updates on my webpage.
2.25.07 Today I worked a bit more with VB 6.0 and my user interface. I
made progress with learning how to use different controls. I still need some
help with how to share data between the controls. I have asked a classmate for
help, and if that turns out to be unproductive, I will ask Mr. Blahnik for more
VB tutoring. I also wrote a short function in my C++ program for eventual use
in converting the data from an array that I will get from the webcam to an
array of "pixel" data that can be used with Riemersma's algorithms that I now
have working in C++ 6.0, currently using arrays of ints. My next steps are to
learn a little more about VB, make a list of questions or options to explore
with the algorithms, learn how to save the scaled image to a file for later
use, and start writing a tutorial on Bresenham (as a start for my
presentation). There's a lot to do!
2.22.07
Today we had an epiphany! Well, it was really more of Dr. McVey teaching Dr.
Pankratz and me about template functions. Using the template function given in
DDJ, May 2002, I was able to quickly and easily implement the algorithms (one-
and two-dimensional) on an array of ints. This template function will make the
transition from ints to pixels (real image data) much easier to deal with. I
have also added a basic design of my user interface to the "Explore My Project"
section with some description of how it will look and work. This is a work in
progress, but the next step is to begin the implementation of this. Now that I
have a working algorithm as well, it should be a much smoother and quicker
transition into something visual. I hope to get some test data for the
two-dimensional algorithm posted soon and before long, some actual image
scaling!
2.14.07 I am a bit frustrated with my progress this week. I am
struggling to model Listing Three (the two-dimensional algorithm) in a program
that will allow me to test it. I am going back to square one and starting with
more of a general design. I hope this will help me understand the algorithm
better. I plan to finish this before the end of the week. The next step after
that is to try to use the algorithms to start adjusting data in the array of
actual picture data in my other program that reads the picture and re-displays
it. That is my goal for next week. Tomorrow I will be at WorkForce 2007 at
Marquette University. I hope to meet some potential employers and make contacts
in areas that I may be interested in. I will also be checking out the Marquette
campus since I hope to be accepted to their Graduate School. It should be a fun
day. I will get back to work on the project on Friday.
2.7.07 Dr. Pankratz, Dr. McVey, and I had another successful meeting
this morning. After our discussion, we decided that I will add more output to
my test programs to help guide the user (mostly Dr. Pankratz, Dr. McVey, and
myself, but also anyone who chooses to play around with the algorithms in the
future). These test programs will be made available on my website by the end of
next week, and updated periodically throughout the remainder of the semester.
After working with Mr. Blahnik and practicing with VB 6.0, with a little help
from Ted, I was able to get a program to load a picture, read the pixel data
into a one-dimensional array, and re-display it in another picture box. This
program will also be made available with the test programs when it is further
updated next week. I am feeling much more confident in my progress after today.
I am hopeful for more success next week!
2.6.07 My meeting with Mr. Blahnik this morning was very productive.
I am going to load a picture into a picture box and grab the pixels one at a
time to put in an array because it is just a one-time thing; the timing
shouldn't matter at this point because we are processing a still image. From
there the array will "look like" the array I will eventually get from a webcam
for a frame. This will allow me to write code that will process a still image
that will transfer nicely to processing streaming video. Mr. Blahnik and I
figured out how the colors are stored in the array and he showed me how to
manipulate them and re-display the picture. I feel like I'm getting somewhere!
Now I just have to put all the code together to see it in action and actually
working for me.
1.31.07 I met with Dr. Pankratz and Dr. McVey this morning to go over
a game plan for the next week. I will be looking at Listing One and Two a bit
closer to try to understand how they relate to Bresenham by graphing the
results. Next week we will meet again to discuss the two-dimensional algorithm
of Listing Three. I look forward to this because I haven’t been able to follow
it so far. I will continue to study it and try examples, but hopefully we can
get farther when we work together on it next week.
1.30.07 I met with Dr. Pankratz today to discuss the one-dimensional
algorithms proposed by Thiadmer Riemersma in his article in Dr. Dobb's Journal.
I feel I have a better understanding of how they work. My plan is to try to
write some mini-programs to test the algorithms so I can see them in action to
get an even better understanding of the process. I am also going to look at the
two-dimensional algorithm and start looking for how to load an image from a
file so I can get started on that portion of the project.
1.25.07 Mr. Blahnik explained how to use the Logitech 4000/5000
webcams today. He showed us his software and how to use it to capture frames
and streaming video. It was useful to learn how the raw data comes to us from
the camera. My plan is to study his code to learn a little VB as well as how to
manipulate a still frame (to which I can later add a loop to handle streaming
video). I also worked on my website design and my personal philosophy and
career path statement.
1.23.07 Today I met with Dr. Pankratz to receive my project
description. I am excited and nervous about the project: image scaling in
real-time. My first step is to read the articles about the smooth Bresenham
nearest neighbor interpolation method in Dr. Dobb’s Journal and understand the
algorithm. I will meet with Dr. Pankratz and Dr. McVey next week to go over the
algorithm and an example to be sure we all understand the process.