Discrete graph on chartjs - chart.js

I'm trying to make a discrete graph with time intervals. I need to do something like this or this
Does anyone know how to do this on chartjs?

Related

programmatic zoom and pan chartjs with logarithmic scale

In chartjs (v3) I'm programmatically zooming and panning by setting the min and max values for a series.
This works great, except if the series has a logarithmic scale ... this method doesn't seem to work, and has some strange results.
Any ideas on how I can achieve programmatic panning and zoom with logarithmic scales? Simply adding/subtracting the min/max values doesn't work correctly
EDIT: I see that the zoom plugin API has a zoomScale() function, but setting the min and max has the same effect... should min and max be calculated differently for logarithmic scales?
EDIT2: I'm trying to call the pan() function, which accepts Scale[] as a parameter ... I'm strugging to work out how to pass one of my scales, any ideas?
For zooming and panning, I'm using Zoom plugin: https://github.com/chartjs/chartjs-plugin-zoom
You can also find a specific sample on log axis: https://www.chartjs.org/chartjs-plugin-zoom/latest/samples/wheel/log.html
For anyone with a similar problem, I've got it working ...
I simply need to call the pan function like this:
mychart.pan(10, [mychart.scales['yMyScale']], 'none');

Calculating the median at each pixel for multiple frames OpenCV (C++)

The task is to extract stable background out of the video, the idea is to choose n random frames from the video and take median for each pixel. I was doing this task in python using numpy
medianFrame = np.median(frames, axis=0).astype(dtype=np.uint8)
But now i need to perform the same task in C++. I have tried the naive way of splitting channels and going through rows*cols number of pixels for n frames to calculate the median frame but its not efficient at all and takes way more time than what np.median was taking. I also try to use xtensor for performing the task but wasn`t able to worlk with it. Any suggestions or direction about how to approach this task would greatly help me, Thanks!

How to plot spectrogram from an array or (vector,list etc) containing raw data?

I have been working to find temporal displacement between audio signals using a spectrogram. I have a short array containing data of a sound wave (pulses at specific frequencies). Now I want to plot spectrogram from that array. I have followed this steps (Spectrogram C++ library):
It would be fairly easy to put together your own spectrogram. The steps are:
window function (fairly trivial, e.g. Hanning)
FFT (FFTW would be a good choice but if licensing is an issue then go for Kiss FFT or
similar)
calculate log magnitude of frequency domain components(trivial: log(sqrt(re * re + im * im))
Now after performing these 3 steps, I am stuck at how to plot the spectrogram from this available data? Being naive in this field, I need some clear steps ahead to plot the spectrogram.
I know that a simple spectrogram has Frequency at Y-Axis, time at X-axis and magnitude as the color intensity.
But how do I get these three things to plot the spectrogram? (I want to observe and analyze data behind spectral peaks(what's the value on Y-axis and X-axis), the main purpose of plotting spectrogram).
Regards,
Khubaib

3D Graph cut with shape prior

I'm applying 3D graph cuts based on Yuri Boykov's implementation in C++, itk and boost for min cut/max flow. First I provide some foreground and background seeds. Then I create the graph and assign the weight to the edges using 3D neighborhood (boundary term):
weight=vcl_exp(-vcl_pow(pixelDifference,2)/(2.0*sigma*sigma)),
being sigma a noise function.
Then I assign the source/sink edges depending on the intensity probability histogram (regional term):
this->Graph->add_tweights(nodeIterator.Get(),
-this->Lambda*log(sinkHistogramValue),
-this->Lambda*log(sourceHistogramValue));
So the energy function is E= regional term+boundary term. Then, the cut is compute with Boycov's implementation, but I don't understand exactly how. Anyway, now I want to add a shape prior to the cut, but I have no clue on how to do it.
Do I have to change the weight of the edges?
Do I have to create another energy function? And if so, how?
How could I provide both functions to the mincut/max flow algorithm?
Hope my questions are easily understandable.
Thank you very much,
Karen

An advice for a specific kind of RRDtool graph

I'm trying to graph some data with RRDtool and I have problems with defining the exact graph command.
The kind of graph I want is something like this:
http://oss.oetiker.ch/rrdtool/gallery/gate.spamd.week.600.png - the blue graph.
I can not "cook up" the definition for creating a graph like the one which is light blue and is on the background. It's a something between a line and an area :) . Any ideas what can I try?
Thank you in advance!
I guess it is an area stacked on a transparent area or on a line ... in that way you can create a 'floating' area.