Open alexlib opened 7 years ago
@yosefm maybe pbi
has a solution the single-camera case? I think we need to add to correspondences.c
this part:
/* -------------if only one cam and 2D--------- */ //by Beat Lüthi June 2007
if(cpar->num_cams == 1){
if(res_name[0]==0){
sprintf (res_name, "rt_is");
}
fp1 = fopen (res_name, "w");
fprintf (fp1, "%4d\n", num[0]);
for (i=0; i<num[0]; i++){
o = epi_mm_2D (geo[0][i].x,geo[0][i].y,
Ex[0], I[0], G[0], *(cpar->mm), vpar,
&X,&Y,&Z);
pix[0][geo[0][i].pnr].tnr=i;
fprintf (fp1, "%4d", i+1);
fprintf (fp1, " %9.3f %9.3f %9.3f", X, Y, Z);
fprintf (fp1, " %4d", geo[0][i].pnr);
fprintf (fp1, " %4d", -1);
fprintf (fp1, " %4d", -1);
fprintf (fp1, " %4d\n", -1);
}
fclose (fp1);
match1=num[0];
}
and concatenate match1
with other matches of pairs, triplets and quadruplets?
Even in 3dptv, as I remmember, the 1-camera case is special. It is not added to other correspondences. If you do 1-cam, you don't need correspondences per se. You just build up the correspondence lists in a trivial way, as this code does. However, I highly recommend that you do not directly write to the rt_is file as this piece does. Build up the data structures and then call the writing function only in the same place that it's called for the real correspondences. That would be in the UI (e.g. Python), if anywhere.
On Fri, Mar 30, 2018 at 9:12 AM, Alex Liberzon notifications@github.com wrote:
@yosefm https://github.com/yosefm maybe pbi has a solution the single-camera case? I think we need to add to correspondences.c this part:
/ -------------if only one cam and 2D--------- / //by Beat Lüthi June 2007 if(cpar->num_cams == 1){ if(res_name[0]==0){ sprintf (res_name, "rt_is"); } fp1 = fopen (res_name, "w"); fprintf (fp1, "%4d\n", num[0]); for (i=0; i<num[0]; i++){ o = epi_mm_2D (geo[0][i].x,geo[0][i].y, Ex[0], I[0], G[0], *(cpar->mm), vpar, &X,&Y,&Z); pix[0][geo[0][i].pnr].tnr=i; fprintf (fp1, "%4d", i+1); fprintf (fp1, " %9.3f %9.3f %9.3f", X, Y, Z); fprintf (fp1, " %4d", geo[0][i].pnr); fprintf (fp1, " %4d", -1); fprintf (fp1, " %4d", -1); fprintf (fp1, " %4d\n", -1); } fclose (fp1); match1=num[0]; }
and concatenate match1 with other matches of pairs, triplets and quadruplets?
from https://github.com/OpenPTV/openptv-python/blob/ cc690f1fd0da7a01914fdb43f18d62a2cb9aff00/src_c/correspondences.c#L67
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OpenPTV/openptv/issues/118#issuecomment-377454689, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEljuPEF-p3U6AU-axznfmGV9lUbL5sks5tjczdgaJpZM4KTi6N .
i am not sure, but maybe it's better to use epipolar.pyx
instead of correspondes.c
and introduce it there? I could probably bind in epipolar.pyx
the epi_mm_2D
that exists in epi.c
and use it to fill the data structures?
@yosefm can you please take a look at the first attempt to get single camera solution through correspondences.pyx
and epi_mm_2D
binding? I'm stuck with the question on how to set up Frame 3D positions? I found in tracking_framebuf.pyx
the positions ()
but not set_positions
. What do you suggest? I'd appreciate a review of this approach. Would two if
statements be Pythonic enough?
https://github.com/alexlib/openptv/commit/edfcee2a828406de7d8d5cd99ccdbb27cbcaba01
I'll take a look over the weekend.
On Tue, Apr 3, 2018 at 12:07 AM, Alex Liberzon notifications@github.com wrote:
@yosefm https://github.com/yosefm can you please take a look at the first attempt to get single camera solution through correspondences.pyx and epi_mm_2D binding? I'm stuck with the question on how to set up Frame 3D positions? I found in tracking_framebuf.pyx the positions () but not set_positions. What do you suggest? I'd appreciate a review of this approach. Would two if statements be Pythonic enough?
https://github.com/alexlib/openptv/commit/edfcee2a828406de7d8d5cd99ccdbb27cbcaba01
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OpenPTV/openptv/issues/118#issuecomment-378046985, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEljr1ebcHqKzDZJJWBS2QGGfBfS2Noks5tkpMUgaJpZM4KTi6N .
The approach looks fine (apart from code quality comments I left on the commit). But I don't know where you want to set_position or put those of statements. Please give me some direction as line number, example code, or something else I can find.
Left you a comment on that line. from epi_mm_2d
we get pos
a 3d vector. How do I fill this value into the appropriate frm
structure. I want to follow your advice to fill frame and then write rt_is
file from it using the standard methods. The only workaround for a single camera is this dummy correspondence and rewriting of frame
structure.
@yosefm please help me to proceed - creation of sorted_pos is still not the solution as I'll have to use point_position
that is basically using ray_tracing
that does not have a epi_mm_2D
option,
https://github.com/yosefm/pbi/blob/master/ptv/sequence.py#L93 https://github.com/OpenPTV/openptv/blob/7e2a62ffa4477060cf8cd839c369f64541066049/py_bind/optv/orientation.pyx#L70 https://github.com/OpenPTV/openptv/blob/88ef4b79409498499fb9badd6031c2f404ff96cc/liboptv/src/orientation.c#L87
Maybe I can use some dirty trick by using skew_midpoint
twice with the same camera?
https://github.com/OpenPTV/openptv/blob/88ef4b79409498499fb9badd6031c2f404ff96cc/liboptv/src/orientation.c#L39
We decided to create a generalized point_positions
in orientation.pyx
that will include if ... else
statement and separate the 3D point_positions case from 2D (single camera case). Before that we also create sorted_pos
and sorted_corresp
arrays in correspondences.pyx
for the single camera case.
Todo:
correspondences.pyx
create a dummy
function that creates the structuresorientation.pyx
epi_mm_2d
In previous versions a single camera case was treated in correspondences. at least a necessary rt_is. file was written after the targets are converted to flat coordinates for the following tracking.
present version of correspondences in liboptv does not treat this case.