OpenMVG mainComputeMatches.cpp input explanation - c++

How can i compute descriptor matches using --pair_list option file (using main_ComputeMatches.cpp).
What is the format of data in the file specified by input --pair_list?
Thanks in advance for any suggestion.

You must list the image view index.
See your sfm_data.json, each image is linked to a view index.
In the pair_list file you just connect the image pair your wanna try to compute like
0 1
0 2
1 2
1 6
...

Expanding #Jack answer, you could also compact it like this:
0 1 2
1 2 6
...

Related

Is there a way to count from last condition x?

I have a complex set of data that can return 3 different conditions per row. I need to be able to count the last x rows matching one of the specific conditions.
The following formula has been working well for me, but I have discovered a glitch in one instance of this formula (the formula is replicated at least a dozen times)
=ArrayFormula(LOOKUP(9.99999999999999E+307,IF(FREQUENCY(IF(AQ:AQ)=1,ROW(AQ:AQ)),IF(AQ:AQ<>1,ROW(AQ:AQ)))=0,FREQUENCY(IF(AQ:AQ=1,ROW(AQ:AQ)),IF(AQ:AQ=0,ROW(AQ:AQ))))))
Current criteria are as such:
0: Condition x met - Reset counter
1: Condition y met - Increment counter
2: Condition z met - Ignore this row
Therefore this:
1
2
2
2
1
1
0
1
1
1
Should output: 3
This:
1
2
0
2
2
1
2
1
Should output: 2
However the glitch I have encountered isn't resetting the counter when 0 is reached, for example:
1
2
1
2
1
1
2
2
2
2
0
Should output: 0
But in fact is outputting: 4
I have tested all possible conditions with that specific data set and I cannot rectify the issue. I believe there is an error in the formula (specifically the 9.99999999999999E+307) but I wrote it so long ago that I cannot successfully debug it. I have tried 1E+306 but the result is the same.
EDIT1: Upon request I have included as stripped down version of the sheet as I can while recreating the issue.
https://docs.google.com/spreadsheets/d/1SOXiFMEQelqptBvjcabMZGNgG60TRRbe_b65rzT1bi0/edit?usp=sharing
If you scroll to the bottom of the sheet you can see Col AQ has a 0, as a result the value in the cell AF2 should be 0.
You will notice in the sheet that I am using Named Ranges.
EDIT2: player0's answer was PERFECT!! <3
I modified the new formula to adapt to my spreadsheet so it could accommodate Named Ranges and drop-down lists. This question helped me a lot with that:
Convert column index into corresponding column letter
The final formula (just FYI) turned out to be:
=ARRAYFORMULA(COUNTIF(
INDIRECT(REGEXEXTRACT(ADDRESS(ROW(), column(INDIRECT($A$1 & Z$1 & "L"))), "[A-Z]+")&
MAX(IF((INDIRECT($A$1 & Z$1 & "L")=0)*(INDIRECT($A$1 & Z$1 & "L")<>""),
ROW(INDIRECT($A$1 & Z$1 & "L"))+1,5))&":"&
REGEXEXTRACT(ADDRESS(ROW(), column(INDIRECT($A$1 & Z$1 & "L"))), "[A-Z]+")), 1))
=ARRAYFORMULA(COUNTIF(INDIRECT("A"&
MAX(IF((A2:A=0)*(A2:A<>""), ROW(A2:A)+1, ROW(A2)))&":A"), 1))
spreadsheet demo

Strange output with Python Lists

I have a dataframe: Outlet_results
it goes something like this
index Calendar year/Week Material Sellthru Qty
0 37.2013 ABC 2
1 38.2913 ABC 7
2 37.2913 BCG 22
3 39.2013 XYZ 5
Now, I wanted a separate list for the Materials and week for further coding.
I used this code for the material list
mat_outlet = list(set(outlet_result['Material']))
It works perfectly and gives me 3 values (ABC, BCG, XYZ)
However, the week list shows a faulty output even though the code is same.
week_outlet_list = list(set(outlet_result['Calendar Year/Week']))
I am getting a list with 4 values
['38.2013', '37.2013', 'Calendar Year/Week', '39.2013']
Why is the string (header) included in the list? Please help me understand this concept.
I am using Python 2.7.... has it got something to do with it?

GCP Data Prep- forward and backward fill

