What preprocessing step to take before HoughLinesWhat is the difference between #include <filename> and #include “filename”?What are the differences between a pointer variable and a reference variable in C++?What does the explicit keyword mean?What is the effect of extern “C” in C++?What is the “-->” operator in C++?What is move semantics?What is the copy-and-swap idiom?What is The Rule of Three?What are the basic rules and idioms for operator overloading?What is a lambda expression in C++11?

Should I leave the first authorship of our paper to the student who did the project whereas I solved it?

Why does F + F' = 1?

Does an oscilloscope subtract voltages as phasors?

Can I toggle Do Not Disturb on/off on my Mac as easily as I can on my iPhone?

Random point on a sphere

Do they still use tiger roars in the 2019 "Lion King" movie?

Selecting 2 column in an Inner join

Mean π: Archimedes vs. Gauss - π computation through generalized means

Job offer without any details but asking me to withdraw other applications - is it normal?

Has SHA256 been broken by Treadwell Stanton DuPont?

Uncovering the Accelerated Dragon opening

How to help my 2.5-year-old daughter take her medicine when she refuses to?

Were Roman public roads build by private companies?

I was promised a work PC but still awaiting approval 3 months later so using my own laptop - Is it fair to ask employer for laptop insurance?

Where does the expression "triple-A" come from?

Do I need 3 RGB channels for a spectrogram CNN?

Relocation error, error code (127) after last updates

Gravity on an Orbital Ring

Where to disclose a zero day vulnerability

Evidence that matrix multiplication cannot be done in O(n^2 poly(log(n))) time

How to run Death House for 3 new players with no healer?

Leaving out pronouns in informal conversation

Is this WWI movie scene realistic?

Do ibuprofen or paracetamol cause hearing loss?



What preprocessing step to take before HoughLines


What is the difference between #include <filename> and #include “filename”?What are the differences between a pointer variable and a reference variable in C++?What does the explicit keyword mean?What is the effect of extern “C” in C++?What is the “-->” operator in C++?What is move semantics?What is the copy-and-swap idiom?What is The Rule of Three?What are the basic rules and idioms for operator overloading?What is a lambda expression in C++11?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I have written a program to



  1. Combined Edge information and colour information to form the image I would need to detect straight line from
    EdgeMapColourMapCombined Map or Frame

  2. Then I use findContour and drawContour to redraw the evidence map
    Output from findcontour


  3. after which I use some thinning algorithm to collapse the line into one single line
    thin line


  4. Use HoughLinesP to calculate for line Segment. Only have traces of the line. And most importantly have missed out the horizontal line


Output from Hough



  1. From these set of line Segment, calculate the intersection point (not included in code)

  2. From the intersection, draw a quadrilateral from the intersection point, vertices(called it v1 and v2, furthest from the intersection point) of the horizontal/vertical line and a vertex calculate based on the reflection of the intersection point on the line between v1 and v2

However, it is not working as i think it should. I think the problem lies with that the interior border of the rectangle is not filled. Should I use morphology eg dilation then erode. I have run out of ideas to preprocess the two "cues" image before trying to detect for intersection with Hough Transform



Need everyone help!



THanks in advance



Below is my code snippet to generate the following



int FindBoxes(cv::Mat& colorMap,cv::Mat& edgeMap)

cv::Mat frame;
// colorMap is a coloured filtered map while edgeMap is an edge filter Map. frame will be the colour i want
cv::bitwise_and(colorMap, edgeMap, frame);

// A trial method by using findContour to get the interior line filled up
std::vector<std::vector<cv::Point> > contours;
std::vector<cv::Vec4i> hierarchy;
cv::findContours(frame, contours, hierarchy, CV_RETR_EXTERNAL,
cv::CHAIN_APPROX_SIMPLE);

cv::Mat Map = cv::Mat::zeros(cueMap1.size(), CV_8U);
cv::drawContours(Map, contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);

// thin the line to collapse it into one single line for Hough Detection
cv::Mat thin;
thinning(Map, Map);

cv::GaussianBlur(Map, Map, cv::Size(5,5),1.0,1.0);

std::vector<cv::Vec4i> lines;
cv::HoughLinesP(Map, lines,1, CV_PI/90, 2, 30, 0);

return 0;










share|improve this question



















  • 1





    Could you please provide the original input image, so that one can get an impression, what the context is? Nevertheless, I would suggest NOT to thin your binary image before using HoughLinesP, better do this afterwards. Also, increase the angle resolution in HoughLinesP. I'd assume, that CV_PI/90 (i.e. 2 degree steps) might be too coarse.

    – HansHirse
    Mar 28 at 9:26











  • @HansHirse Sorry, not sure I could post the original image. is there ways to pm u? We are trying to detect the rectangle or quadrilateral (partial or full) in the image down here. But I took your suggestion of increasing the coarse step and to not use the thin algorithm before houghs transform. Also i have increased the minlineGap

    – user1538798
    Mar 28 at 9:44


















2















