Canny Edge Detection

void Canny(InputArray image, OutputArray edges, double threshold1, double threshold2, int apertureSize=3, bool L2gradient=false )
Parameters:
  • image – single-channel 8-bit input image.
  • edges – output edge map; it has the same size and type as image .
  • threshold1 – first threshold for the hysteresis procedure.
  • threshold2 – second threshold for the hysteresis procedure.
  • apertureSize – aperture size for the Sobel() operator.
  • L2gradient – a flag, indicating whether a more accurate L_2 norm =\sqrt{(dI/dx)^2 + (dI/dy)^2} should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether the default L_1 norm =|dI/dx|+|dI/dy| is enough ( L2gradient=false ).
 A good example for Canny Edge Detection is provided in OpenCV Documentation..

Functions:

Example:

-------------
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "iostream"

using namespace cv;
using namespace std;

int main( )
{
    Mat src1;
    src1 = imread("lena.jpg", CV_LOAD_IMAGE_COLOR);
    namedWindow( "Original image", CV_WINDOW_AUTOSIZE );
    imshow( "Original image", src1 );

    Mat gray, edge, draw;
    cvtColor(src1, gray, CV_BGR2GRAY);

    Canny( gray, edge, 50, 150, 3);

    edge.convertTo(draw, CV_8U);
    namedWindow("image", CV_WINDOW_AUTOSIZE);
    imshow("image", draw);

    waitKey(0);                                       
    return 0;
} 

-------------

Result:

38 comments:

  1. fatal error LNK1169: one or more multiply defined symbols found .. can u help me with this ?

    ReplyDelete
  2. forgot to mention m using visual basic c++ , with header file
    #include "stdafx"
    which is #include "stdafx.h"


    int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }

    ReplyDelete
  3. Error 1 error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z) referenced in function _main
    Error 14 fatal error LNK1120: 13 unresolved externals
    can u help me with this?
    thanks

    ReplyDelete
  4. Hi Kahna, Could you please upload a Tutorial on "Canny Edge Detection during live video capture". I am trying to figure out using: VideoCapture cap(0); code // and unable to implement it.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. Currently Python is the most popular Language in IT. Python adopted as a language of choice for almost all the domain in IT including Web Development, Cloud Computing (AWS, OpenStack, VMware, Google Cloud, etc.. ),Read More

    myTectra the Market Leader in Artificial intelligence training in Bangalore
    myTectra offers Artificial intelligence training in Bangalore using Class Room. myTectra offers Live Online Design Patterns Training Globally.Read More



    myTectra the Market Leader in Machine Learning Training in Bangalore myTectra offers Machine Learning Training in Bangalore using Class Room. myTectra offers Live Online Machine Learning Training Globally. Read More

    ReplyDelete
  7. I have bookmarked your website because this site contains valuable information in it. I am really happy with articles quality and presentation. Thanks a lot for keeping great stuff. I am very much thankful for this site.
    machine learning course in bangalore

    ReplyDelete
  8. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites! Now please do visit our website which will be very helpful.
    machine learning course bangalore

    ReplyDelete
  9. Awesome blog. I enjoyed reading your articles. This is truly a great read for me.


    data analytics course

    data science course

    business analytics course

    ReplyDelete
  10. This was really one of my favorite website. ExcelR machine learning course Please keep on posting.

    ReplyDelete
  11. Subsequent to reading your article i used to be surprised. I notice that you just clarify it quite well. moreover, I trust that totally different perusers can likewise encounter however I feel after reading your article.
    data scientist certification

    ReplyDelete
  12. I was really impressed after reading this because of some quality work and informative ideas. I just want to say thank you to the author and wish you all the best! With this I want to decorate my blog with you who giving thanks for every name of god.

    ReplyDelete
  13. I have bookmarked your website because this site contains valuable information in it. I am really happy with articles quality and presentation. Thanks a lot for keeping great stuff. I am very much thankful for this site. 100% cotton bath towels , hp laptop backpack price

    ReplyDelete
  14. I would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance.
    data scientist training and placement

    ReplyDelete
  15. I would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance.

    Data Science Training in Hyderabad

    ReplyDelete
  16. I was actually browsing the internet for certain information, accidentally came across your blog found it to be very impressive. I am elated to go with the information you have provided on this blog, eventually, it helps the readers whoever goes through this blog. Hoping you continue the spirit to inspire the readers and amaze them with your fabulous content.
    th
    Data Science Course in Faridabad

    ReplyDelete
  17. My website is in the exact same niche as yours and my visitors would genuinely benefit from some of the information you provide here. Please let me know if this okay with you. This paragraph is genuinely a nice one it assists new net visitors, who are wishing in favor of blogging. Thanks Feel free to visit my website; 먹튀검증

    ReplyDelete
  18. Its like you learn my thoughts! You appear to understand so much about this, like you wrote the book in it or something. I believe that you could do with some % to pressure the message house a little bit, but instead of that, this is magnificent blog. A fantastic read. I will certainly be back. Feel free to visit my website; 토토사이트

    ReplyDelete
  19. Fantastic blog. Really an awesome blog. Informative and knowledgeable content. Keep sharing more stuff like this. Thank you.
    Data Science Training in Hyderabad

    ReplyDelete
  20. webgirls.pl With regards to battling yeast infections, affected individuals frequently have their operate reduce to them. This is because candida albicans can easily become chronic and continuous. Bearing that in mind, on this page, we are going to present a selection of some of the best proven candida albicans treatment method and avoidance tips about.

    ReplyDelete
  21. https://gamebegin.xyz You may training on your own. A pitching equipment permits you to established the pace of the ball. By loading a number of baseballs into the unit, you may practice reaching without the need for a pitcher. This digital unit is perfect for all those who wish to process baseball on your own. Pitching models might be found in your nearby athletic merchandise shop.

    ReplyDelete
  22. Fairly certain he will have a good read.I appreciate your writing effort. Thank you for sharing! 바카라사이트

    ReplyDelete
  23. You need to take part in a contest for one of the best sites online. I’m going to highly recommend this web site! Thank you for hard work 바카라사이트인포

    ReplyDelete
  24. betflix online slots are the most popular money making game and it's easy to play. betflix

    ReplyDelete
  25. Well, I really appreciated for your great work. This topic submitted by you is helpful and keep sharing...
    Cheap Uncontested Divorce in VA
    Family Lawyer Cost
    Best Family Court Lawyers Near Me

    ReplyDelete