Jump to content

processing Images using opencv help


 Share

Recommended Posts

Hi

i wan't get shape from image , using Image Processing 

I'm trying to find a Cirlce within the image Use Function  HoughCircles

this example image

 

 i am Use library opencv  on Autoit

this my Example , It processes the image well , But I do not know how to use _cvHoughCircles 

#include <GDIPlus.au3>
#include "include\OpenCVFcns.au3"

$hGUI = GUICreate("" , 85 , 170 )
GUISetState()

_GDIPlus_Startup()
_OpenCV_Startup()

$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromFile("img.bmp")
Local $pimg = _Opencv_BMP2IPL($hBitmap)
$pout = _cvCreateImage( _cvGetSize($pimg), 8 , 3);
$gray = _cvCreateImage( _cvGetSize($pimg), 8, 1);

$storage = _cvCreateMemStorage(0);
_cvCvtColor($pimg, $gray, $CV_BGR2GRAY);
_cvSmooth($gray, $gray, $CV_GAUSSIAN, 7, 7)
$canny = _cvCreateImage( _cvGetSize($pimg), 8 , 1);
$rgbcanny = _cvCreateImage(_cvGetSize($pimg), 8 , 3);
_cvCanny($gray, $canny, 50, 100, 3);
$circles = _cvHoughCircles($gray, $storage, $CV_HOUGH_GRADIENT, 1, 35.0, 75, 60,0,0);
_cvCvtColor($gray, $rgbcanny, $CV_GRAY2BGR)

#cs
for (int i = 0; i < circles->total; i++)  ; =====>  How Know this
    {
         // round the floats to an int
         float* p = (float*)cvGetSeqElem(circles, i);

#ce

Local $IPL2BMP = _OpenCv_IPL2BMP($rgbcanny)
Local $hGdiBmp = _GDIPlus_BitmapCreateFromHBITMAP($IPL2BMP)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBitmap, 2,2 ) ; = 1
_GDIPlus_GraphicsDrawImage($hGraphics, $hGdiBmp, 2, 90) ; = 1

Do
Until GuiGetMsg() = - 3

 

this code similar , but in C++

http://docs.opencv.org/2.4/doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.html

for( size_t i = 0; i < circles.size(); i++ )
{
   Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
   int radius = cvRound(circles[i][2]);
   // circle center
   circle( src, center, 3, Scalar(0,255,0), -1, 8, 0 );
   // circle outline
   circle( src, center, radius, Scalar(0,0,255), 3, 8, 0 );
 }

 

Edited by Alex1986
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...