I have written a program to



  1. Combined Edge information and colour information to form the image I would need to detect straight line from
    EdgeMapColourMapCombined Map or Frame

  2. Then I use findContour and drawContour to redraw the evidence map
    Output from findcontour


  3. after which I use some thinning algorithm to collapse the line into one single line
    thin line


  4. Use HoughLinesP to calculate for line Segment. Only have traces of the line. And most importantly have missed out the horizontal line


Output from Hough



  1. From these set of line Segment, calculate the intersection point (not included in code)

  2. From the intersection, draw a quadrilateral from the intersection point, vertices(called it v1 and v2, furthest from the intersection point) of the horizontal/vertical line and a vertex calculate based on the reflection of the intersection point on the line between v1 and v2

However, it is not working as i think it should. I think the problem lies with that the interior border of the rectangle is not filled. Should I use morphology eg dilation then erode. I have run out of ideas to preprocess the two "cues" image before trying to detect for intersection with Hough Transform



Need everyone help!



THanks in advance



Below is my code snippet to generate the following



int FindBoxes(cv::Mat& colorMap,cv::Mat& edgeMap)

cv::Mat frame;
// colorMap is a coloured filtered map while edgeMap is an edge filter Map. frame will be the colour i want
cv::bitwise_and(colorMap, edgeMap, frame);

// A trial method by using findContour to get the interior line filled up
std::vector<std::vector<cv::Point> > contours;
std::vector<cv::Vec4i> hierarchy;
cv::findContours(frame, contours, hierarchy, CV_RETR_EXTERNAL,
cv::CHAIN_APPROX_SIMPLE);

cv::Mat Map = cv::Mat::zeros(cueMap1.size(), CV_8U);
cv::drawContours(Map, contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);

// thin the line to collapse it into one single line for Hough Detection
cv::Mat thin;
thinning(Map, Map);

cv::GaussianBlur(Map, Map, cv::Size(5,5),1.0,1.0);

std::vector<cv::Vec4i> lines;
cv::HoughLinesP(Map, lines,1, CV_PI/90, 2, 30, 0);

return 0;










share|improve this question



















  • 1





    Could you please provide the original input image, so that one can get an impression, what the context is? Nevertheless, I would suggest NOT to thin your binary image before using HoughLinesP, better do this afterwards. Also, increase the angle resolution in HoughLinesP. I'd assume, that CV_PI/90 (i.e. 2 degree steps) might be too coarse.

    – HansHirse
    Mar 28 at 9:26











  • @HansHirse Sorry, not sure I could post the original image. is there ways to pm u? We are trying to detect the rectangle or quadrilateral (partial or full) in the image down here. But I took your suggestion of increasing the coarse step and to not use the thin algorithm before houghs transform. Also i have increased the minlineGap

    – user1538798
    Mar 28 at 9:44














2












2








2








I have written a program to



  1. Combined Edge information and colour information to form the image I would need to detect straight line from
    EdgeMapColourMapCombined Map or Frame

  2. Then I use findContour and drawContour to redraw the evidence map
    Output from findcontour


  3. after which I use some thinning algorithm to collapse the line into one single line
    thin line


  4. Use HoughLinesP to calculate for line Segment. Only have traces of the line. And most importantly have missed out the horizontal line


Output from Hough



  1. From these set of line Segment, calculate the intersection point (not included in code)

  2. From the intersection, draw a quadrilateral from the intersection point, vertices(called it v1 and v2, furthest from the intersection point) of the horizontal/vertical line and a vertex calculate based on the reflection of the intersection point on the line between v1 and v2

However, it is not working as i think it should. I think the problem lies with that the interior border of the rectangle is not filled. Should I use morphology eg dilation then erode. I have run out of ideas to preprocess the two "cues" image before trying to detect for intersection with Hough Transform



Need everyone help!



THanks in advance



Below is my code snippet to generate the following



int FindBoxes(cv::Mat& colorMap,cv::Mat& edgeMap)

cv::Mat frame;
// colorMap is a coloured filtered map while edgeMap is an edge filter Map. frame will be the colour i want
cv::bitwise_and(colorMap, edgeMap, frame);

// A trial method by using findContour to get the interior line filled up
std::vector<std::vector<cv::Point> > contours;
std::vector<cv::Vec4i> hierarchy;
cv::findContours(frame, contours, hierarchy, CV_RETR_EXTERNAL,
cv::CHAIN_APPROX_SIMPLE);

cv::Mat Map = cv::Mat::zeros(cueMap1.size(), CV_8U);
cv::drawContours(Map, contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);

// thin the line to collapse it into one single line for Hough Detection
cv::Mat thin;
thinning(Map, Map);

cv::GaussianBlur(Map, Map, cv::Size(5,5),1.0,1.0);

std::vector<cv::Vec4i> lines;
cv::HoughLinesP(Map, lines,1, CV_PI/90, 2, 30, 0);

return 0;










share|improve this question














