Code covered by the BSD License  

Highlights from
Graph Digitzer

3.0

3.0 | 6 ratings Rate this file 28 Downloads (last 30 days) File Size: 48.98 KB File ID: #23317
image thumbnail

Graph Digitzer

by S. A. van der Wulp

 

17 Mar 2009 (Updated 18 Feb 2011)

Digitizer enables you to digitize a scanned or downloaded linear graph, with a set accuracy.

| Watch this File

File Information
Description

Digitizer is a GUI that enables you to digitize a scanned or downloaded linear graph. The output is stored as an ascii file.

Features:
Step 1 - Load image
Loads any image that can be handled by the imread command.
 
Step 2 - Calibrate the image:
While calibrating, the menus are enabled.
You can choose a maximum of 2 points on the graph.
The arrow keys on the keyboard will move the last entered point with small steps to accurately place your calibration points.
The input is cyclic for two points i.e. the third input will replace the first input etc.
To finish input press the 2nd mouse button, after which the numeric values of the chosen two points can be entered.
You can calibrate or recalibrate at any time when you are not using the input feature.
 
Step 3 - Start Input
During input, all menus will be disabled:
Mouse button 1: Add a new point
Mouse button 3: Removes the last point (only if you have three mouse buttons, button 3 is the center one)
Mouse button 2: Ends input
As long as the graph is not resetted, you can start and stop input at will, for example to change the accuracy or to recalibrate.

Preferences
Input accuracy: The input will snap to the rounded value as specified in the preferences.
During input, arrow keys will move the last point in steps according to the scale of the graph as defined in the preferences.

Step 4: Save data
The digitized data is stored in an ascii "Graphfilename.txt"

Example of output:
      Weight.jpg
       1.00000000,168.20000000
      31.00000000,241.20000000
      62.00000000,297.60000000
      93.00000000,344.70000000
     125.00000000,354.10000000
     152.00000000,351.80000000
     181.00000000,394.10000000
     216.00000000,372.90000000
     243.00000000,521.17650000
     276.00000000,568.23530000
 
 The digitzer REQUIRES round2 from with input
round2(value,decimal places) as provided here at the file exchange as File ID: #4261.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
round2

