Home>
I am trying to extract pistil pixels from a strawberry color image using image processing and display a circle circumscribing the extracted stamens.
herecv :: I'm trying to display a circumscribed circle using minEnclosingCircle
, but it doesn't work.
According to opencv2.0 reference above Since is a set of 2D points, the Mat type pistil extraction image must be set to a 2D point set. I'm not sure about this conversion.
Please let me know if there is any solution.
This is the source code and input image.
# include<opencv2/core/core.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/highgui/highgui.hpp>
int
main (int argc, char * argv [])
{
// Load image
cv :: Mat img_input = cv :: imread ("input.jpg");
// Calculate circumscribed circle after converting to CV_ * C2 type Mat
cv :: Point2f center;
float radius;
cv :: minEnclosingCircle (cv :: Mat (img_input) .reshape (2), center, radius);
// draw circumscribed circle
cv :: circle (img_input, center, radius, cv :: Scalar (100,100,200), 2, CV_AA);
cv :: namedWindow ("image", CV_WINDOW_AUTOSIZE | CV_WINDOW_FREERATIO);
cv :: imshow ("image", img_input);
cv :: waitKey (0);
}
Windows 10
Opencv 3.4.0
Visual Studio Community 2015
-
Answer # 1
Related articles
- c ++ - how to build header files from opencv source
- c ++ - how to display std :: string obtained from dll by node-ffi of nodejs normally on nodejs?
- c ++ - after building opencv with cmake
- circle detection using opencv of binarized image is not possible (c++)
- python 3x - cannot display opencv video
- how to read and display a text file line by line with a for statement in c ++
- [swift5, ios-charts] i want to display a circle (round spot) in a specific place (value)
- how to enable c ++ opencv with vscode on mac
- while running opencv in c ++, an error occurs when creating a file for writing a video (writeropen)
- i get an error with c ++ opencv
- c ++ - i get an error when i try to compile opencv
- c ++ - i want to know the cause of the display area becoming strange when moving the camera with opengl
- i want to display an image using opencv from python
- about c ++ opencv labeling errors
- about opencv c ++ compilation
- python - opencv circle center color
- python - [opencv] i want to display the area of each object at the position adjacent to the object
- c # - to display the heart rate in real time with the circle gauge ui
- javascript - in html2canvas, the display of the circle is broken
- opencv c ++ image resizing method
Related questions
- about c ++ opencv labeling errors
- i want to pass an image from python to c ++
- is there any benefit to using an editor and gcc instead of visual studio in c ++ programming?
- c ++ - if the file cannot be found, an error will occur
- c ++ - i want to put a bgr image in the memory area of a dynamic object
- i want to rewrite c ++ printf to cout
- visualstudio c ++ linux "undefined reference to pthread_create"
- c ++ - i want to output numbers in a rectangular shape
- i don't know how to use the new features of c ++ 20 with cmake
- c ++ - i get an error when i try to compile opencv
(The input image looks like jpg) After binarizing appropriately
How about using findNonZero ()?