Julia Burns Summer 2011

From CSclasswiki
Revision as of 10:37, 6 June 2011 by Jburns (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

5/16/11

First day of the project- had initial background meeting with Nick and discussed options for the project. I need to learn to program in MATLAB because I have no experience with it, so I will spend the first week(~?) experimenting and building competency. At that point ideally I will have a better understanding of the code behind the character recognition algorithm, so I can pick a direction for the project. Some possibilities we discussed were 1) adding a separate channel to recognize space around a character - essentially tracking blobs of "negative ink" instead of ink, and 2) joining an existing (actually, soon-to-exist) project involving expanding the algorithm to Arabic letters. We also talked about Matlab basics and then I spent the day trying to ground myself in the basics of Matlab, with reference to the first assignment from CSC 370. Matlab is a little bit tricky so far; everything seems straightforward enough but it's all a little bit different than I'm used to. It's weird that the arrays are 1-indexed, but I can see how it will all hang together once I get further. The 1-indexing made more sense when I was experimenting with image arrays as well. I tried to do everything thoroughly and make sure I understood it well so that I don't trip up later because I missed something basic.

5/17/11

Started looking through the demoSkc.m code, since I find the best way to understand a language is to look at some examples of working code. Lost some hours because I was missing files the code needs to run, and the 2010 version of Matlab was apparently not compatible with the Microsoft Visual C++ compiler, or at least couldn't find it. So I had to upgrade Matlab, a process which was slowed by accidentally downloading the 32-bit version and some site downtime on the part of Mathworks. When I finally got it working I ran the first portion of the code (the first few cells) several times to remind myself what it does, then looked quickly through all of it to get a sense of what happens where, then began looking through line by line from the beginning. I worked my way through the first cell (with a lot of use of F1 for help) and while I'm not completely comfortable with it, I understand most of what it does (if not totally how it works) and want to look more deeply into the individual functions tomorrow.

5/18/11

Sick day :(

5/19/11

Noticed that demoSkc.m won't run past the 2nd cell. There seems to be a problem with the function local2dMinima, which returns an x and a y as output, but is expected to return a third value as well. I think I might have an old version of the function. I'm not going to focus on that right now though, since I'm only looking at the first cell. I looked closely at all the functions used, including the ones to set up the window, but especially selectLetters.m traceSkc.m. I also checked out psdtExperiments. Despite its initial weirdness Matlab does look a lot like the programming that I'm used to and I think I'm ready to start coding in it, though I won't be proficient for a while.

5/20/11

Project: Code a utility in which the user adds points to an image, categorized under different labels. Should display the list of labels and user can click to show the points for that label. Input: image (page), list of labels (optional), partial labeling (optional). Output: image, labelling. Struct containing x, y, label (index?), page? Currently building off of selectLetters.m.

5/23/11

Working on the labeling utility: examined selectLetters.m in detail and stripped out everything I can't use, including everything after the polygon selection. Also got rid of the lines between points. Then read through the help pages for plot, title, text, etc. in detail.

5/24/11

Added text entry, although it isn't working together with the point selection yet. There is a problem where the screen flashes as I type to the figure window, I think because the command line is also registering the keystrokes and taking the focus momentarily. Also if I type too quickly, the figure window closes altogether but the program doesn't end; I have needed to restart MATLAB several times for this reason.

--> I suggest using the inputdlg function for text input. -NRH

5/25/11

Integrated the keyboard input label entry with the point selection, although it is still flashing because I haven't looked at inputdlg. But now the users can type a label and it will be added to the label array, and points are correctly associated with the label in the i_cell cell array. Don't have the return working yet.

5/26/11

Exploring dialog box options. I definitely need one for the label input (inputdlg) and one to select previous labels (also inputdlg? Or maybe I don't need a dialog at all for this, and can just put it in the main switch). I will also need a help dialog, since the current help is via command line. I am having some trouble with that hiding behind the main figure window, though. I think this is because the helpdlg is 'non-modal', meaning users can interact with other windows first. But the only built in modal dialogs are things like errordlg and inputdlg, which aren't what I want. I could just use dialog(), but then I have to specify every parameter; there must be an easier way.

5/27/11

Got inputdlg working, it's a much better solution for keyboard input than reading each character individually. Figured out the help dialog, I'm using a message dialog and setting it to modal. However, the message dialog doesn't seem to respect \n as the newline character. Also figured out the return, I'm returning a struct containing xx (array of all xs), yy (array of all ys), i_cell (array of each point's label's index), and labels, which is a cell array of the label strings. I also debugged the main loop, there were some issues. Added handling mechanisms so that an empty label will never get entered, and no points can be entered until there is a current label set. I still need to fix it so the user can't enter the same label twice- can't figure out how to test to see if a string is in an array.

5/30/11

I got kind of confused with the structs and arrays I was returning; I was having trouble visualizing them and using them from the command line. I experimented with the "variable editor" which made it a lot easier to see what's going on Nick showed me a better way to do the return: return one struct containing a struct for each point (each point contains an x, a y, and a label index) and also the array of labels. I had forgotten Matlab supports multiple returns. I also added the ability to switch back to a previous label, but from the command line - haven't built it into the interface yet.

5/31/11

Got all the current capabilities built into the interface, except the "switch labels" one. More debugging, the code I wrote at the beginning is not so good because I didn't really know what was going on. Nick pointed out that if the user clicks a point before entering a label, it would be better to pop up the label dialog instead of just ignoring it. However, I didn't want to repeat all that code, so I had to figure out subfunctions and global variables. Now all the code to get a new label, set it to be the current label, and update the counters and label array, is in one subfunction so that I can just call it in both places. I had to make all the counters and the label array global to do that. Matlab didn't seem to want me to return a global variable, so I had to work around that by setting a different variable to be equal to the global 'labels' at the end of each loop.

6/1/11

Struggled some more with dialogs trying to get the switch labels capability working. I was going to use inputdlg again and have the prompt be a list of all the labels; the user would type the index of the label they want. But inputdlg has the same problem as the message dialog, where it doesn't respect newline characters. I figured out that for the message dialog, I can put each line in as a separate argument and that will work. But for inputdlg, each separate argument gets its own input field, which isn't what I want. At this point Nick pointed out that there is a separate function called listdlg which lets the user choose an item from a dropdown list, which is much better because then I don't have to handle any bad input. So now the switch labels capability is working. I also got it to reject labels that have already been used (using ismember()) and added two modes: one where only the points for the current label are visible, and one where all points are visible and the current points are highlighted.

Comment from Nick: using globals for this seems unnecessary. Let's go over this together and see if we can figure out a better way.

6/2/11

Fixed a bug where clicking "ok" on the helpscreen also registered on the figure window, causing a point to be created or a label prompt to appear. Still not sure why this happened for the helpscreen but not for any of the other dialogs. Nick informed me I could get rid of the global variables since I was using nested functions, so I did that. Restricted point input to within the image. Struggling to make it load the same format it returns.

6/3/11

Fixed the input/output so that labelings can be saved. Then spent the day working on a system for deleting entire labels which I ultimately had to scrap. Adding the ability to delete labels only really makes sense if you can delete several/many at a time - I envision it for a situation where there is a label for each letter of the alphabet. However, that's very hard to implement because everything depends on the index of the label in the list of label's- that's how all the references to a point's label are stored. So if I delete many labels at once I need to update those indices in a complicated way. I don't think it's worth the effort it would take. Working on making it take multiple images.