How to compare two line graphs using data points - sql

I have 2 graphs as below with the blue line indicating an ideal scenario and the orange lines indicating couple of real scenarios. I wanted to check how similar the blue and orange lines are. Looking at the graph, it is obvious that the orange line in chart on top has very similar pattern as blue line. On the other hand, the orange line in bottom chart , has completely conflicting pattern. what is the best way to conclude the orange line in top chart is the better/ closest resembling pattern, mathematically.

Related

How to highlight ranges of lines in different colors in vscode extension development?

I'm trying to develop a vscode extension which would read some data from a file and based on that data, highlight ranges of lines in different colors. eg: lines 1 to 10 in red color, lines 20 to 40 in green, lines 50 to 100 in yellow. If that isn't possible I could also do the highlighting in the gutter. However, I've not been able to find anything in the vscode extension development docs that would allow me to do this. I was expecting there to be an API like vscode.editor.background(1, 10, 'red')

How to add two images together (green screen system) in LabVIEW

I have two images, one with subject and other one with background. The subject image has green background and I want to remove the green color from subject and add the subject without green color to another background, basically changing the background of one picture with another in LabVIEW without C code or MATLAB code, only using LabVIEW blocks.
So far, I got the following, but I am not getting one thing how to remove a very small portion of pixels. How to solve this problem,
So your algorithm is to replace a pixel, when red - blue =0 in the first place.
This condition is true for all this colors:
While there is no magenta in the picture, there is some almost black below the elbow and some almost white at the hand. So, that's replaced.
Try to restrict the colors to be replaced more, maybe like this:
Also, I'd to this independently for red and blue. So, for example
green > A AND red < B AND blue < C AND green-red > D AND green-blue > E
Since one of your files is names "final lec final.vi", I'd stop here ;-)
Oh, and just for fun: Playing with brightness and contrast reveals the JPEG artifacts, which is one part of the problem:

Coreldraw Multiple Contours in VBA

Guys I Am trying to set up a three colour text that is editable
Basically what I want is the text to be black
A 1st contour of 1mm that is white
a 2nd contour of 2mm thick which is black
I have tried the following 2 step contour
ActiveSelection.CreateContour cdrContourOutside, 2, 2, , , CreateRGBColor(0, 0, 0), CreateRGBColor(255, 255, 255)
this works perfectly as I want and when I edit the text the contour changes to the new text however the contours are both the same width (2mm) and not 1 & 2mm as i want
Also I cant get it to specify the correct color for each contour
If I break apart the 1st contour then add another this gives me contours of different widths and colors but I then loose the edit ability as the contour is not attached to the text
Any Ideas I Know its possible as I have seen a commercial macro that does it
Any Help appreciated
Mark
The best I can do for you is to show you the object model. I do not have CorelDraw and therefore cannot test anything.
Here is the link to the CorelDraw Object Model.
http://apps.corel.com/partners_developers/csp/resources/CorelDRAW%20VBA%20Object%20Model.pdf
And here is a link to a Programming Guide for CorelDraw.
http://apps.corel.com/partners_developers/csp/resources/dvba_pg.pdf
You can look up "Applying Effects" on page 72 of the programming guide which may help.
I would suggest also looking at creating curves from the .Shapes object and then looking at the TextRange object. the TextRange.Text property is the actual text you want to see and the TextRange.colorindex is the color of the text I believe. You will have to do some exploring, but this should help.

Multi-select Lookup Field data to VBA

Ultimately I'm going to want to make a whole bunch of checkboxes enabled&unlocked/disabled&locked based on which values are checked in a multi-select lookup, and how many are allowed. To do this, first I need to know how to get at the data in these multi-select lookups through vba. I imagine.
I've tried to set a variable in vba to the value of one of these fields, but the only data type it seems to accept is variant - and even then I can't get the immediate window to tell me what I've collected into that variable.
I need vba to be able to work out if a certain label is one of the ones listed in the multi-select field.
Now for further explanation/context, real examples: Lets say you can pick colours for a book based on what author and genre the book "owns". Each author and genre has a variable number of colours you can pick, and a limited range.
Lets say the book is by Bob, who is allowed an 2 of red, blue, orange and yellow, and it's a fantasy book, which can be 3 of red, white, grey, black and purple.
All of the checkboxes on the form for red, blue, yellow, orange, white, grey, black and purple become enabled and unlocked, while all the rest remain locked and disabled as they aren't available at all.
The user selects red - no change, except for that box being selected.
The user also selects blue - no change, except for that box being
selected, because while 2 (max allowed) of bob's colours are
selected, red is also on the fantasy list, which still has 2
remaining. The overlap saves more.
The user de-selects red, and selects yellow - red is still available
(fantasy) but orange is now disabled and locked.
The user selects red, white and purple - grey and black are disabled
and locked, as all options have now been exhausted.
Now, if you want to start me on all of how that'll work, fantastic, but all I'm really asking at this point is how to get hold of the data in those multi-select fields. The rest is for context etc.
The .Value property of a multi-select field, either a recordset or a control, is defined as a variant array in Access. This means you need to use array functions to get the value.
You can read the value like this:
rs.Fields("MyMultiValuedField").Value(0) 'First value
Join(rs.Fields("MyMultiValuedField").Value, ", ") 'Concatenated values
And set the value like this:
rs.Fields("MyMultiValuedField").Value = Array("Value1", "Value2")
Note that in a lookup field, the keys are stored, not the values being looked up. And in my experience, MVFs have minimal validation when assigning using VBA, you can even insert values of the wrong type leading to garbage.

How to cut out numbers from an image dynamically?

i've got to this stage:
where i can find the numbers in the above image but i need to cut them out so i can retain the order etc. but the as the number increases the spacing changes and the position of the number?
so i think it should be a find a white PX the continue until it find a solid black col and then use the points to do a simple cut any help would be great.
A simple solution would be this:
Find the first upmost horizontal line which contains white pixels
From that line find the first horizontal line which contains only black pixels
Those two lines are your upper and lower borders.
Between this borders proceed like this:
Find the first most left vertical line which contains white pixels
From that line find the last vertical line which contains only black pixels and which comes directly after a line with white pixels.
Those two lines are your left and right borders.
The steps to separate single numbers can be performed analogously.
If you need to identify which numbers are in your picture, I recommend using specialized computer vision libraries.
Some VB.net pseudo code to get you going:
Sub FindTopBorder(image As MyImage) As Integer
For y = 0 to image.Height - 1
For x = 0 to image.Width - 1
Dim pixel = image.GetPixel(x, y)
If ('Check if pixel is white here with RGB or Color') Then
Return y
End If
Next
Next
' Just in case there are no white pixels or use an exception instead
Return -1
End Sub
I would start looking into Connected component segmentation. You find a pixel which is within a character (number). Then run the connected component algorithm which finds all connected pixels under specific set of rules (e.g. slight deviation in color, stop at hard borders etc).
http://en.wikipedia.org/wiki/Connected-component_labeling
If you can use libraries, I'm sure OpenCV or similar libraries support this out of the box.
//edit
I see you need VB.net. Probably it is easiest to port some algorithm to VB or create one yourself.
See e.g. http://www.codeproject.com/Articles/336915/Connected-Component-Labeling-Algorithm
What to expect
Input
An image containing two shapes:
Output
Now each is separated into single images.