![]() ![]() I recommend you to use hierarchy, although somewhat complex to use at first. cv::cvtColor(edges, edges, CV_BRG2GRAY) // if your org image is not grayscale Note that this will consume a small amount of time. ![]() ![]() If same thing happens, there are 3 alternatives: findContours(edges.clone(), contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE) // Find the contours in the image If your image background color is brighter than hand color, cv::findContour() with CV_RETR_CCOMP will detect whole frame first. So in your code, largest_contour_index = -1 įindContours(edges.clone(), contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE) // Find the contours in the image Variable 'largest_contour_index' is initialized outside for( ) loop and set to certain value ONLY IF larger contour appears, so it may cause Array out of bounds error. So if you're using findContour() with global source Mat image instance, try findContour(src.clone(), dat, etc.) rather than findContour(src, dat, etc.) the camera will be deinitialized automatically in VideoCapture destructorĬv::findContour() not only fills output contour array but also changes input Mat image. Largest_contour_index = i //Store the index of largest contourīounding_rect = boundingRect(contours) // Find the bounding rectangle for biggest contourĭrawContours(dst, contours, largest_contour_index, color, CV_FILLED, 8, hierarchy) // Draw the largest contour using previously stored index. Draw a pointer on the top of the hand region and draw the pointer on canvas along with the pixels. Vector>contours //Vector for storing contourįindContours(edges, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE) // Find the contours in the image But for advanced and more robustness, we must recognize the hand and draw only then.) The problem is so simple that it can be divided onto below steps:-Read the frame from the image and extract the hand region. Mat element = getStructuringElement(erosion_type, Size(2 * erosion_size + 1, 2 * erosion_size + 1), Point(erosion_size, erosion_size)) Canny(edges, edges, thresh, thresh*2, 3) Threshold(edges, edges, 22, 44, THRESH_BINARY) Mat dst(frame.rows, ls, CV_8UC1, Scalar::all(0)) If (!cap.isOpened()) // check if we succeededĬap > frame // get a new frame from video Romantic couple pinky promise line art, pinky swear contour drawings, minimalist lovers holding hands one line drawing, Doodle flower on watercolor texture. VideoCapture cap("pathaka.MP4") // open the default camera how can I resolve it? #include "stdafx.h" Browse 1148 incredible Rock And Roll Hand vectors, icons, clipart graphics, and backgrounds for royalty-free download from the creative contributors at. I am trying to detect the hand by finding the biggest contour (i.e the hand) but it draws a rectangle on the whole frame instead on the hand. In the Got It? section, examine some line drawings by one of the most famous artists of all time: Pablo Picasso.I am working on a hand recognition system and I am a beginner. Line drawings can be fun - and frustrating - but they have a simple beauty to them that other kinds of art do not.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |