Use argument shortest in C++ code in FFMPEG - c++

I need to set up the argument "-shortest" but in c++ code. I know that I can set up an argument with value for example:
av_opt_set(codecContext, "crf", "28", 0);
But here is the thing, there is a value, but in shortest no value.
So how can I set up shortest in c++ code
Thanks in advance

I got an answer here: https://www.reddit.com/r/ffmpeg/comments/oeuwlw/how_to_set_up_shortest_flag_programmatically_c/
So,
-shortest is a part of ffmpeg binary. Not available when working with the libav* libs.
You can set "fflags", "shortest" and "max_interleave_delta", "100M" on the AVFormatContext.

Related

How to convert python log normal distribution code to c++ code

I have a python code to calculate the probability using lognormal distribution function and want to convert it to c++. I tried the boost library but it does not provide the required functionality (as per my findings, please correct me if I am wrong).
df['prob'] = (1 - scipy.stats.lognorm(s=sd, loc=0, scale=math.exp(mean)).cdf(df.cum_size))**exponent
Can anyone help with this?

Extracting LBPFeatures in OpenCV

I am trying to extract the LBPFeatures of an image using OpenCV and C++, but there seems to be no in-built function to extract the features.
Can anyone help me?
I need to find the feature points and not the histogram.
The LBP authors give an optimized C code in one of their papers: here is the link.
you can find an old implementation of OpenCV in https://github.com/bytefish/opencv/tree/master/lbp
That libraries are included in newer versions of OpenCV, but the link have an example implementation

DFS shortest path of a maze in C++

I'm having trouble figuring out how exactly to get this to work... I'm attempting to get the shortest path to the goal using a DFS. I know that BFS is better but I was asked to use DFS for this. As you can see, I attempt to make a comparison between all stacks that lead to the end to find the goal, but it does not work, only the first stack that leads to the goal is ever printed... I know somewhere I need to unvisit nodes, but I cannot figure out exactly how. Right now I do get a path to the goal, but not the shortest one. Any help with this would be greatly appreciated.
Writing a non-recursive DFS is possible by using your own stack, but I find the recursive solution to be more elegant. Here is a sketch of one:
DFS(vertex)
path.push_back(vertex)
visited[vertex] = true
if we found the exit
output path
else
for each neighbor v of vertex
if not visited[v]
DFS(v)
visited[vertex] = false
path.pop_back()

Error after mosaicing face in opencv and c++

Following my previous post Mosaicing face problems in opencv , everything was working fine until I tried it again today and I get this error . Everything seems to be alright but I am confused why I am getting this error. Can anybody help please?
thanks
The error says that the source vector or the destination vector of some algorithm does not have enough data required by a particular algorithm present in imgwarp.cpp
As I have no idea of your code, I assume that you may be using getAffineTransform or perspective transform.
Probably the assertion failure must be from getAffineTransform. It must require 3 points for its input and output. Have a look at the code on how these points are selected.
As you mentioned that the code was previously working, there is a possibility that the input images are changed, mostly the new one is with a different dimension.

How do you remove directory qualifiers to simplify pathname using the Win32 API?

If you have a path like "C:\foo\.\bar\.." is there an easy way using the Win32 API to remove the directory qualifiers in order to simplify it to "C:\foo" ?
Update: It seems to be a more complicated issue. On this simple example of "C:\foo\.\bar\..", it works with both PathCanonicalize() and GetFullPathName() to get "C:\foo" as a result.
However, the path I'm passing has a symbolic link. So let's say I'm passing in "C:\NaNa\Boo\Bin\.." and "C:\NaNa" is a link to "D:\Apple". Then I get "C:\NaNa\Boo\Bin\.." back ratener than "C:\NaNa\Boo"
I would assume the functions work with just the strings but there seems to be a difference when using the symbolic link :-(
Update #2: It appears I had a line break character (0x0d) in the string that was passed in and this kept the function from working properly!
Take a look at shlwapi's PathCanonicalize()