Comments (13)
Hi!
The easiest way to do that is to iterate over the vector of KeyLines obtained from a DetectEDLines function (see main.cpp, line 57) and drop the short ones. You need to calculate the length of a line segment as l2 distance between the endpoints:
sqrt( (kl.startPointX-kl.endPointX)*(kl.startPointX-kl.endPointX) + (kl.startPointY-kl.endPointY)*(kl.startPointY-kl.endPointY) )
for a KeyLine kl.
from lbdmod.
Please check the latest version of main.cpp, it is different from your version, look here: https://github.com/alexandervakhitov/lbdmod/blob/master/main.cpp
from lbdmod.
I am sorry. Yesterday I forgot to commit the main.cpp. Could you please checkout & rebuild now?
from lbdmod.
Hi!
This how my main.cpp
look like with line number after //
sign
Forgive me, for keep asking, but I really didn't know where I should write the code for the calculation to ignore the relativity small lines.
cv::Mat debugDetector, imageColor; //53
cv::cvtColor(image, imageColor, CV_GRAY2BGR); //54
cv::line_descriptor::drawKeylines(imageColor, lines, debugDetector); //55
//56
if (is_highgui) //57
cv::imshow("detect 1", debugDetector); //58
Sorry if I wasted your valuable time.
from lbdmod.
I cloned your last copy, and as far as I understand from your first answer, I just made some changes to put my images:
cv::Mat image = cv::imread("/storage/kitti/dataset/sequences/00/image_0/000000.png", 0);
cv::Mat image2 = cv::imread("/storage/kitti/dataset/sequences/00/image_0/000001.png", 0);
then I should compile and run it, but during compilation, I got some errors that:
`1` p.factor = 1.2; // p has nor member (factor)
even when I checked OpenCV_Docs, I didn't find a factor
as a public attribute.
Another Error:
cv::cvtColor(image2, imageColor2, CV_GRAY2BGR) // CV_GRAY2BGR is not in the scope
So I changed it to 8
according to OpenCV_Docs
from lbdmod.
I use the code which is taken from OpenCV and modified, because the OpenCV code contains several bugs and memory leaks.
Please take a look here to see the 'factor' attribute of the KeyLine class. The compilation process should rely on this header instead of OpenCV's one:
https://github.com/alexandervakhitov/lbdmod/blob/master/include/opencv2/line_descriptor/descriptor.hpp
So, can you compile the version right after checking out from the repository without errors? If not, what happens?
from lbdmod.
Main.cpp
look like this:
#include <iostream>
#include "src/precomp.hpp"
#include "include/lbd_mod_funcs.h" // this line was #include "lbd_mod_funcs.h"
the point is that in src/precomp.hpp
at line 77
:
#include "opencv2/line_descriptor.hpp"
and in this file at line 46
:
#include "opencv2/line_descriptor/descriptor.hpp"
Apparently, it's the same file you referred that it should be included in your upper comment.
So I don't know why it can't see/access 'factor' attribute for cv::line_descriptor::BinaryDescriptor::Params
from lbdmod.
Probably, there is a problem with OpenCV. To debug this issue, please do the following.
Perform a clean checkout (I updated the repository), then run
cmake . make
then check that the build process finished successfully, and run
lbd_mod_test.
If something goes wrong during this procedure, please write here.
from lbdmod.
Hey,
I did what you asked after a fresh checkout, and I got this error:
$ ./lbd_mod_test
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/core/src/matrix.cpp:755: error: (-215:Assertion failed) dims <= 2 && step[0] > 0 in function 'locateROI'
Aborted (core dumped)
I was reading about it on Stackoverflow, most of the answers said it's related to image loading issues either not loaded properly or loaded greyscale but meant to be coloured!!
from lbdmod.
No worries mate, everything works fine now, I'll try to implement what you said in earlier comment and let you know if I had anything.
Till I finish from the main problem (ignoring the short lines), could you please leave this issue opened ?!
Thanks.
from lbdmod.
When I try to manipulate lines
L:52. I get segfault
error.
For example: when I tried to iterate over lines
and remove some of the elements who has lineLength
less than 150:
for(unsigned int i = 0; i < lines.size(); i++) {
if (lines.at(i).lineLength > 150) {
lines.erase(lines.begin() + i);
// the lines below when I use (( std::vector<cv::line_descriptor::KeyLine> newLines; ))
//newLines.insert(newLines.end(), i);
//newLines.push_back(i);
}
}
in both ways, the code will stop at L:53 I get Segmentation fault (core dumped)
As far as I know: Segfault
will be caused when I access memory I didn't suppose to access, or using a nullptr
. But I checked both cases for lines
or newLines
is not any of the previous cases.
Any ideas ?!
from lbdmod.
Dear Mohammed,
Imagine you have erased element number 5 with your code. Then if you wish to erase the element number 7, you will use lines.begin() + 7, while in fact it is in position lines.begin() + 6.
Please work using iterators as described here (https://stackoverflow.com/questions/3938838/erasing-from-a-stdvector-while-doing-a-for-each).
from lbdmod.
Thanks for your advice,
I tried to do what you asked me to do and I got this.
bool IsShort (cv::line_descriptor::KeyLine i) { return ((i.lineLength) < 150); }
int main() {
.......
std::vector<cv::line_descriptor::KeyLine> lines;
std::vector<cv::line_descriptor::KeyLine> newLines;
.......
std::vector<cv::line_descriptor::KeyLine>::iterator lEnd = lines.end();
lEnd = std::remove_if (lines.begin(), lEnd, IsShort);
......
for ( std::vector<cv::line_descriptor::KeyLine>::iterator q=lines.begin(); q != lEnd; ++q)
{
std :: cout << q->lineLength << std::endl;
newLines.push_back(*q);
}
// to here everything is alright.
// But when the code try to call ComputeLBD at run time =>
ComputeLBD(image, n_octaves, 1.2, newLines, &descs); // it causes the Segmentation fault
}
forgive me, but I'm not pro in c++.
from lbdmod.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lbdmod.