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:

42 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 Science Training in Hyderabad

    ReplyDelete
  15. 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
  16. 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
  17. 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
  18. Fantastic blog. Really an awesome blog. Informative and knowledgeable content. Keep sharing more stuff like this. Thank you.
    Data Science Training in Hyderabad

    ReplyDelete
  19. 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
  20. 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
  21. 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
  22. betflix online slots are the most popular money making game and it's easy to play. betflix

    ReplyDelete
  23. 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
  24. Kudos to the author for transforming a difficult subject into something easily understandable. The clear, concise breakdowns made it much easier to grasp, and I feel more confident because of it. Fantastic work!
    Visit our link for ISO Certification in Riyadh






    ReplyDelete
  25. This post was a lifesaver! I appreciate your thorough instructions. Using 123 hp com setup as a resource made the process even easier."

    ReplyDelete
  26. Your writing is truly inspiring, thank you. Don’t miss out on this profile for more incredible ideas Color Blind Test Free. Accurate testing leads to personalized visual solutions.

    ReplyDelete
  27. Love the way you explain things. Keep up the great work.Check out this site canuckle word game for additional informative content.Canuckle is a fun mix of learning and play! Today’s word was a nice surprise, and I always enjoy seeing Canadian themes reflected in the puzzles.

    ReplyDelete
  28. Wonderful post! Your tips are practical and incredibly useful for readers. Check this site reaction Time test out for a wealth of informative content.I had a great experience with this site. The reaction time test is fun, quick, and an excellent way to improve reflex speed effectively.

    ReplyDelete