I have the following table which I am trying to wrangle in GCP Data prep:
Timestamp Event
2018-04-01 0
2018-04-02 0
2018-04-03 0
2018-04-04 0
2018-04-05 1
2018-04-06 0
2018-04-07 0
2018-04-08 0
I am trying to transform it in a way such that if Event is 1, then the previous 3 entries in the Event are set to 1 and the next 2 entries in Event are set to 2.
So, essentially the data set will look like the below after transformation
Timestamp Event
2018-04-01 0
2018-04-02 1
2018-04-03 1
2018-04-04 1
2018-04-05 1
2018-04-06 2
2018-04-07 2
2018-04-08 0
I have tried to use window and conditionals to achieve this, but w/o success.
Any ideas on how this transformation can be achieved? I am open to splitting the column or creating a new derived column if that can help achieve this result.
Thanks!
You can use window functions as part of your conditions in your IF statements. Using the PREV and NEXT window functions you can get the values at X rows above or below the current row in your window. Once you got the values, you can compare if they match the expected value and shape your IF statement accordingly.
For your use case, you need to verify if the PREV value at 1 or 2 position prior is equal to one and replace these rows by the number 2. If not true, if the NEXT value at position 1, 2 or 3 is equal to 1, the rows should be replaced with the number 1. Lastly, you need to check if the value at the current row is 1 and replace the remaining rows with 0. Converting this into a formula accepted by Dataprep would look like the following:
IF(PREV(Event, 1) == 1 || PREV(Event, 2) == 1, 2, IF(NEXT(Event, 1) == 1 || NEXT(Event, 2) == 1 || NEXT(Event, 3) == 1, 1, IF(Event == 1, 1, 0)))
To enter this formula on Dataprep, under the Function tab, select “Custom Formula”. Under the custom formula window, set the formula type to “Multiple row formula” as the PREV and NEXT function requires an additional argument specifying which column to sort by.

Replace certain records in a column with given condition in kdb

I have a table below:
tab:([]a:(`$"1-01";`2;`$"3-01";`4;`$"5-01";`6);source:`a`a`b`b`a`b)
a source
-----------
1-01 a
2 a
3-01 b
4 b
5-01 a
6 b
I would like to change the 1-01 and 5-01 back to 1 but not for 3-01 depending on the source. I wrote the code below:
`$({ssr[string x;"-01";""]}each tab[`a])
by doing this I can put this back to a column, but this is not what I want. I also did the following:
`$({ssr[string x;"-01";""]}each tab[`a] where source=`a)
but after doing this I do not know how to put it back to the table. Then I thought of using execution control: but not sure how i should code it. I have it half way done and it does not really work:
?[tab[`source] = `a;`$({ssr[string tab[`a];"-01";""]});tab[`a]]
An "update" seems to be what you need:
q)update `$ssr[;"-01";""] each string a from tab where source=`a
a source
-----------
1 a
2 a
3-01 b
4 b
5 a
6 b

How to extract names from the figure

I am working on a unix machine. and I have a list of names in .eps file format. I know I can easily grep show lines to extract my names but they're not in the same order as in the figure. is there a way to extract names from the figure while preserving the order?
example:
/ArialMT-ISOLatin1 findfont
32 scalefont
setfont
0 0 0 setrgbcolor
newpath
0 0 moveto
(King James) show
grestore
grestore
grestore
0 0 0 setrgbcolor
[] 0 setdash
5 setlinewidth
0 setlinejoin
1 setlinecap
newpath
-1013.087 5437.645 moveto
-574.44269 5148.3467 lineto
stroke
0 0 0 setrgbcolor
[] 0 setdash
5 setlinewidth
0 setlinejoin
1 setlinecap
newpath
-801.10602 5042.689 moveto
-683.66547 4973.3872 lineto
stroke
0 0 0 setrgbcolor
[] 0 setdash
5 setlinewidth
0 setlinejoin
0 setlinecap
newpath
-764.50114 5103.5574 moveto
-789.24211 5063.1816 -813.3093 5022.3968 -836.69272 4981.22 curveto
stroke
gsave [0.8480481 -0.52991926 0.52991926 0.8480481 -3204.0386 27.010243]
concat
gsave [1 0 0 -1 -1554.9214 5600.4102] concat
gsave
/ArialMT-ISOLatin1 findfont
32 scalefont
setfont
0 0 0 setrgbcolor
newpath
0 0 moveto
(M. L. King) show
...
M.L.King should go before King James but could I do this by exploiting the coordinate system?
thnx
First, I wanted to suggest to keep track of movements ie where the PostScript interpreter is putting the text, but that can be tricky since postscript is a fully fledged programming language. Another approach is to annotate your .eps files:
open a file with the 'open' command
for every show
a. get the current coordianates by 'currentpoint'. this leaves the coordinates on the stack
b. 'write' those two values into your file (as a .csv perhaps?) and the text which is going to be shown
close the file with 'closefile'
Run your annotated .eps file through a PS interpreter. Sort the generated file on the coordinates with the Unix 'sort' command, don't forget the -n option for both keys (ie y coordinate and x coordinate). And you are done.