Activity 2: Practical Image Processing II
Today’s activity involved the basics on digitally extracting values from hand-drawn plots. The image I used is
shown in Fig. 1. For the pixel coordinate extraction, I used Photoshop, and
for everything else, Python’s matplotlib
module.
In order to determine the pixel-to-centimeter conversion factor, I first tabulated the pixel coordinates of the x and y-axis units. I noticed that the ticks were not equidistant, and that the x and y axes were not of the same scale, so I performed linear regression by plotting the pixel vs cm values separately for both axes. The calibration curves can then be obtained from Fig. 2. The conversion factors obtained were:
Using these conversion factors, it’s simply a matter of plugging in pixel values into (1) or (2) in order to extract the real cm units. In Fig. 1, we can see three elements: a bell curve, a sigmoid-like curve, and an apparently straight line (it actually curves ever so slightly upward). To extract the values of the bell curve, I simply took the pixel location of the center of the round markers. For the sigmoid, I sampled at points on the line immediately adjacent to the hollow markers. For the dashed line, I sampled at each x-axis unit.
After performing the necessary conversions, I could then plot my extracted curves while overlaying original image all in
one go. Because matplotlib
’s imshow
function displays images in terms of pixels, I had to specify its extent
and
aspect
parameters. To do this, I have to determine the length and width of the image as a whole, i.e., I have to
extend the axes of the original plot so that it encompasses the image as a whole. This task is already trivial since I
have already calculated conversion factors earlier. The end product is shown in Fig. 3.
Even though it was suggested to use Paint, GIMP, and/or a spreadsheet software, I opted to use Photoshop and matplotlib since I have been accustomed to using them and I believe I can work faster and more efficiently by using them. Personally, I find using Excel cumbersome and makalat tignan for data processing, and I am especially not fond of the appearance of its plots.
References
K. Kadota, H. Matsuoka, H. J. Ramos, S. Miyake, K. Tsuchida, J. Fujita, T. Usui, and T. Oda, Neutral beam probe spectroscopy for edge plasma diagnostics, J. Nucl. Mater. 128-129, 960 (1984).