MATLAB release MATLAB 7.6 (R2008a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
18 Mar 2009 Wolfgang Schwanghart

It happens so often, that people - intentionally or unintentionally - hit the rating stars. The Mathworks should think about disabling self-ratings.

18 Mar 2009 S. A. van der Wulp

the stars got clicked unintentionally, funny that this is possible by the file author.
Its more of a help to get some feedback about the utility.
I would say, Just try the judge for one's self, whether its worth 5 or 0 stars or not, and comment.

18 Mar 2009 John D'Errico

I'll concede that there is a problem with self ratings. The author should never be allowed to rate their own work. As importantly, it should be possible to retract an errant mouse click. At this time, the only solution is to request that the website administrator remove such mis-clicks. A fix has been requested many times, certainly so by me.

So I won't hold the admittedly mistaken self-rating against this author as I write this review. In fact, (writing this before I look at the contents at all) if this submission merits a 5 rating in my opinion, I'll give it that.

FIrst, look at the help. As it is, it is useless, even though it is actually reasonably good help. How can something be reasonably good, yet still completely useless? See what happens when you use the help utility on digitizer.

>> help digitizer
  Digitizer GUI
  by: S.A. van der Wulp (March 2009)

This is all you see, not the reasonably detailed description that is actually included in the file. The problem is help only displays the first contiguous block of comments. The author has put a blank (no comment character at the beginning) line after his name. So help stops the output immediately, without returning the rest of the help as written.

As I said, it is useless as help for someone who will use this. I know, some will suggest that you just edit the file to look at the help. This is foolish, to force a potentially novice user to edit the file to read the help, since they may then make unintentional changes, corrupting the code. Just write your help correctly, with no blank lines and all is perfect.

Next, there is no useful H1 line. An H1 line is the very first line of the help block. It is used by lookfor to search for your file. What happens when your user forgets the name of this file next year when they need to use it again? How will they find it? Matlab provides the lookfor function, which does a keyword search on only the first comment line in the help block. So just add a single line of text that describes your function and includes the logical keywords that someone might search on.

Given all of that, next I tried to use this utility. I created a jpeg image of some plotted data, then loaded the file. Unfortunately, the help as written is not at all specific as to how to use this code. For example, I tried this

>> im = imread('test.jpg');
>> digitizer(im)
??? Error using ==> fileparts at 17
Input must be a row vector of characters.

Error in ==> digitizer at 55
    [pathstr,name,ext,versn] = fileparts(action);

Hmm. What happened? Here is the beginning of the help:

% Digitizer is a GUI that enables you to digitize a scanned or downloaded
% linear graph. % The output is stored as an ascii file.
%
% Step 1 - Load the image.

It tells me to load the image. But then it does not tell me how to get the loaded image into digitizer. Perhaps I'm supposed to do something else. But when I just call digitizer with no input arguments, it put up a blank set of axes. Good help would tell me what to expect.

A bit more fussing about, and I realize that I needed to use the load image menu item on the figure. So, I try that. Nope. The figure is still just a blank set of axes, not the just created jpeg.

So I can't make this code work. While the author must know the magic incantations to make it work, it is apparently useful only to the author.

Other problems? Why return the result as an ascii file? It is very easy to return a variable from a GUI. Why force the user to load an image? Allow them to provide the image as input to your function directly. Make your code friendly is you expect anyone else to be able to use it.

So, what should I rate this submission? It is not useless dreck, and the author has made an effort. But the file as is is useless. The help needs improvement. It needs an H1 line. It needs a better interface. I did not look carefully at the code to look for error checking, but given the poor result above, there appears to be no error checking. A quick scan ofthe code showed some internal comments, enough to follow what was happening. All of these problems are quite fixable with some time invested.

I'll be charitable and give it 2 stars.

29 Jun 2009 Markthomas  
05 Nov 2009 Adam A

Works well, but user-friendliness could be improved. Explaining the settings available within the 'preferences' would be helpful.

Thanks for making this available.

24 Nov 2009 Jon

This is exactly what I was looking for. Short of actually using image recognition to 'find' the graph line, this is the next best thing. It took 1/2 an hour of trial-and-error but otherwise it is a simple and effective tool.

12 Aug 2010 David

1. Some versions have line 171/172 as
    imshow(ud.image); hold on;
This MUST be changed to
    image(ud.image); hold on;
2."mouse button 2" = scroll wheel (on my machine.)
3. Be sure to set "step sizes" and "accuracies" in the Preferences
     window before you start. (Default values are useless.)
Thanks to Jon!!

13 Dec 2011 Aaron  
Please login to add a comment or rating.
Updates
17 Mar 2009

Made a few corrections that enhances user friendlyness.

18 Mar 2009

Added an example

19 Mar 2009

Help function problem solved

19 Mar 2009

updated help function

18 Feb 2011

Update Feb 18th 2011 :
Replaced imshow for image command
GUI will ask to check preferences after image calibration

Tag Activity for this File
Tag Applied By Date/Time
digitization S. A. van der Wulp 17 Mar 2009 15:18:20
scanned graph S. A. van der Wulp 17 Mar 2009 15:18:20
ginput S. A. van der Wulp 17 Mar 2009 15:18:20
digitize S. A. van der Wulp 17 Mar 2009 15:18:20
paper S. A. van der Wulp 17 Mar 2009 15:18:20
round2 S. A. van der Wulp 17 Mar 2009 16:26:20
digitization Nadia 30 Mar 2010 16:57:45
extract Jose Ercolino 20 May 2010 20:32:05
digitize Jose Ercolino 20 May 2010 20:32:05
scan Jose Ercolino 26 May 2010 14:11:19
georeference S. A. van der Wulp 18 Feb 2011 10:13:24
digitization Neema 11 Feb 2012 17:50:15

Contact us at files@mathworks.com