I have written a program to



  1. Combined Edge information and colour information to form the image I would need to detect straight line from
    EdgeMapColourMapCombined Map or Frame

  2. Then I use findContour and drawContour to redraw the evidence map
    Output from findcontour


  3. after which I use some thinning algorithm to collapse the line into one single line
    thin line


  4. Use HoughLinesP to calculate for line Segment. Only have traces of the line. And most importantly have missed out the horizontal line


Output from Hough



  1. From these set of line Segment, calculate the intersection point (not included in code)

  2. From the intersection, draw a quadrilateral from the intersection point, vertices(called it v1 and v2, furthest from the intersection point) of the horizontal/vertical line and a vertex calculate based on the reflection of the intersection point on the line between v1 and v2

However, it is not working as i think it should. I think the problem lies with that the interior border of the rectangle is not filled. Should I use morphology eg dilation then erode. I have run out of ideas to preprocess the two "cues" image before trying to detect for intersection with Hough Transform



Need everyone help!



THanks in advance



Below is my code snippet to generate the following



int FindBoxes(cv::Mat& colorMap,cv::Mat& edgeMap)

cv::Mat frame;
// colorMap is a coloured filtered map while edgeMap is an edge filter Map. frame will be the colour i want
cv::bitwise_and(colorMap, edgeMap, frame);

// A trial method by using findContour to get the interior line filled up
std::vector<std::vector<cv::Point> > contours;
std::vector<cv::Vec4i> hierarchy;
cv::findContours(frame, contours, hierarchy, CV_RETR_EXTERNAL,
cv::CHAIN_APPROX_SIMPLE);

cv::Mat Map = cv::Mat::zeros(cueMap1.size(), CV_8U);
cv::drawContours(Map, contours, -1, cv::Scalar(255, 255, 255), CV_FILLED);

// thin the line to collapse it into one single line for Hough Detection
cv::Mat thin;
thinning(Map, Map);

cv::GaussianBlur(Map, Map, cv::Size(5,5),1.0,1.0);

std::vector<cv::Vec4i> lines;
cv::HoughLinesP(Map, lines,1, CV_PI/90, 2, 30, 0);

return 0;







c++ opencv image-processing houghlinesp






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 28 at 9:11









user1538798user1538798

3494 silver badges19 bronze badges




3494 silver badges19 bronze badges










  • 1





    Could you please provide the original input image, so that one can get an impression, what the context is? Nevertheless, I would suggest NOT to thin your binary image before using HoughLinesP, better do this afterwards. Also, increase the angle resolution in HoughLinesP. I'd assume, that CV_PI/90 (i.e. 2 degree steps) might be too coarse.

    – HansHirse
    Mar 28 at 9:26











  • @HansHirse Sorry, not sure I could post the original image. is there ways to pm u? We are trying to detect the rectangle or quadrilateral (partial or full) in the image down here. But I took your suggestion of increasing the coarse step and to not use the thin algorithm before houghs transform. Also i have increased the minlineGap

    – user1538798
    Mar 28 at 9:44













  • 1





    Could you please provide the original input image, so that one can get an impression, what the context is? Nevertheless, I would suggest NOT to thin your binary image before using HoughLinesP, better do this afterwards. Also, increase the angle resolution in HoughLinesP. I'd assume, that CV_PI/90 (i.e. 2 degree steps) might be too coarse.

    – HansHirse
    Mar 28 at 9:26











  • @HansHirse Sorry, not sure I could post the original image. is there ways to pm u? We are trying to detect the rectangle or quadrilateral (partial or full) in the image down here. But I took your suggestion of increasing the coarse step and to not use the thin algorithm before houghs transform. Also i have increased the minlineGap

    – user1538798
    Mar 28 at 9:44








1




1





Could you please provide the original input image, so that one can get an impression, what the context is? Nevertheless, I would suggest NOT to thin your binary image before using HoughLinesP, better do this afterwards. Also, increase the angle resolution in HoughLinesP. I'd assume, that CV_PI/90 (i.e. 2 degree steps) might be too coarse.

– HansHirse
Mar 28 at 9:26





Could you please provide the original input image, so that one can get an impression, what the context is? Nevertheless, I would suggest NOT to thin your binary image before using HoughLinesP, better do this afterwards. Also, increase the angle resolution in HoughLinesP. I'd assume, that CV_PI/90 (i.e. 2 degree steps) might be too coarse.

– HansHirse
Mar 28 at 9:26













@HansHirse Sorry, not sure I could post the original image. is there ways to pm u? We are trying to detect the rectangle or quadrilateral (partial or full) in the image down here. But I took your suggestion of increasing the coarse step and to not use the thin algorithm before houghs transform. Also i have increased the minlineGap

– user1538798
Mar 28 at 9:44






@HansHirse Sorry, not sure I could post the original image. is there ways to pm u? We are trying to detect the rectangle or quadrilateral (partial or full) in the image down here. But I took your suggestion of increasing the coarse step and to not use the thin algorithm before houghs transform. Also i have increased the minlineGap

– user1538798
Mar 28 at 9:44













0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393817%2fwhat-preprocessing-step-to-take-before-houghlines%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393817%2fwhat-preprocessing-step-to-take-before-houghlines%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript