Week 6: Processing new images and adding a new plugin feature

Apr 16, 2021

Hello everyone, welcome to week 6 of my senior project post. This week, I
followed my on-site mentor to have a virtual tour in the Library of Congress
Preservation and Research Department, the place where most of the grooved
media is scanned. Throughout the trip, I am fortunate to get the change to
look at all the facilities involved in the scanning and processing. Meanwhile,
I also wrote a new plugin feature to my plugin, which is the focus of this

A new feature in my plugin!

Continuing from the last few weeks’ work, I wrote a new features for my plugin
‘CombineTrackWeighted’: a new input interface where the user can input the
weight they want to give to each track, and then the plugin will combine them

There are few steps involved in adding this new feature

1. Finding the way to add an input box where the user can input a value.
2. Accessing the value of the input boxes
3. Combining the inputed weight with the values of the current track.

The next session describes how I am going to tackle those steps

Finding the input box interface

Inspired by the similar feature in the plugin ‘RGB2Gray’, where users can
input their own weights of the red, green, and blue filters, I found the
plugin uses the interface called ‘NumericDown’ in the toolbox section. I added
that in my plugin, setting the numeric value in the plugin to have 2 digits
after decimal. Therefore, the user can set precise weights to find suitable
weights more easily.

Accessing the value of the input boxes.

After adding those input boxes, we have the image as shown below.

The plugin’s image after adding number boxes (in design mode)


Denoting those three input boxes as cboWeight1, cboWeight2, and cboWeight3,
respectively, we can access the value inside those boxes by the following code

double[] input_weight = new double[3];
if (ChkInputWeight.Checked)
input_weight[0] = Convert.ToDouble(cboWeight1.Value);
input_weight[1] = Convert.ToDouble(cboWeight2.Value);
input_weight[2] = Convert.ToDouble(cboWeight3.Value);

The value written to the input boxes is accessed by `Convert.ToDouble(cboWeight3.Value);` above. This full code snippet means we initialize an array of size 3 to store the values of the weight, and we store the values into it. Of course, most of these processes are done only if the user check the checkbox ‘ChkInputWeight’, or the value inside the array will all be one.

Combining the weights with values in the track

If the user has checked the input weight boxes, we will pre-process the values
stored in the track before it get processed by the options such as averaging,
excluding the outlier, etc. This is done by the following code, where the
mechanism is just to iterate through all the tracks and time them to the
correspond values.

// initializing the track weight by the user input
if (ChkInputWeight.Checked)
int num = track[0].Count – 2;
for (int i=0; i < track.Count; i++)
// j < 8 to avoid brightness
// for (int j = 2; j < Math.Min(track[i].Count, 8); j++).
for (int j = 2; j < track[i].Count; j++)
track[i][j] *= input_weight[(j+1)%3];

where the integer value j correspond to the number of the track after taking
it over a module of three (keep in mind that in programming langauge c#, the
module result might be negative, and that’s why we add 1 here instead of doing
things like subtracting it over 2).

Result of the plugin

The plugin runs successfully, but with something unexpected: when inputing in
values, including some extremely big ones, the track in the scanned image
doesn’t seem to change. I have contacted my onsite mentor and researchers of
the weaver project, and I am trying to debugging the program. The following
image is an example of running the plugin.

Result of the Plugin

Next Week

For next week, I will try to fix the error in the input feature so that the
change of change can be displayed in the scanned image. Besides, I will also
try to do a description combining all the music images, which I got after the
virtual tour in the Library of Congress, processed next week,
including the comparison between different shifting distances, noises in the
result, and the backgrounds of the music. I will also describe the virtual
tour in detail.

Leave a Reply